public final class PiscesRenderer
extends java.lang.Object
GraphicsSurface surface = new GraphicsSurface();
PiscesRenderer pr = new PiscesRenderer(surface);
void paint(Graphics g) {
- surface.bindTarget(g);
//we set stroke color
pr.setColor(0xFF, 0x00, 0xAF);
// we set required Porter-Duff Compositing Rule
pr.setComposite(RendererBase.COMPOSITE_SRC_OVER);
//switch antialising on/off as required
pr.setAntialiasing(true); // on
pr.setTransform(ourTransform6Matrix);
//and now let's draw something finally
pr.beginRendering(RendererBase.WIND_EVEN_ODD);
pr.moveTo(50 << 16, 100 << 16); //
pr.lineTo(30<<16, 1<<16);
pr.endRendering();
surface.releaseTarget();
}
Modifier and Type | Field and Description |
---|---|
static int |
ARC_CHORD |
static int |
ARC_OPEN |
static int |
ARC_PIE |
private long |
nativePtr |
private AbstractSurface |
surface |
Constructor and Description |
---|
PiscesRenderer(AbstractSurface surface)
Creates a renderer that will write into a given surface.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkColorRange(int v,
java.lang.String componentName) |
void |
clearRect(int x,
int y,
int w,
int h)
Clears rectangle (x, y, x + w, y + h).
|
private void |
clearRectImpl(int x,
int y,
int w,
int h) |
void |
drawImage(int imageType,
int imageMode,
int[] data,
int width,
int height,
int offset,
int stride,
Transform6 textureTransform,
boolean repeat,
int bboxX,
int bboxY,
int bboxW,
int bboxH,
int lEdge,
int rEdge,
int tEdge,
int bEdge,
int txMin,
int tyMin,
int txMax,
int tyMax,
boolean hasAlpha) |
private void |
drawImageImpl(int imageType,
int imageMode,
int[] data,
int width,
int height,
int offset,
int stride,
Transform6 textureTransform,
boolean repeat,
int bboxX,
int bboxY,
int bboxW,
int bboxH,
int lEdge,
int rEdge,
int tEdge,
int bEdge,
int txMin,
int tyMin,
int txMax,
int tyMax,
boolean hasAlpha) |
void |
emitAndClearAlphaRow(byte[] alphaMap,
int[] alphaDeltas,
int pix_y,
int pix_x_from,
int pix_x_to,
int rowNum) |
private void |
emitAndClearAlphaRowImpl(byte[] alphaMap,
int[] alphaDeltas,
int pix_y,
int pix_x_from,
int pix_x_to,
int rowNum) |
void |
fillAlphaMask(byte[] mask,
int x,
int y,
int width,
int height,
int offset,
int stride) |
private void |
fillAlphaMaskImpl(byte[] mask,
int x,
int y,
int width,
int height,
int offset,
int stride) |
void |
fillLCDAlphaMask(byte[] mask,
int x,
int y,
int width,
int height,
int offset,
int stride) |
private void |
fillLCDAlphaMaskImpl(byte[] mask,
int x,
int y,
int width,
int height,
int offset,
int stride) |
void |
fillRect(int x,
int y,
int w,
int h) |
private void |
fillRectImpl(int x,
int y,
int w,
int h) |
protected void |
finalize() |
private void |
initialize() |
private void |
inputImageCheck(int width,
int height,
int offset,
int stride,
int data_length) |
private void |
nativeFinalize()
Native finalizer.
|
void |
resetClip()
Resets the clip rectangle.
|
void |
setClip(int minX,
int minY,
int width,
int height)
Sets a clip rectangle for all primitives.
|
private void |
setClipImpl(int minX,
int minY,
int width,
int height) |
void |
setColor(int red,
int green,
int blue)
Sets the current paint color.
|
void |
setColor(int red,
int green,
int blue,
int alpha)
Sets the current paint color.
|
private void |
setColorImpl(int red,
int green,
int blue,
int alpha) |
void |
setCompositeRule(int compositeRule)
Sets current Compositing Rule (Porter-Duff) to be used in following rendering operation.
|
private void |
setCompositeRuleImpl(int compositeRule) |
void |
setLCDGammaCorrection(float gamma) |
private void |
setLCDGammaCorrectionImpl(float gamma) |
void |
setLinearGradient(int x0,
int y0,
int x1,
int y1,
GradientColorMap gradientColorMap,
Transform6 gradientTransform)
This method sets linear color-gradient data to be used as paint data in following rendering operation.
|
void |
setLinearGradient(int x0,
int y0,
int x1,
int y1,
int[] fractions,
int[] rgba,
int cycleMethod,
Transform6 gradientTransform)
This method sets linear color-gradient data to be used as paint data in following rendering operation.
|
void |
setLinearGradient(int x0,
int y0,
int color0,
int x1,
int y1,
int color1,
int cycleMethod)
Java2D-style linear gradient creation.
|
private void |
setLinearGradientImpl(int x0,
int y0,
int x1,
int y1,
int[] colors,
int cycleMethod,
Transform6 gradientTransform) |
void |
setRadialGradient(int cx,
int cy,
int fx,
int fy,
int radius,
GradientColorMap gradientColorMap,
Transform6 gradientTransform)
This method sets radial gradient paint data to be used in subsequent rendering.
|
void |
setRadialGradient(int cx,
int cy,
int fx,
int fy,
int radius,
int[] fractions,
int[] rgba,
int cycleMethod,
Transform6 gradientTransform)
This method sets radial gradient paint data to be used in subsequent rendering.
|
private void |
setRadialGradientImpl(int cx,
int cy,
int fx,
int fy,
int radius,
int[] colors,
int cycleMethod,
Transform6 gradientTransform) |
void |
setTexture(int imageType,
int[] data,
int width,
int height,
int stride,
Transform6 textureTransform,
boolean repeat,
boolean hasAlpha) |
private void |
setTextureImpl(int imageType,
int[] data,
int width,
int height,
int stride,
Transform6 textureTransform,
boolean repeat,
boolean hasAlpha) |
public static final int ARC_OPEN
public static final int ARC_CHORD
public static final int ARC_PIE
private long nativePtr
private AbstractSurface surface
public PiscesRenderer(AbstractSurface surface)
surface
- destination surfaceprivate void initialize()
public void setColor(int red, int green, int blue, int alpha)
red
- a value between 0 and 255.green
- a value between 0 and 255.blue
- a value between 0 and 255.alpha
- a value between 0 and 255.private void setColorImpl(int red, int green, int blue, int alpha)
private void checkColorRange(int v, java.lang.String componentName)
public void setColor(int red, int green, int blue)
setColor
also switches
painting mode - i.e. if we have specified gradient, or texture previously, this will be overcome with setColor
call. Also note, that 3-param setColor
sets fully opaque RGB color. To draw with semi-transparent color
use 4-param convenience method.red
- a value between 0 and 255.green
- a value between 0 and 255.blue
- a value between 0 and 255.public void setCompositeRule(int compositeRule)
compositeAlpha
is not changed.compositeRule
- one of RendererBase.COMPOSITE_*
constants.private void setCompositeRuleImpl(int compositeRule)
private void setLinearGradientImpl(int x0, int y0, int x1, int y1, int[] colors, int cycleMethod, Transform6 gradientTransform)
public void setLinearGradient(int x0, int y0, int x1, int y1, int[] fractions, int[] rgba, int cycleMethod, Transform6 gradientTransform)
fractions
.x0
- x-coordinate of the starting point of the linear gradienty0
- y-coordinate of the starting point of the linear gradientx1
- x-coordinate of the end point of the linear gradienty0
- y-coordinate of the end point of the linear gradientfractions
- this array defines normalized distances in which color (rgba[i]) starts to fade into next color (rgba[i+1]). This distance from the point [x0,y0] is given as fraction[i]*l, where l is length of line [[x0,y0], [x1,y1]]. fraction[i+1] says, in what distance fraction[i+1]*l from [x0,y0] should color already have firm value of rgba[i+1]. Values passed in fractions should be from interval <0.0, 1.0>, in 15.16 format.rgba
- colors which the linear gradient passes through. Generally should be fulfilled this formula rgba.length == fractions.length
cycleMethod
- some value from GradientColorMap.CYCLE_*
. @see GradienColorMapgradientTransform
- transformation applied to gradient paint data. This way we can either transform gradient fill together with filled object or leave it as if transformed gradient-filled object was a window through which we observe gradient area.GradienColorMap
public void setLinearGradient(int x0, int y0, int x1, int y1, GradientColorMap gradientColorMap, Transform6 gradientTransform)
fractions
.x0
- x-coordinate of the starting point of the linear gradienty0
- y-coordinate of the starting point of the linear gradientx1
- x-coordinate of the end point of the linear gradienty0
- y-coordinate of the end point of the linear gradientgradientColorMap
- The GradientColorMap calculated with @see calculateLinearGradient.gradientTransform
- transformation applied to gradient paint data. This way we can either transform gradient fill together with filled object or leave it as if transformed gradient-filled object was a window through which we observe gradient area.GradienColorMap
public void setLinearGradient(int x0, int y0, int color0, int x1, int y1, int color1, int cycleMethod)
x0
- x coordinate of point P0y0
- y coordinate of point P0color0
- color of P0x1
- x coordinate of point P1y1
- y coordinate of point P1color1
- color of P1cycleMethod
- type of cycling of the gradient (NONE, REFLECT, REPEAT)
As Pisces Gradient support was added to support features introduced in SVG, see e.g. http://www.w3.org/TR/SVG11/pservers.html for more information and examples.private void setRadialGradientImpl(int cx, int cy, int fx, int fy, int radius, int[] colors, int cycleMethod, Transform6 gradientTransform)
public void setRadialGradient(int cx, int cy, int fx, int fy, int radius, int[] fractions, int[] rgba, int cycleMethod, Transform6 gradientTransform)
cx
- cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.cy
- fx
- fx,fy defines focal point of the gradient. ie. 0% gradient stop is mapped to fx,fy point. If cx == fx and cy == fy, then gradient consists of homocentric circles. If these relations are not met, gradient field is deformed and eccentric ovals can be observed.fy
- radius
- @see cxfractions
- @see setLinearGradientrgba
- @see setLinearGradientcycleMethod
- @see setLinearGradientgradientTransform
- @see setLinearGradient
As Pisces Gradient support was added to support features introduced in SVG, see e.g. http://www.w3.org/TR/SVG11/pservers.html for more information and examples.public void setRadialGradient(int cx, int cy, int fx, int fy, int radius, GradientColorMap gradientColorMap, Transform6 gradientTransform)
cx
- cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.cy
- fx
- fx,fy defines focal point of the gradient. ie. 0% gradient stop is mapped to fx,fy point. If cx == fx and cy == fy, then gradient consists of homocentric circles. If these relations are not met, gradient field is deformed and eccentric ovals can be observed.fy
- radius
- @see cxgradientColorMap
- @see setLinearGradientgradientTransform
- @see setLinearGradient
As Pisces Gradient support was added to support features introduced in SVG, see e.g. http://www.w3.org/TR/SVG11/pservers.html for more information and examples.public void setTexture(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean hasAlpha)
private void setTextureImpl(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean hasAlpha)
public void setClip(int minX, int minY, int width, int height)
private void setClipImpl(int minX, int minY, int width, int height)
public void resetClip()
public void clearRect(int x, int y, int w, int h)
private void clearRectImpl(int x, int y, int w, int h)
public void fillRect(int x, int y, int w, int h)
private void fillRectImpl(int x, int y, int w, int h)
public void emitAndClearAlphaRow(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int rowNum)
private void emitAndClearAlphaRowImpl(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int rowNum)
public void fillAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)
private void fillAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)
public void setLCDGammaCorrection(float gamma)
private void setLCDGammaCorrectionImpl(float gamma)
public void fillLCDAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)
private void fillLCDAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)
public void drawImage(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, int bboxX, int bboxY, int bboxW, int bboxH, int lEdge, int rEdge, int tEdge, int bEdge, int txMin, int tyMin, int txMax, int tyMax, boolean hasAlpha)
private void drawImageImpl(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, int bboxX, int bboxY, int bboxW, int bboxH, int lEdge, int rEdge, int tEdge, int bEdge, int txMin, int tyMin, int txMax, int tyMax, boolean hasAlpha)
private void inputImageCheck(int width, int height, int offset, int stride, int data_length)
protected void finalize()
finalize
in class java.lang.Object
private void nativeFinalize()