cz.cuni.jagrlib.piece
Class PolygonScanline.Supersampler

java.lang.Object
  extended by cz.cuni.jagrlib.piece.PolygonScanline.Supersampler
All Implemented Interfaces:
BitMaskCore
Enclosing class:
PolygonScanline

protected static class PolygonScanline.Supersampler
extends Object
implements BitMaskCore

Temporary rendering target for super-sampling. Flushes finished hlines to attached AlphaMask.

Uses PE's linear super-sampling buffer.


Field Summary
protected  double areaCoef
          Pixel area multiplier (accelerator).
protected  int[] buffer
          Linear ss-buffer.
protected static int BUFFER_GRANUL
          Buffer granularity (to reduce memory allocations).
protected static BitMaskEnumerator ENUM
          Useless enumerator singleton.
protected  AlphaMask output
          Anti-aliased output.
protected  int supersampling
          Supersampling factor (accelerator).
protected  int xMax
          Right buffer coordinate.
protected  int xMin
          Left buffer coordinate (supersampling-multiple).
protected  int yMin
          Upper buffer coordinate (supersampling-multiple).
 
Constructor Summary
PolygonScanline.Supersampler(int superSampling, AlphaMask aMask)
           
 
Method Summary
 BitMaskEnumerator enumerator()
          Bit-mask enumeration.
 void flushBuffer()
          Flushes unwritten data to attached AlphaMask.
 boolean getPixel(int x, int y)
          Returns the pixel's value.
 void init()
          Bit-mask re-initialization (keeps current bitmask size - if the size is relevant).
 void init(int x, int y)
          Bit-mask (re-)initialization.
 void setHLine(int x1, int x2, int y)
          Sets the horizontal line from [min(x1,x2),y] to [max(x1,x2)-1,y].
 void setPixel(int x, int y)
          Sets the given pixel's value to true = "painted".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_GRANUL

protected static final int BUFFER_GRANUL
Buffer granularity (to reduce memory allocations).

See Also:
Constant Field Values

supersampling

protected final int supersampling
Supersampling factor (accelerator).


areaCoef

protected final double areaCoef
Pixel area multiplier (accelerator).


output

protected final AlphaMask output
Anti-aliased output.


buffer

protected int[] buffer
Linear ss-buffer.


xMin

protected int xMin
Left buffer coordinate (supersampling-multiple).


xMax

protected int xMax
Right buffer coordinate.


yMin

protected int yMin
Upper buffer coordinate (supersampling-multiple).


ENUM

protected static final BitMaskEnumerator ENUM
Useless enumerator singleton.

Constructor Detail

PolygonScanline.Supersampler

public PolygonScanline.Supersampler(int superSampling,
                                    AlphaMask aMask)
Method Detail

flushBuffer

public void flushBuffer()
Flushes unwritten data to attached AlphaMask.


init

public void init(int x,
                 int y)
Bit-mask (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()
Bit-mask re-initialization (keeps current bitmask size - if the size is relevant).

Specified by:
init in interface BitMaskCore

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.

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.

enumerator

public BitMaskEnumerator enumerator()
Bit-mask enumeration.

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