Methods Summary |
---|
ElementNodeProxy | buildProxy()
return new AbstractShapeNodeProxy(this);
|
protected void | computeRenderingTile(com.sun.perseus.j2d.Tile tile, com.sun.perseus.j2d.Transform t, com.sun.perseus.j2d.GraphicsProperties gp)Computes the rendering tile for the given set of GraphicsProperties.
if (gp.getStroke() == null) {
// No stroking on the shape, we can use the geometrical bounding
// box.
tile.snapBox(addNodeBBox(null, t));
} else {
// Need to account for stroking, with a more costly operation to
// compute the stroked bounds.
Object strokedPath = getStrokedPath(gp);
PathSupport.computeStrokedPathTile(tile, strokedPath, t);
}
|
public abstract boolean | contains(float x, float y, int fillRule)
|
public abstract void | drawShape(com.sun.perseus.j2d.RenderGraphics rg)
|
public abstract void | fillShape(com.sun.perseus.j2d.RenderGraphics rg)
|
abstract java.lang.Object | getStrokedPath(com.sun.perseus.j2d.GraphicsProperties gp)Returns the stroked shape, using the given stroke properties.
|
protected boolean | isHitVP(float[] pt)Returns true if this node is hit by the input point. The input point
is in viewport space.
For an AbstractShapeNode this method returns true if:
- the node is visible and
- the node's fill is not NONE and the associated shape contains the
input point, or
- the node's stroke is not NONE and the associated stroked shape
contains the input point.
This implements the equivalent of the visiblePainted value for the
pointerEvents attribute. That attribute is not part of SVG Tiny,
but the default behavior in SVG Tiny is that of visiblePainted.
// Node has to be visible to be a hit target
if (!getVisibility()
||
(fill == null && stroke == null)) {
return false;
}
getInverseTransformState().transformPoint(pt, ownerDocument.upt);
pt = ownerDocument.upt;
// If the node is filled, see if the shape is hit
if (fill != null) {
if (contains(pt[0], pt[1], getFillRule())) {
return true;
}
}
// Test detection on the edge if the stroke color
// is set.
if (stroke != null) {
if (strokedContains(pt[0], pt[1], this)) {
return true;
}
}
return false;
|
protected boolean | isProxyHitVP(float[] pt, AbstractRenderingNodeProxy proxy)Returns true if this proxy node is hit by the input point. The input
point is in viewport space.
// Node has to be visible to be a hit target
if (!proxy.getVisibility()
||
(proxy.fill == null && proxy.stroke == null)) {
return false;
}
proxy.getInverseTransformState().transformPoint(pt, ownerDocument.upt);
pt = ownerDocument.upt;
// If the node is filled, see if the shape is hit
if (proxy.fill != null) {
if (contains(pt[0], pt[1], proxy.getFillRule())) {
return true;
}
}
// Test detection on the edge if the stroke color
// is set.
if (((AbstractShapeNodeProxy) proxy).stroke != null) {
if (strokedContains(pt[0], pt[1], proxy)) {
return true;
}
}
return false;
|
protected void | paintRendered(com.sun.perseus.j2d.RenderGraphics rg, com.sun.perseus.j2d.GraphicsProperties gp, com.sun.perseus.j2d.PaintTarget pt, com.sun.perseus.j2d.Transform tx)Paints this node into the input RenderGraphics, assuming the node
is rendered.
if (!gp.getVisibility()) {
return;
}
rg.setPaintTarget(pt);
rg.setPaintTransform(tx);
rg.setTransform(tx);
// Fill the shape. Only apply the fill property
if (gp.getFill() != null) {
rg.setFillRule(gp.getFillRule());
rg.setFill(gp.getFill());
rg.setFillOpacity(gp.getFillOpacity());
fillShape(rg);
}
// Stroke the shape. Only apply the stroke properties
if (gp.getStroke() != null) {
rg.setStroke(gp.getStroke());
rg.setStrokeOpacity(gp.getStrokeOpacity());
rg.setStrokeWidth(gp.getStrokeWidth());
rg.setStrokeLineCap(gp.getStrokeLineCap());
rg.setStrokeLineJoin(gp.getStrokeLineJoin());
rg.setStrokeDashArray(gp.getStrokeDashArray());
rg.setStrokeMiterLimit(gp.getStrokeMiterLimit());
rg.setStrokeDashOffset(gp.getStrokeDashOffset());
drawShape(rg);
}
|
void | setComputedFill(com.sun.perseus.j2d.PaintServer newFill)
this.fill = newFill;
renderingDirty();
|
void | setComputedFillOpacity(float newFillOpacity)
super.setComputedFillOpacity(newFillOpacity);
if (fill != null) {
renderingDirty();
}
|
void | setComputedStroke(com.sun.perseus.j2d.PaintServer newStroke)
this.stroke = newStroke;
renderingDirty();
|
void | setComputedStrokeDashArray(float[] newStrokeDashArray)
strokeDashArray = newStrokeDashArray;
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeDashOffset(float newStrokeDashOffset)
strokeDashOffset = newStrokeDashOffset;
if (stroke != null && strokeDashArray != null) {
renderingDirty();
}
|
void | setComputedStrokeLineCap(int newStrokeLineCap)
super.setComputedStrokeLineCap(newStrokeLineCap);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeLineJoin(int newStrokeLineJoin)
super.setComputedStrokeLineJoin(newStrokeLineJoin);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeMiterLimit(float newStrokeMiterLimit)
strokeMiterLimit = newStrokeMiterLimit;
if (stroke != null && getStrokeLineJoin() == JOIN_MITER) {
renderingDirty();
}
|
void | setComputedStrokeOpacity(float newStrokeOpacity)
super.setComputedStrokeOpacity(newStrokeOpacity);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeWidth(float newStrokeWidth)
strokeWidth = newStrokeWidth;
// Only dirty rendering if the object is actually stroked.
if (stroke != null) {
renderingDirty();
}
|
public final boolean | strokedContains(float x, float y, com.sun.perseus.j2d.GraphicsProperties gp)
Object strokedPath = getStrokedPath(this);
return PathSupport.isStrokedPathHit(strokedPath, gp.getFillRule(), x,
y);
|