cz.cuni.jagrlib.piece
Class OverwriteClassificator

java.lang.Object
  extended by cz.cuni.jagrlib.DefaultProperty
      extended by cz.cuni.jagrlib.Piece
          extended by cz.cuni.jagrlib.piece.OverwriteClassificator
All Implemented Interfaces:
Breakable, BitMask, BitMaskCore, Property, Template

public class OverwriteClassificator
extends Piece
implements BitMask

Classificator for overwritting flood-fill.

Since:
0.24
See Also:
OverwriteClassificator.java

Field Summary
protected  int[] aColor
          Working color array.
protected  int bands
          Accelerator: number of color bands of underlying RasterGraphics.
protected static java.lang.String CATEGORY
          Object category.
protected  int[] color
          Overwritten color.
protected  int height
          Height of the underlying image.
protected  RasterGraphics image
          Accelerator: underlying raster image.
static RegPiece reg
          Static registration instance for this class.
protected static java.lang.String TEMPLATE_NAME
          Object template identifier.
protected  int width
          Width of the underlying image.
 
Fields inherited from class cz.cuni.jagrlib.Piece
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak
 
Fields inherited from interface cz.cuni.jagrlib.iface.BitMask
HEIGHT, WIDTH
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Fields inherited from interface cz.cuni.jagrlib.Template
ALL_PLUGS, C_1D, C_2D, C_3D, C_ALPHA, C_BINARY, C_BREP, C_CAMERA, C_CIRCLE, C_CLIP, C_COMPRESSION, C_CURVE, C_DATA, C_DRAW, C_EDITOR, C_ELLIPSE, C_FILL, C_FILTER, C_FLOAT, C_FUNCTION, C_IMAGE, C_INTEGER, C_IO, C_LIGHT, C_LINE, C_METRIC, C_POLYGON, C_PROJECTION, C_RADIOSITY, C_RASTER, C_RENDER, C_SAMPLE, C_SCENE, C_SET, C_SOLID, C_TEXT, C_TRANSFORM, C_VECTOR, C_VIEWER, C_WORKER, CAT_EMPTY, EMPTY, IFACE, JAGRLIB, JAGRLIB2, MANIPULATOR_COMBO, MANIPULATOR_CUSTOM, MANIPULATOR_DEFAULT, MANIPULATOR_MULTILINE, PL_ALPHAMASK, PL_BITMASK, PL_CAUSTIC, PL_CODEC, PL_COLORMAP, PL_COMPARE, PL_DATA, PL_DIRECT, PL_EDITOR, PL_FILTER, PL_FUNCTION, PL_IMAGE, PL_IMPORT, PL_INPUT, PL_INTERSECTION, PL_LIGHTSOURCE, PL_ORDER, PL_OUTPUT, PL_PALETTE, PL_PHOTON, PL_PROPERTY, PL_QUANTIZER, PL_RASTER, PL_RENDER, PL_SHADOW, PL_STREAM, PL_TRANSFORM, PL_TRIGGER, PL_VOLUME, PL_WINDOW, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_LONG, TYPE_OBJECT, TYPE_STRING
 
Constructor Summary
OverwriteClassificator()
           
 
Method Summary
 void bitBlt(int dx, int dy, int sx, int sy, int width, int height)
          Bit-block-transfer routine: copies the source rectangle [sx,sy,width,height] to the new location [dx,dy].
 BitMaskEnumerator enumerator()
          BitMask enumeration.
 void getHLine(int x1, int x2, int y, boolean[] values)
          Returns the pixels' values for the given horizontal line.
 boolean getPixel(int x, int y)
          Returns the pixel's value.
 void getRectangle(int x1, int y1, int x2, int y2, boolean[][] values)
          Returns the pixels' values for the given rectangle.
 void init()
          BitMask re-initialization (keeps current bitmask size - if the size is relevant).
 void init(int x, int y)
          BitMask (re-)initialization.
 void putHLine(int x1, int x2, int y, boolean[] values)
          Sets the horizontal line's values (ignores current binary set operation).
 void putPixel(int x, int y, boolean value)
          Sets the given pixel's value (ignores current binary set operation).
 void putRectangle(int x1, int y1, int x2, int y2, boolean[][] values)
          Sets the rectangle's values (ignores current binary set operation).
 void setHLine(int x1, int x2, int y)
          Sets the horizontal line from [min(x1,x2),y] to [max(x1,x2)-1,y].
 int setOperation(int _op)
          Sets the binary set operation (used in all set*() methods).
 void setPixel(int x, int y)
          Sets the given pixel's value to true = "painted".
 void setRectangle(int x1, int y1, int x2, int y2)
          Sets the rectangle from [min(x1,x2),min(y1,y2)] to [max(x1,x2)-1,max(y1,y2)-1].
static int setTemplate(Template t, int ord)
          General-purpose registration routine.
 
Methods inherited from class cz.cuni.jagrlib.Piece
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop
 
Methods inherited from class cz.cuni.jagrlib.DefaultProperty
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Field Detail

color

protected int[] color
Overwritten color.


aColor

protected int[] aColor
Working color array.


bands

protected int bands
Accelerator: number of color bands of underlying RasterGraphics.


width

protected int width
Width of the underlying image.


height

protected int height
Height of the underlying image.


image

protected RasterGraphics image
Accelerator: underlying raster image.


TEMPLATE_NAME

protected static final java.lang.String TEMPLATE_NAME
Object template identifier.

See Also:
Constant Field Values

CATEGORY

protected static final java.lang.String CATEGORY
Object category.

See Also:
Constant Field Values

reg

public static final RegPiece reg
Static registration instance for this class. Automatically initialized in class-loading time.

Constructor Detail

OverwriteClassificator

public OverwriteClassificator()
Method Detail

init

public void init(int x,
                 int y)
BitMask (re-)initialization.

Specified by:
init in interface BitMaskCore
Parameters:
x - Width of a new bitmask.
y - Height of a new bitmask.

init

public void init()
BitMask re-initialization (keeps current bitmask size - if the size is relevant).

Specified by:
init in interface BitMaskCore

setOperation

public int setOperation(int _op)
Sets the binary set operation (used in all set*() methods).

Specified by:
setOperation in interface BitMask
Parameters:
_op - Binary set operation (BinaryOperation.BIN_OP_* constant).
Returns:
The old binary set operation.
See Also:
Binary operations

setPixel

public void setPixel(int x,
                     int y)
Sets the given pixel's value to true = "painted". Accepts current binary set operation.

Specified by:
setPixel in interface BitMaskCore
Parameters:
x - X coordinate of a pixel.
y - Y coordinate of a pixel.

putPixel

public void putPixel(int x,
                     int y,
                     boolean value)
Sets the given pixel's value (ignores current binary set operation).

Specified by:
putPixel in interface BitMask
Parameters:
x - X coordinate of a pixel.
y - Y coordinate of a pixel.
value - New pixel's value.

getPixel

public boolean getPixel(int x,
                        int y)
Returns the pixel's value.

Specified by:
getPixel in interface BitMaskCore
Parameters:
x - X coordinate of a pixel.
y - Y coordinate of a pixel.
Returns:
Pixel value (false for off-canvas access).

setHLine

public void setHLine(int x1,
                     int x2,
                     int y)
Sets the horizontal line from [min(x1,x2),y] to [max(x1,x2)-1,y]. Accepts current binary set operation.

Specified by:
setHLine in interface BitMaskCore
Parameters:
x1 - X coordinate of the starting pixel.
x2 - X coordinate of the first pixel after the line.
y - Common Y coordinate of the line.

putHLine

public void putHLine(int x1,
                     int x2,
                     int y,
                     boolean[] values)
Sets the horizontal line's values (ignores current binary set operation).

Specified by:
putHLine in interface BitMask
Parameters:
x1 - X coordinate of the starting pixel.
x2 - X coordinate of the first pixel after the line.
y - Common Y coordinate of the line.
values - New pixels' values.

getHLine

public void getHLine(int x1,
                     int x2,
                     int y,
                     boolean[] values)
Returns the pixels' values for the given horizontal line.

Specified by:
getHLine in interface BitMask
Parameters:
x1 - X coordinate of the starting pixel.
x2 - X coordinate of the first pixel after the line.
y - Common Y coordinate of the line.
values - Returned values in boolean[] array (false for off-canvas access).

setRectangle

public void setRectangle(int x1,
                         int y1,
                         int x2,
                         int y2)
Sets the rectangle from [min(x1,x2),min(y1,y2)] to [max(x1,x2)-1,max(y1,y2)-1]. Accepts current binary set operation.

Specified by:
setRectangle in interface BitMask
Parameters:
x1 - X coordinate of the upper left corner.
y1 - Y coordinate of the upper left corner.
x2 - X coordinate of the lower right corner (outside pixel).
y2 - Y coordinate of the upper left corner (outside pixel).

putRectangle

public void putRectangle(int x1,
                         int y1,
                         int x2,
                         int y2,
                         boolean[][] values)
Sets the rectangle's values (ignores current binary set operation).

Specified by:
putRectangle in interface BitMask
Parameters:
x1 - X coordinate of the upper left corner.
y1 - Y coordinate of the upper left corner.
x2 - X coordinate of the lower right corner (outside pixel).
y2 - Y coordinate of the upper left corner (outside pixel).
values - New pixels' values.

getRectangle

public void getRectangle(int x1,
                         int y1,
                         int x2,
                         int y2,
                         boolean[][] values)
Returns the pixels' values for the given rectangle.

Specified by:
getRectangle in interface BitMask
Parameters:
x1 - X coordinate of the upper left corner.
y1 - Y coordinate of the upper left corner.
x2 - X coordinate of the lower right corner (outside pixel).
y2 - Y coordinate of the upper left corner (outside pixel).
values - Returned values in boolean[][] array (false for off-canvas access).

bitBlt

public void bitBlt(int dx,
                   int dy,
                   int sx,
                   int sy,
                   int width,
                   int height)
Bit-block-transfer routine: copies the source rectangle [sx,sy,width,height] to the new location [dx,dy]. Binary set operation is ignored.

Specified by:
bitBlt in interface BitMask
Parameters:
dx - X coordinate of the upper left destination corner.
dy - Y coordinate of the upper left destination corner.
sx - X coordinate of the upper left source corner.
sy - Y coordinate of the upper left source corner.
width - Rectangle width.
height - Rectangle height.

enumerator

public BitMaskEnumerator enumerator()
BitMask enumeration.

Specified by:
enumerator in interface BitMaskCore
Returns:
The BitMaskEnumerator object instance.

setTemplate

public static int setTemplate(Template t,
                              int ord)
General-purpose registration routine. Sets all plugs, strings, etc. to the given Template.