cz.cuni.jagrlib.piece
Class XTransitionList

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

public class XTransitionList
extends Piece
implements BitMask

Bit-mask represented by "X-transition list" data structure.

Since:
0.03
See Also:
XTransitionList.java

Nested Class Summary
 class XTransitionList.XTransitionListEnumerator
          Special Enumerator for XTransitionList.
 
Field Summary
protected  int binaryOp
          Actual binary set operation.
protected static java.lang.String CATEGORY
          Object category.
static RegPiece reg
          Static registration instance for this class.
protected  cz.cuni.jagrlib.piece.XLine[] scanlines
          Array of scanlines (they are holding XItems).
protected  int setHeight
           
protected  int setWidth
           
protected static java.lang.String TEMPLATE_NAME
          Object template identifier.
protected  int yMax
          Maximum scanline coordinate + 1.
protected  int yMin
          Minimum scanline coordinate.
 
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
XTransitionList()
           
 
Method Summary
protected  void assertY(int y)
          Asserts that the given scanline is included in the set.
 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].
 void commit()
          Commits all previous changes to the internal object state.
 BitMaskEnumerator enumerator()
          BitMask enumeration.
protected static boolean find(int x, java.util.ListIterator<cz.cuni.jagrlib.piece.XItem> li)
          Finds the given X coordinate in the given List.
 java.lang.Object get(java.lang.String key)
          Gets the given property.
 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()
          XTransitionList re-initialization (keeps current bitmask size - if the size is relevant).
 void init(int x, int y)
          XTransitionList (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 set(java.lang.String key, java.lang.Object value)
          Sets the given property.
 void setHLine(int x1, int x2, int y)
          Sets the horizontal line from [min(x1,x2),y] to [max(x1,x2)-1,y].
protected  cz.cuni.jagrlib.piece.XLine setList(cz.cuni.jagrlib.piece.XLine l, int y)
          Sets the given scanline-set (using binaryOp operation).
protected  cz.cuni.jagrlib.piece.XLine setList(cz.cuni.jagrlib.piece.XLine l, int y, int x1, int x2)
          Sets the given scanline-set (hard-set .. by-passes the binaryOp operation) within the given bounds (from x1 to x2-1).
 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, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

yMin

protected int yMin
Minimum scanline coordinate.


yMax

protected int yMax
Maximum scanline coordinate + 1.


scanlines

protected cz.cuni.jagrlib.piece.XLine[] scanlines
Array of scanlines (they are holding XItems).


binaryOp

protected int binaryOp
Actual binary set operation.


setWidth

protected int setWidth

setHeight

protected int setHeight

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

XTransitionList

public XTransitionList()
Method Detail

assertY

protected void assertY(int y)
Asserts that the given scanline is included in the set.

Parameters:
y - Y coordinate to be included.

setList

protected cz.cuni.jagrlib.piece.XLine setList(cz.cuni.jagrlib.piece.XLine l,
                                              int y)
Sets the given scanline-set (using binaryOp operation).

Parameters:
l - The scanline-set.
y - Y coordinate of the scanline.
Returns:
The new X-transition list.

setList

protected cz.cuni.jagrlib.piece.XLine setList(cz.cuni.jagrlib.piece.XLine l,
                                              int y,
                                              int x1,
                                              int x2)
Sets the given scanline-set (hard-set .. by-passes the binaryOp operation) within the given bounds (from x1 to x2-1).

Parameters:
l - The scanline-set.
y - Y coordinate of the scanline.
x1 - X coordinate of the scanline-set begin.
x2 - X coordinate of the first point after the scanline-set.
Returns:
The new X-transition list.

find

protected static boolean find(int x,
                              java.util.ListIterator<cz.cuni.jagrlib.piece.XItem> li)
Finds the given X coordinate in the given List. Modifies ListIterator such that the XItem found (it.x >= x) is the next to be processed.

Parameters:
x - Boundary X coordinate
li - The initialized ListIterator.
Returns:
The inside-status of the set before the next XItem.

init

public void init(int x,
                 int y)
XTransitionList (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()
XTransitionList 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.

set

public void set(java.lang.String key,
                java.lang.Object value)
Sets the given property.

Specified by:
set in interface Property
Overrides:
set in class DefaultProperty
Parameters:
key - Key string.
value - The new value.
See Also:
Property.commit()

get

public java.lang.Object get(java.lang.String key)
Gets the given property.

Specified by:
get in interface Property
Overrides:
get in class DefaultProperty
Parameters:
key - Key string.
Returns:
The actual value or null.

commit

public void commit()
Commits all previous changes to the internal object state. Non-mandatory.

Specified by:
commit in interface Property
Overrides:
commit in class DefaultProperty

setTemplate

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