Top Description Inners Fields Constructors Methods
com.sun.pisces

public final Class PiscesRenderer

extends Object
Class Inheritance
Imports
com.sun.prism.impl.Disposer

PiscesRenderer class is basic public API accessing Pisces library capabilities. Pisces renderer is intended to draw directly into underlying data buffer of AbstractSurface. Basic implementation of AbstractSurface is e.g. GraphicsSurface. All coordinates are in 15.16 representation. ie. 13 will be passed as 13<<16. Simple use-case for PiscesRenderer together with GraphicsSurface would be e.g. -

GraphicsSurface surface = new GraphicsSurface();

PiscesRenderer pr = new PiscesRenderer(surface);


Now, when we have instances ready, we can render something from our paint(Graphics g) method


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();
}

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
private long
private AbstractSurface

Constructor Summary

AccessConstructor and Description
public
PiscesRenderer(AbstractSurface
destination surface
surface
)

Creates a renderer that will write into a given surface.

Method Summary

Modifier and TypeMethod and Description
private void
checkColorRange(int v, String componentName)

public void
clearRect(int x, int y, int w, int h)

Clears rectangle (x, y, x + w, y + h).

private native void
clearRectImpl(int x, int y, int w, int h)

private static native void
disposeNative(long nativeHandle)

public void
drawImage(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, 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 native void
drawImageImpl(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, 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)

public void
emitAndClearAlphaRow(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int rowNum)

public void
emitAndClearAlphaRow(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int pix_x_off, int rowNum)

private native void
emitAndClearAlphaRowImpl(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int pix_x_off, int rowNum)

public void
fillAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)

private native void
fillAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)

public void
fillLCDAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)

private native void
fillLCDAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)

public void
fillRect(int x, int y, int w, int h)

private native void
fillRectImpl(int x, int y, int w, int h)

private native void
private void
inputImageCheck(int width, int height, int offset, int stride, int data_length)

public void
resetClip()

Resets the clip rectangle.

public void
setClip(int minX, int minY, int width, int height)

Sets a clip rectangle for all primitives.

private native void
setClipImpl(int minX, int minY, int width, int height)

public void
setColor(int
a value between 0 and 255.
red
,
int
a value between 0 and 255.
green
,
int
a value between 0 and 255.
blue
,
int
a value between 0 and 255.
alpha
)

Sets the current paint color.

public void
setColor(int
a value between 0 and 255.
red
,
int
a value between 0 and 255.
green
,
int
a value between 0 and 255.
blue
)

Sets the current paint color.

private native void
setColorImpl(int red, int green, int blue, int alpha)

public void
setCompositeRule(int
one of RendererBase.COMPOSITE_* constants.
compositeRule
)

Sets current Compositing Rule (Porter-Duff) to be used in following rendering operation.

private native void
setCompositeRuleImpl(int compositeRule)

public void
setLCDGammaCorrection(float gamma)

private native void
public void
setLinearGradient(int
x-coordinate of the starting point of the linear gradient
x0
,
int
  • y-coordinate of the starting point of the linear gradient
  • y-coordinate of the end point of the linear gradient
y0
,
int
x-coordinate of the end point of the linear gradient
x1
,
int y1, int[]
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.
fractions
,
int[]
colors which the linear gradient passes through. Generally should be fulfilled this formula rgba.length == fractions.length
rgba
,
int
some value from GradientColorMap.CYCLE_*. @see GradienColorMap
cycleMethod
,
Transform6
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.
gradientTransform
)

This method sets linear color-gradient data to be used as paint data in following rendering operation.

public void
setLinearGradient(int
x-coordinate of the starting point of the linear gradient
x0
,
int
  • y-coordinate of the starting point of the linear gradient
  • y-coordinate of the end point of the linear gradient
y0
,
int
x-coordinate of the end point of the linear gradient
x1
,
int y1, GradientColorMap
The GradientColorMap calculated with @see calculateLinearGradient.
gradientColorMap
,
Transform6
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.
gradientTransform
)

This method sets linear color-gradient data to be used as paint data in following rendering operation.

public void
setLinearGradient(int
x coordinate of point P0
x0
,
int
y coordinate of point P0
y0
,
int
color of P0
color0
,
int
x coordinate of point P1
x1
,
int
y coordinate of point P1
y1
,
int
color of P1
color1
,
int
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.
cycleMethod
)

Java2D-style linear gradient creation.

private native void
setLinearGradientImpl(int x0, int y0, int x1, int y1, int[] colors, int cycleMethod, Transform6 gradientTransform)

public void
setRadialGradient(int
cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.
cx
,
int cy, int
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.
fx
,
int fy, int
@see cx
radius
,
int[]
@see setLinearGradient
fractions
,
int[]
@see setLinearGradient
rgba
,
int
@see setLinearGradient
cycleMethod
,
Transform6
@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.
gradientTransform
)

This method sets radial gradient paint data to be used in subsequent rendering.

public void
setRadialGradient(int
cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.
cx
,
int cy, int
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.
fx
,
int fy, int
@see cx
radius
,
GradientColorMap
@see setLinearGradient
gradientColorMap
,
Transform6
@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.
gradientTransform
)

This method sets radial gradient paint data to be used in subsequent rendering.

private native void
setRadialGradientImpl(int cx, int cy, int fx, int fy, int radius, int[] colors, int cycleMethod, Transform6 gradientTransform)

public void
setTexture(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, boolean hasAlpha)

private native void
setTextureImpl(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, boolean hasAlpha)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ARC_CHORDback to summary
public static final int ARC_CHORD
ARC_OPENback to summary
public static final int ARC_OPEN
ARC_PIEback to summary
public static final int ARC_PIE
nativePtrback to summary
private long nativePtr
surfaceback to summary
private AbstractSurface surface

Constructor Detail

PiscesRendererback to summary
public PiscesRenderer(AbstractSurface surface)

Creates a renderer that will write into a given surface.

Parameters
surface:AbstractSurface

destination surface

Method Detail

checkColorRangeback to summary
private void checkColorRange(int v, String componentName)
clearRectback to summary
public void clearRect(int x, int y, int w, int h)

Clears rectangle (x, y, x + w, y + h). Clear sets all pixels to transparent black (0x00000000 ARGB).

clearRectImplback to summary
private native void clearRectImpl(int x, int y, int w, int h)
disposeNativeback to summary
private static native void disposeNative(long nativeHandle)
drawImageback to summary
public void drawImage(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, 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)
drawImageImplback to summary
private native void drawImageImpl(int imageType, int imageMode, int[] data, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, 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)
emitAndClearAlphaRowback to summary
public void emitAndClearAlphaRow(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int rowNum)
emitAndClearAlphaRowback to summary
public void emitAndClearAlphaRow(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int pix_x_off, int rowNum)
emitAndClearAlphaRowImplback to summary
private native void emitAndClearAlphaRowImpl(byte[] alphaMap, int[] alphaDeltas, int pix_y, int pix_x_from, int pix_x_to, int pix_x_off, int rowNum)
fillAlphaMaskback to summary
public void fillAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)
fillAlphaMaskImplback to summary
private native void fillAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)
fillLCDAlphaMaskback to summary
public void fillLCDAlphaMask(byte[] mask, int x, int y, int width, int height, int offset, int stride)
fillLCDAlphaMaskImplback to summary
private native void fillLCDAlphaMaskImpl(byte[] mask, int x, int y, int width, int height, int offset, int stride)
fillRectback to summary
public void fillRect(int x, int y, int w, int h)
fillRectImplback to summary
private native void fillRectImpl(int x, int y, int w, int h)
initializeback to summary
private native void initialize()
inputImageCheckback to summary
private void inputImageCheck(int width, int height, int offset, int stride, int data_length)
resetClipback to summary
public void resetClip()

Resets the clip rectangle. Each primitive will be clipped only to the destination image bounds.

setClipback to summary
public void setClip(int minX, int minY, int width, int height)

Sets a clip rectangle for all primitives. Each primitive will be clipped to the intersection of this rectangle and the destination image bounds.

setClipImplback to summary
private native void setClipImpl(int minX, int minY, int width, int height)
setColorback to summary
public void setColor(int red, int green, int blue, int alpha)

Sets the current paint color.

Parameters
red:int

a value between 0 and 255.

green:int

a value between 0 and 255.

blue:int

a value between 0 and 255.

alpha:int

a value between 0 and 255.

setColorback to summary
public void setColor(int red, int green, int blue)

Sets the current paint color. An alpha value of 255 is used. Calling 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.

Parameters
red:int

a value between 0 and 255.

green:int

a value between 0 and 255.

blue:int

a value between 0 and 255.

setColorImplback to summary
private native void setColorImpl(int red, int green, int blue, int alpha)
setCompositeRuleback to summary
public void setCompositeRule(int compositeRule)

Sets current Compositing Rule (Porter-Duff) to be used in following rendering operation. Note that compositeAlpha is not changed.

Parameters
compositeRule:int

one of RendererBase.COMPOSITE_* constants.

setCompositeRuleImplback to summary
private native void setCompositeRuleImpl(int compositeRule)
setLCDGammaCorrectionback to summary
public void setLCDGammaCorrection(float gamma)
setLCDGammaCorrectionImplback to summary
private native void setLCDGammaCorrectionImpl(float gamma)
setLinearGradientback to summary
public 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. Imagine, we want to draw simple gradient from blue to red color. Each pixel on line perpendicular to line L = [[x0,y0], [x1, y1]] will have same constant color. Pixels on perpendicular-line which passes [x0, y0] will be blue. Those on line passing [x1, y1] will be red. Colors on lines in between will be interpolated by fractions.

Parameters
x0:int

x-coordinate of the starting point of the linear gradient

y0:int

  • y-coordinate of the starting point of the linear gradient
  • y-coordinate of the end point of the linear gradient
x1:int

x-coordinate of the end point of the linear gradient

fractions:int[]

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:int[]

colors which the linear gradient passes through. Generally should be fulfilled this formula rgba.length == fractions.length

cycleMethod:int

some value from GradientColorMap.CYCLE_*. @see GradienColorMap

gradientTransform:Transform6

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.

See Also
GradienColorMap
setLinearGradientback to summary
public 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. Imagine, we want to draw simple gradient from blue to red color. Each pixel on line perpendicular to line L = [[x0,y0], [x1, y1]] will have same constant color. Pixels on perpendicular-line which passes [x0, y0] will be blue. Those on line passing [x1, y1] will be red. Colors on lines in between will be interpolated by fractions.

Parameters
x0:int

x-coordinate of the starting point of the linear gradient

y0:int

  • y-coordinate of the starting point of the linear gradient
  • y-coordinate of the end point of the linear gradient
x1:int

x-coordinate of the end point of the linear gradient

gradientColorMap:GradientColorMap

The GradientColorMap calculated with @see calculateLinearGradient.

gradientTransform:Transform6

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.

See Also
GradienColorMap
setLinearGradientback to summary
public void setLinearGradient(int x0, int y0, int color0, int x1, int y1, int color1, int cycleMethod)

Java2D-style linear gradient creation. The color changes proportionally between point P0 (color0) nad P1 (color1). Cycle method constants are defined in GradientColorMap (CYCLE_*). This is convenience method only. Same as if setLinearGradient method with 8 parameters was called with fractions = {0x0000, 0x10000}, rgba = {color0, color1} and identity transformation matrix.

Parameters
x0:int

x coordinate of point P0

y0:int

y coordinate of point P0

color0:int

color of P0

x1:int

x coordinate of point P1

y1:int

y coordinate of point P1

color1:int

color of P1

cycleMethod:int

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.

setLinearGradientImplback to summary
private native void setLinearGradientImpl(int x0, int y0, int x1, int y1, int[] colors, int cycleMethod, Transform6 gradientTransform)
setRadialGradientback to summary
public 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. Radial gradient data generated will be used to fill the touched pixels of the path we draw.

Parameters
cx:int

cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.

fx:int

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.

radius:int

@see cx

fractions:int[]

@see setLinearGradient

rgba:int[]

@see setLinearGradient

cycleMethod:int

@see setLinearGradient

gradientTransform:Transform6

@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.

setRadialGradientback to summary
public 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. Radial gradient data generated will be used to fill the touched pixels of the path we draw.

Parameters
cx:int

cx, cy and radius triplet defines the largest circle for the gradient. 100% gradient stop is mapped to perimeter of this circle.

fx:int

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.

radius:int

@see cx

gradientColorMap:GradientColorMap

@see setLinearGradient

gradientTransform:Transform6

@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.

setRadialGradientImplback to summary
private native void setRadialGradientImpl(int cx, int cy, int fx, int fy, int radius, int[] colors, int cycleMethod, Transform6 gradientTransform)
setTextureback to summary
public void setTexture(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, boolean hasAlpha)
setTextureImplback to summary
private native void setTextureImpl(int imageType, int[] data, int width, int height, int stride, Transform6 textureTransform, boolean repeat, boolean linearFiltering, boolean hasAlpha)
com.sun.pisces back to summary

private Class PiscesRenderer.PiscesRendererDisposerRecord

extends Object
implements Record
Class Inheritance
All Implemented Interfaces
com.sun.prism.impl.Disposer.Record

Field Summary

Modifier and TypeField and Description
private long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nativeHandleback to summary
private long nativeHandle

Constructor Detail

PiscesRendererDisposerRecordback to summary
pack-priv PiscesRendererDisposerRecord(long nh)

Method Detail

disposeback to summary
public void dispose()

Implements com.sun.prism.impl.Disposer.Record.dispose.

Annotations
@Override