PiscesRendererpublic final class PiscesRenderer extends PathSink implements NativeFinalization
Fields Summary |
---|
private static boolean | messageShown | public static final int | ARC_OPEN | public static final int | ARC_CHORD | public static final int | ARC_PIE | long | nativePtr | final AbstractSurface | surface | private final NativeFinalizer | finalizer | int[] | gcm_fractions | int[] | gcm_rgba | int | gcm_cycleMethod | GradientColorMap | gradientColorMap |
Constructors Summary |
---|
public PiscesRenderer(Object data, int width, int height, int offset, int scanlineStride, int pixelStride, int type)Creates a renderer that will write into a given pixel array.
this((AbstractSurface)data);
| public PiscesRenderer(AbstractSurface surface)
if (!messageShown) {
System.out.println("Using Pisces Renderer (native version)");
}
this.finalizer = NativeFinalizer.createInstance(this);
this.surface = surface;
initialize();
messageShown = true;
|
Methods Summary |
---|
private boolean | arraysDiffer(int[] a, int[] b)
if (a == null) {
return true;
}
int len = b.length;
if (a.length != len) {
return true;
}
for (int i = 0; i < len; i++) {
if (a[i] != b[i]) {
return true;
}
}
return false;
| public native void | beginRendering(int windingRule)
| public native void | beginRendering(int minX, int minY, int width, int height, int windingRule)Begins the rendering of path data. The supplied clipping
bounds are intersected against the current clip rectangle and
the destination image bounds; only pixels within the resulting
rectangle may be written to.
| public native void | clearRect(int x, int y, int w, int h)
| private int[] | cloneArray(int[] src)
int len = src.length;
int[] dst = new int[len];
System.arraycopy(src, 0, dst, 0, len);
return dst;
| public native void | close()
| public native void | cubicTo(int x1, int y1, int x2, int y2, int x3, int y3)
| public native void | drawArc(int x, int y, int width, int height, int startAngle, int arcAngle, int arcType)
| public native void | drawLine(int x0, int y0, int x1, int y1)
| public native void | drawOval(int x, int y, int w, int h)
| public native void | drawRect(int x, int y, int w, int h)
| public native void | drawRoundRect(int x, int y, int w, int h, int aw, int ah)
| public native void | end()
| public native void | endRendering()Completes the rendering of path data. Destination pixels will
be written at this time.
| public native void | fillArc(int x, int y, int width, int height, int startAngle, int arcAngle, int arcType)
| public native void | fillOval(int x, int y, int w, int h)
| public native void | fillRect(int x, int y, int w, int h)
| public native void | fillRoundRect(int x, int y, int w, int h, int aw, int ah)
| public native boolean | getAntialiasing()
| public native void | getBoundingBox(int[] bbox)Returns a bounding box containing all pixels drawn during the
rendering of the most recent primitive
(beginRendering/endRendering pair). The bounding box is
returned in the form (x, y, width, height).
| public PathSink | getFiller()
notImplemented();
return null;
| public void | getImageData()
notImplemented();
| public PathSink | getStroker()
notImplemented();
return null;
| public PathSink | getTextFiller()
notImplemented();
return null;
| public Transform6 | getTransform()
Transform6 transform = new Transform6();
getTransformImpl(transform);
return transform;
| private native void | getTransformImpl(Transform6 transform)
| private native void | initialize()
| public native void | lineJoin()
| public native void | lineTo(int x1, int y1)
| public native void | moveTo(int x0, int y0)
| public native void | nativeFinalize()
| private void | notImplemented()
String strValue;
int strokeXBias = 0; // default x bias
int strokeYBias = 0; // default y bias
strValue = Configuration.getProperty("pisces.stroke.xbias");
if (strValue != null) {
try {
strokeXBias = Integer.parseInt(strValue);
} catch (NumberFormatException e) {
}
}
strValue = Configuration.getProperty("pisces.stroke.ybias");
if (strValue != null) {
try {
strokeYBias = Integer.parseInt(strValue);
} catch (NumberFormatException e) {
}
}
staticInitialize(strokeXBias, strokeYBias);
new RuntimeException().printStackTrace();
System.out.println("not implemented");
// throw new RuntimeException("PiscesRendererNativeImpl: " +
// "Not implemented!");
| public native void | quadTo(int x1, int y1, int x2, int y2)
| public native void | resetClip()Resets the clip rectangle. Each primitive will be clipped only
to the destination image bounds.
| public native void | setAntialiasing(boolean antialiasingOn)
| public native 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.
| public native void | setColor(int red, int green, int blue, int alpha)Sets the current paint color.
| public void | setColor(int red, int green, int blue)Sets the current paint color. An alpha value of 255 is used.
setColor(red, green, blue, 255);
| public native void | setComposite(int compositeRule, float alpha)
| public native void | setCompositeRule(int compositeRule)
| public native void | setFill()
| private void | setGradientColorMap(int[] fractions, int[] rgba, int cycleMethod)
if (fractions.length != rgba.length) {
throw new IllegalArgumentException("fractions.length != rgba.length!");
}
if (gradientColorMap == null ||
gcm_cycleMethod != cycleMethod ||
arraysDiffer(gcm_fractions, fractions) ||
arraysDiffer(gcm_rgba, rgba)) {
this.gradientColorMap =
new GradientColorMap(fractions, rgba, cycleMethod);
this.gcm_cycleMethod = cycleMethod;
this.gcm_fractions = cloneArray(fractions);
this.gcm_rgba = cloneArray(rgba);
}
| public void | setLinearGradient(int x0, int y0, int x1, int y1, int[] fractions, int[] rgba, int cycleMethod, Transform6 gradientTransform)
setGradientColorMap(fractions, rgba, cycleMethod);
setLinearGradientImpl(x0, y0, x1, y1,
gradientColorMap.colors, cycleMethod,
gradientTransform);
| 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_*).
int[] fractions = {0x0000, 0x10000};
int[] rgba = {color0, color1};
Transform6 ident = new Transform6(1 << 16, 0, 0, 1 << 16, 0, 0);
setLinearGradient(x0, y0, x1, y1, fractions, rgba, cycleMethod, ident);
| private native void | setLinearGradientImpl(int x0, int y0, int x1, int y1, int[] colors, int cycleMethod, Transform6 gradientTransform)
| public native void | setPathData(float[] data, byte[] commands, int nCommands)
| public void | setRadialGradient(int cx, int cy, int fx, int fy, int radius, int[] fractions, int[] rgba, int cycleMethod, Transform6 gradientTransform)
setGradientColorMap(fractions, rgba, cycleMethod);
setRadialGradientImpl(cx, cy, fx, fy, radius,
gradientColorMap.colors, cycleMethod,
gradientTransform);
| private native void | setRadialGradientImpl(int cx, int cy, int fx, int fy, int radius, int[] colors, int cycleMethod, Transform6 gradientTransform)
| public native void | setStroke(int lineWidth, int capStyle, int joinStyle, int miterLimit, int[] dashArray, int dashPhase)Sets the current stroke parameters.
| public native void | setStroke()
| public void | setTextFill()
notImplemented();
| public void | setTexture(int imageType, java.lang.Object imageData, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat)
if (imageData instanceof int[]) {
setTextureImpl(imageType, (int[])imageData, width, height, offset,
stride, textureTransform, repeat);
}
| private native void | setTextureImpl(int imageType, int[] imageData, int width, int height, int offset, int stride, Transform6 textureTransform, boolean repeat)
| public void | setTextureOpacity(float opacity)
notImplemented();
| public native void | setTransform(Transform6 transform)Sets the current transform from user to window coordinates.
| private static native void | staticInitialize(int strokeXBias, int strokeYBias)
|
|