PiscesShapeRendererpublic class PiscesShapeRenderer extends Object implements com.sun.me.gci.renderer.GCIShapeRenderer
Fields Summary |
---|
protected PiscesRenderer | piscesRenderer | static final float | FIXED_1_0 | com.sun.me.gci.renderer.GCIRenderContext | context | int[] | clip | private static final int[] | GCI_TO_PISCES_COMPOSITE |
Constructors Summary |
---|
protected PiscesShapeRenderer(com.sun.me.gci.surface.GCIDrawingSurface surface)Creates a new instance of PiscesShapeRenderer
piscesRenderer = new PiscesRenderer(new PiscesGCISurface(surface));
this.clip[0] = 0;
this.clip[1] = 0;
this.clip[2] = surface.getWidth();
this.clip[3] = surface.getHeight();
|
Methods Summary |
---|
void | acquireSurface()
((PiscesGCISurface)piscesRenderer.surface).acquireSurface();
| public void | attributesModified(int attribute)Notifies the renderer that some of the attribute[s] in the
render context has been modified.
if ( (attribute & GCIRenderContext.ATTRIBUTE_CLIP) != 0 ){
this.clipModified();
}
if ( (attribute & GCIRenderContext.ATTRIBUTE_PAINT) != 0 ){
this.paintModified();
}
if ( (attribute & GCIRenderContext.ATTRIBUTE_COMPOSITE) != 0 ){
this.compositeModified();
}
if ( (attribute & GCIRenderContext.ATTRIBUTE_STROKE) != 0 ){
this.strokeModified();
}
| public void | clipModified()
context.getClip(this.clip);
piscesRenderer.setClip(this.clip[0], this.clip[1],this.clip[2], this.clip[3]);
| public void | compositeModified()
piscesRenderer.setComposite(
GCI_TO_PISCES_COMPOSITE[this.context.getCompositeRule()],
this.context.getCompositeAlpha());
| public void | contextCreated(com.sun.me.gci.renderer.GCIRenderContext context)Notifies the renderer that a render context is created
for this renderer. The context must be initialized with all the
attributes when this method is invoked.
GCIDrawingSurface surface = context.getDrawingSurface();
this.context = context;
clipModified();
paintModified();
strokeModified();
compositeModified();
transformModified();
| public void | contextDisposed()Notifies the renderer that the render context is disposed. The
renderer implementation can free any resources allocated for
servicing the context.
releaseSurface();
this.context = null;
| public com.sun.me.gci.renderer.GCIRenderer | create()
return new PiscesShapeRenderer(this.context.getDrawingSurface());
| public void | drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.drawArc(x<<16,y<<16,width<<16,height<<16,
startAngle<<16,arcAngle<<16,
PiscesRenderer.ARC_OPEN );
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | drawLine(int x0, int y0, int x1, int y1)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.drawLine(x0<<16, y0<<16, x1<<16, y1<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | drawOval(int x, int y, int w, int h)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.drawOval(x<<16, y<<16, w<<16, h<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | drawPolyline(int[] xPoints, int[] yPoints, int nPoints, boolean close)
fillOrDrawPolyline(xPoints, yPoints, nPoints, close,
true /* stroke the polyline */
);
| public void | drawRect(int x, int y, int w, int h)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.drawRect(x<<16, y<<16, w<<16, h<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | drawRoundRect(int x, int y, int w, int h, int aw, int ah)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.drawRoundRect(x<<16, y<<16, w<<16, h<<16, aw<<16, ah<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.fillArc(x<<16,y<<16,width<<16,height<<16,
startAngle<<16,arcAngle<<16,
PiscesRenderer.ARC_PIE);
this.context.getDrawingSurface().renderingEnd(this.clip);
| private void | fillOrDrawPolyline(int[] xPoints, int[] yPoints, int nPoints, boolean close, boolean stroke)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.beginRendering(RendererBase.WIND_NON_ZERO);
// path begin
if ( !stroke )
piscesRenderer.setFill();
piscesRenderer.moveTo((xPoints[0]<<16), (yPoints[0]<<16));
for (int i = 1; i < nPoints; i++) {
piscesRenderer.lineTo((xPoints[i]<<16), (yPoints[i]<<16));
}
if (close) {
piscesRenderer.close();
}
piscesRenderer.end(); // path end
piscesRenderer.endRendering();
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | fillOval(int x, int y, int w, int h)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.fillOval(x<<16, y<<16, w<<16, h<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
fillOrDrawPolyline(xPoints, yPoints, nPoints,
true, /* close the path */
false /* fill the polyline */
);
| public void | fillRect(int x, int y, int w, int h)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.fillRect(x<<16, y<<16, w<<16, h<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | fillRect2(int x, int y, int w, int h)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.fillRect(x, y, w, h);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public void | fillRoundRect(int x, int y, int w, int h, int aw, int ah)
this.context.getDrawingSurface().renderingBegin();
piscesRenderer.fillRoundRect(x<<16, y<<16, w<<16, h<<16, aw<<16, ah<<16);
this.context.getDrawingSurface().renderingEnd(this.clip);
| public final void | fontModified()
| protected static int | getByteShiftForPixelArrayCount(int arrayType)
int denom = 1;
switch (arrayType){
case GCISurfaceInfo.TYPE_JAVA_ARRAY_BYTE:
denom = 0;
break;
case GCISurfaceInfo.TYPE_JAVA_ARRAY_SHORT:
denom = 1;
break;
default:
denom = 2;
break;
}
return denom;
| public void | hintsModified()
piscesRenderer.setAntialiasing(this.context.isAntiAliasingOn());
| public static com.sun.me.gci.renderer.GCIAdvancedShapeRenderer | newAdvancedInstance(com.sun.me.gci.surface.GCIDrawingSurface surface)Factory method as mandated by GCI.
if ( surface.isSurfaceInfoDynamic() ) {
return new PiscesAdvancedShapeRenderer.DynamicSurface(surface);
} else {
return new PiscesAdvancedShapeRenderer(surface);
}
| public static com.sun.me.gci.renderer.GCIShapeRenderer | newInstance(com.sun.me.gci.surface.GCIDrawingSurface surface, boolean lcduiGraphics, boolean useContextTransform)Factory method as mandated by GCI.
if ( surface.isSurfaceInfoDynamic() ) {
return new PiscesShapeRenderer.DynamicSurface(surface);
} else {
return new PiscesShapeRenderer(surface);
}
| public void | paintModified()
int paintMode = context.getPaintMode();
if ( paintMode == GCIRenderContext.PAINT_MODE_COLOR ){
int color = context.getPaintColor();
piscesRenderer.setColor((color>>16) & 0xFF, // red
(color>>8) & 0xFF, // green
(color) & 0xFF, // blue
(color>>24) & 0xFF ); // alpha
}
else
if ( paintMode == GCIRenderContext.PAINT_MODE_XOR ){
}
else
if ( paintMode == GCIRenderContext.PAINT_MODE_LINEAR_GRADIENT ){
// for agui
}
| void | releaseSurface()
((PiscesGCISurface)piscesRenderer.surface).releaseSurface();
| public void | strokeModified()
float[] floatDash = this.context.getDashPattern();
int dashPhase = 0;
int[] fpDash = null;
if ( floatDash != null ) {
fpDash = new int[floatDash.length];
for ( int i = 0 ; i < fpDash.length ; i++ ){
fpDash[i] = (int)(floatDash[i]*FIXED_1_0);
}
dashPhase = (int)(this.context.getDashPhase()*FIXED_1_0);
}
piscesRenderer.setStroke((int)(this.context.getLineWidth()*FIXED_1_0),
this.context.getCapStyle(),
this.context.getJoinStyle(),
(int)(this.context.getMiterLimit()*FIXED_1_0),
fpDash,
dashPhase);
| public void | transformModified()
|
|