Class AbstractGraphicsNode
java.lang.Object
org.apache.batik.gvt.AbstractGraphicsNode
- All Implemented Interfaces:
GraphicsNode
- Direct Known Subclasses:
CompositeGraphicsNode, MultiResGraphicsNode, ProxyGraphicsNode, RasterImageNode, ShapeNode, SVGPatternElementBridge.PatternGraphicsNode, TextNode
A partial implementation of the
GraphicsNode interface.- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Rectangle2DInternal Cache: node boundsprotected GraphicsNodeChangeEventprotected GraphicsNodeChangeEventprotected ClipRableThe clipping filter for this graphics node.protected CompositeThe compositing operation to be used when a graphics node is painted on top of another one.protected WeakReferenceThe GraphicsNodeRable for this node with all filtering applied(package private) static doubleprotected FilterThe filter of this graphics node.protected WeakReferenceThe GraphicsNodeRable for this node.protected RenderingHintsThe rendering hints that control the quality to use when rendering this graphics node.protected AffineTransformThe inverse transform for this node, i.e., from parent node to this node.protected booleanThis flag bit indicates whether or not this graphics node is visible.protected EventListenerListThe listeners list.protected MaskThe mask of this graphics node.protected CompositeGraphicsNodeThe parent of this graphics node.protected intIndicates how this graphics node reacts to events.protected RootGraphicsNodeThe root of the GVT tree.protected AffineTransformThe transform of this graphics node.protected WeakReferenceA Weak Reference to this.Fields inherited from interface GraphicsNode
ALL, FILL, IDENTITY, NONE, PAINTED, STROKE, VISIBLE, VISIBLE_FILL, VISIBLE_PAINTED, VISIBLE_STROKE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the specified Point2D is inside the boundary of this node, false otherwise.voidvoidvoidfireGraphicsNodeChangeStarted(GraphicsNodeChangeEvent changeStartedEvent) voidfireGraphicsNodeChangeStarted(GraphicsNode changeSrc) Returns the bounds of this node in user space.getClip()Returns the clipping filter of this node or null if any.Returns the composite of this node or null if any.getEnableBackgroundGraphicsNodeRable(boolean createIfNeeded) Returns the GraphicsNodeRable for this node.Returns the filter of this node or null if any.Returns the concatenated transform of this node.getGraphicsNodeRable(boolean createIfNeeded) Returns the GraphicsNodeRable for this node.Returns the inverse transform for this node.getMask()Returns the mask of this node or null if any.Returns the parent of this node or null if any.intReturns the type that describes how this graphics node reacts to events.Returns the rendering hints of this node or null if any.getRoot()Returns the root of the GVT tree or null if the node is not part of a GVT tree.Returns the transform of this node or null if any.Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).Returns the bounds of the area covered by this node, without taking any of its rendering attribute into accoun.Returns the bounds of this node's primitivePaint after applying the input transform (if any), concatenated with this node's transform (if any).Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.Returns a canonical WeakReference to this GraphicsNode.booleanReturns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.protected voidInvalidates the cached geometric bounds.protected booleanisAntialiasedClip(AffineTransform usr2dev, RenderingHints hints, Shape clip) Returns true if there is a clip and it should be antialiasedprotected booleanReturns true of an offscreen buffer is needed to render this node, false otherwise.booleanReturns true if this node is visible, false otherwise.Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.protected Rectangle2DnormalizeRectangle(Rectangle2D bounds) This method makes sure that neither the width nor height of the rectangle is zero.voidpaint(Graphics2D g2d) Paints this node.voidSets the clipping filter of this node.voidsetComposite(Composite newComposite) Sets the composite of this node.voidSets the filter of this node.voidSets the mask of this node.protected voidsetParent(CompositeGraphicsNode newParent) Sets the parent node of this graphics node.voidsetPointerEventType(int pointerEventType) Sets the type that describes how this graphics node reacts to events.voidsetRenderingHint(RenderingHints.Key key, Object value) Maps the specified key to the specified value in the rendering hints of this node.voidsetRenderingHints(RenderingHints newHints) Sets the rendering hints of this node.voidsetRenderingHints(Map hints) Copies all of the mappings from the specified Map to the rendering hints of this node.protected voidsetRoot(RootGraphicsNode newRoot) Sets the root node of this graphics node.voidsetTransform(AffineTransform newTransform) Sets the transform of this node.voidsetVisible(boolean isVisible) Sets if this node is visible or not depending on the specified value.private voidtraceFilter(Filter filter, String prefix) DEBUG: Trace filter chainMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GraphicsNode
getGeometryBounds, getOutline, getPrimitiveBounds, getSensitiveBounds, primitivePaint
-
Field Details
-
listeners
The listeners list. -
transform
The transform of this graphics node. -
inverseTransform
The inverse transform for this node, i.e., from parent node to this node. -
composite
The compositing operation to be used when a graphics node is painted on top of another one. -
isVisible
protected boolean isVisibleThis flag bit indicates whether or not this graphics node is visible. -
clip
The clipping filter for this graphics node. -
hints
The rendering hints that control the quality to use when rendering this graphics node. -
parent
The parent of this graphics node. -
root
The root of the GVT tree. -
mask
The mask of this graphics node. -
filter
The filter of this graphics node. -
pointerEventType
protected int pointerEventTypeIndicates how this graphics node reacts to events. -
graphicsNodeRable
The GraphicsNodeRable for this node. -
enableBackgroundGraphicsNodeRable
The GraphicsNodeRable for this node with all filtering applied -
weakRef
A Weak Reference to this. -
bounds
Internal Cache: node bounds -
changeStartedEvent
-
changeCompletedEvent
-
EPSILON
static double EPSILON
-
-
Constructor Details
-
AbstractGraphicsNode
protected AbstractGraphicsNode()Constructs a new graphics node.
-
-
Method Details
-
getWeakReference
Returns a canonical WeakReference to this GraphicsNode. This is suitable for use as a key value in a hash map- Specified by:
getWeakReferencein interfaceGraphicsNode
-
getPointerEventType
public int getPointerEventType()Returns the type that describes how this graphics node reacts to events.- Specified by:
getPointerEventTypein interfaceGraphicsNode- Returns:
- VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE
-
setPointerEventType
public void setPointerEventType(int pointerEventType) Sets the type that describes how this graphics node reacts to events.- Specified by:
setPointerEventTypein interfaceGraphicsNode- Parameters:
pointerEventType- VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE
-
setTransform
Sets the transform of this node.- Specified by:
setTransformin interfaceGraphicsNode- Parameters:
newTransform- the new transform of this node
-
getTransform
Returns the transform of this node or null if any.- Specified by:
getTransformin interfaceGraphicsNode
-
getInverseTransform
Returns the inverse transform for this node.- Specified by:
getInverseTransformin interfaceGraphicsNode
-
getGlobalTransform
Returns the concatenated transform of this node. That is, this node's transform preconcatenated with it's parent's transforms.- Specified by:
getGlobalTransformin interfaceGraphicsNode
-
setComposite
Sets the composite of this node.- Specified by:
setCompositein interfaceGraphicsNode- Parameters:
newComposite- the composite of this node
-
getComposite
Returns the composite of this node or null if any.- Specified by:
getCompositein interfaceGraphicsNode
-
setVisible
public void setVisible(boolean isVisible) Sets if this node is visible or not depending on the specified value.- Specified by:
setVisiblein interfaceGraphicsNode- Parameters:
isVisible- If true this node is visible
-
isVisible
public boolean isVisible()Returns true if this node is visible, false otherwise.- Specified by:
isVisiblein interfaceGraphicsNode
-
setClip
Description copied from interface:GraphicsNodeSets the clipping filter of this node.- Specified by:
setClipin interfaceGraphicsNode- Parameters:
newClipper- the new clipping filter of this node
-
getClip
Returns the clipping filter of this node or null if any.- Specified by:
getClipin interfaceGraphicsNode
-
setRenderingHint
Maps the specified key to the specified value in the rendering hints of this node.- Specified by:
setRenderingHintin interfaceGraphicsNode- Parameters:
key- the key of the hint to be setvalue- the value indicating preferences for the specified hint category.
-
setRenderingHints
Copies all of the mappings from the specified Map to the rendering hints of this node.- Specified by:
setRenderingHintsin interfaceGraphicsNode- Parameters:
hints- the rendering hints to be set
-
setRenderingHints
Sets the rendering hints of this node.- Specified by:
setRenderingHintsin interfaceGraphicsNode- Parameters:
newHints- the new rendering hints of this node
-
getRenderingHints
Returns the rendering hints of this node or null if any.- Specified by:
getRenderingHintsin interfaceGraphicsNode
-
setMask
Sets the mask of this node.- Specified by:
setMaskin interfaceGraphicsNode- Parameters:
newMask- the new mask of this node
-
getMask
Returns the mask of this node or null if any.- Specified by:
getMaskin interfaceGraphicsNode
-
setFilter
Sets the filter of this node.- Specified by:
setFilterin interfaceGraphicsNode- Parameters:
newFilter- the new filter of this node
-
getFilter
Returns the filter of this node or null if any.- Specified by:
getFilterin interfaceGraphicsNode
-
getGraphicsNodeRable
Returns the GraphicsNodeRable for this node. This GraphicsNodeRable is the Renderable (Filter) before any of the filter operations have been applied.- Specified by:
getGraphicsNodeRablein interfaceGraphicsNode
-
getEnableBackgroundGraphicsNodeRable
Returns the GraphicsNodeRable for this node. This GraphicsNodeRable is the Renderable (Filter) after all of the filter operations have been applied.- Specified by:
getEnableBackgroundGraphicsNodeRablein interfaceGraphicsNode
-
paint
Paints this node.- Specified by:
paintin interfaceGraphicsNode- Parameters:
g2d- the Graphics2D to use
-
traceFilter
-
isOffscreenBufferNeeded
protected boolean isOffscreenBufferNeeded()Returns true of an offscreen buffer is needed to render this node, false otherwise. -
isAntialiasedClip
Returns true if there is a clip and it should be antialiased -
fireGraphicsNodeChangeStarted
-
fireGraphicsNodeChangeStarted
public void fireGraphicsNodeChangeStarted() -
fireGraphicsNodeChangeStarted
-
fireGraphicsNodeChangeCompleted
public void fireGraphicsNodeChangeCompleted() -
getParent
Returns the parent of this node or null if any.- Specified by:
getParentin interfaceGraphicsNode
-
getRoot
Returns the root of the GVT tree or null if the node is not part of a GVT tree.- Specified by:
getRootin interfaceGraphicsNode
-
setRoot
Sets the root node of this graphics node.- Parameters:
newRoot- the new root node of this node
-
setParent
Sets the parent node of this graphics node.- Parameters:
newParent- the new parent node of this node
-
invalidateGeometryCache
protected void invalidateGeometryCache()Invalidates the cached geometric bounds. This method is called each time an attribute that affects the bounds of this node changed. -
getBounds
Returns the bounds of this node in user space. This includes primitive paint, filtering, clipping and masking.- Specified by:
getBoundsin interfaceGraphicsNode
-
getTransformedBounds
Returns the bounds of this node after applying the input transform (if any), concatenated with this node's transform (if any).- Specified by:
getTransformedBoundsin interfaceGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
getTransformedPrimitiveBounds
Returns the bounds of this node's primitivePaint after applying the input transform (if any), concatenated with this node's transform (if any).- Specified by:
getTransformedPrimitiveBoundsin interfaceGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
getTransformedGeometryBounds
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into accoun. That is, exclusive of any clipping, masking, filtering or stroking, for example. The returned value is transformed by the concatenation of the input transform and this node's transform.- Specified by:
getTransformedGeometryBoundsin interfaceGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
getTransformedSensitiveBounds
Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering. The returned value is transformed by the concatenation of the input transform and this node's transform.- Specified by:
getTransformedSensitiveBoundsin interfaceGraphicsNode- Parameters:
txf- the affine transform with which this node's transform should be concatenated. Should not be null.
-
contains
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.- Specified by:
containsin interfaceGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
intersects
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.- Specified by:
intersectsin interfaceGraphicsNode- Parameters:
r- the specified Rectangle2D in the user node space
-
nodeHitAt
Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.- Specified by:
nodeHitAtin interfaceGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
normalizeRectangle
This method makes sure that neither the width nor height of the rectangle is zero. But it tries to make them very small relatively speaking.
-