fr.emn.examples.icondraw
Class DBrushTool

java.lang.Object
  extended byfr.emn.reactiveinput.AbstractDevice
      extended byfr.emn.examples.icondraw.DTool
          extended byfr.emn.examples.icondraw.DBrushTool
All Implemented Interfaces:
Device, Processor
Direct Known Subclasses:
DFreehand, DLine, DRect

public abstract class DBrushTool
extends DTool

A DTool with brush attributes


Field Summary
 In a
           
 In b
           
protected  LiteColor color
           
protected  LiteContext context
           
 In g
           
 In r
           
protected  LiteStroke stroke
           
protected  int w_val
           
 In width
           
 In x
           
 In y
           
 
Fields inherited from class fr.emn.examples.icondraw.DTool
activate, use
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DBrushTool()
          DBrushTool constructor comment.
DBrushTool(java.lang.String name, DrawView view)
          DBrushTool constructor comment.
 
Method Summary
static double check(double d)
          paint method comment.
 LiteColor getColor()
           
 LiteContext getContext()
           
 LiteStroke getStroke()
           
 Processor open(OpenContext context)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
 void paint(java.awt.Graphics2D g)
          Draw brush feedback
 boolean update_begin()
          Initiates an interaction.
 void update_value(boolean force)
          Update interaction values.
 
Methods inherited from class fr.emn.examples.icondraw.DTool
close, copy, getActivated, getScreenCoordinates, hasExternalOutput, isActive, isUsed, setActivated, setScreenCoordinates, toLocal, update_abort, update_end, update
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalInput, init, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

public final In width

r

public final In r

g

public final In g

b

public final In b

a

public final In a

x

public final In x

y

public final In y

color

protected LiteColor color

stroke

protected LiteStroke stroke

context

protected LiteContext context

w_val

protected int w_val
Constructor Detail

DBrushTool

public DBrushTool()
DBrushTool constructor comment.


DBrushTool

public DBrushTool(java.lang.String name,
                  DrawView view)
DBrushTool constructor comment.

Method Detail

check

public static double check(double d)
paint method comment.


getColor

public LiteColor getColor()

getContext

public LiteContext getContext()

getStroke

public LiteStroke getStroke()

paint

public void paint(java.awt.Graphics2D g)
Draw brush feedback

Specified by:
paint in class DTool

open

public Processor open(OpenContext context)
Description copied from class: AbstractDevice
Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.

By default, open() does nothing and returns the device itself as the Processor (or null if it is not openable): AbstractDevice implements both Device and Processor interfaces, so that you can add processing code directly into the device.

If you want to add specialization features, subclass this method to return a specific processor implementation depending on your device configuration.

Example :

public Processor getProcessor() { if (super.open() == null) return null; // Select the right processor if (in2.isValid()) { return new twoParamProcessor(in1, in2, out); else return new oneParamProcessor(in1, out); }

In this method, you may also perform all necessary pre-running initialization. If initialization fails, return null even if isOpenable() returns true.

In all cases, return null if isOpenable() returns false.

Specified by:
open in interface Device
Overrides:
open in class DTool

update_value

public void update_value(boolean force)
Description copied from class: DTool
Update interaction values.

This method is called during an interaction every time a value may have changed.

Additionnaly, it is called with first=true just after interaction has been initiated (provided that update_begin returned true) and just before interaction has been aborted or validated.

Specified by:
update_value in class DTool

update_begin

public boolean update_begin()
Description copied from class: DTool
Initiates an interaction.

You can refuse starting an interaction by returning false (e.g. if you do not have enough data). This method will be re-checked the next tick.

Specified by:
update_begin in class DTool