Class MacRenderer
java.lang.Object
org.apache.batik.gvt.renderer.MacRenderer
- All Implemented Interfaces:
ImageRenderer, Renderer
Simple implementation of the Renderer that supports dynamic updates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferedImageprotected RectListManagerprotected static RenderingHintsstatic intprotected booleanprotected intprotected intprotected RenderingHintsprotected GraphicsNodestatic Colorprotected AffineTransformprotected BufferedImage -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new dynamic renderer with the specified buffer image.MacRenderer(RenderingHints rh, AffineTransform at) -
Method Summary
Modifier and TypeMethodDescriptionvoidSets up and clears the current offscreen buffer.voiddispose()release resources associated with this object.voidflush()Flush any cached image data (preliminary interface).voidFlush a rectangle of cached image data (preliminary interface).voidflush(Collection areas) Flush a list of rectangles of cached image data.Returns the current offscreen image.Returns the rendering hints this ImageRenderer is using for its rendering.Returns the transform from the current user space (as defined by the top node of the GVT tree) to the device space.getTree()Returns the GVT tree associated with this rendererbooleanReturns true if the Renderer is currently doubleBuffering is rendering requests.voidRepaints the associated GVT tree at least underarea.voidrepaint(RectListManager devRLM) Repaints the associated GVT tree under the list ofareas.voidsetDoubleBuffered(boolean isDoubleBuffered) Turns on/off double buffering in renderer.voidSets the specified rendering hints to be used for future renderings.voidsetTransform(AffineTransform usr2dev) Sets the transform from the current user space (as defined by the top node of the GVT tree, to the associated device space.voidsetTree(GraphicsNode treeRoot) This associates the given GVT Tree with this renderer.voidupdateOffScreen(int width, int height) Update the size of the image to be returned by getOffScreen.protected void
-
Field Details
-
renderingHints
-
usr2dev
-
rootGN
-
offScreenWidth
protected int offScreenWidth -
offScreenHeight
protected int offScreenHeight -
isDoubleBuffered
protected boolean isDoubleBuffered -
currImg
-
workImg
-
damagedAreas
-
IMAGE_TYPE
public static int IMAGE_TYPE -
TRANSPARENT_WHITE
-
defaultRenderingHints
-
-
Constructor Details
-
MacRenderer
public MacRenderer()Constructs a new dynamic renderer with the specified buffer image. -
MacRenderer
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:ImageRendererrelease resources associated with this object.- Specified by:
disposein interfaceImageRenderer- Specified by:
disposein interfaceRenderer
-
setTree
This associates the given GVT Tree with this renderer. Any previous tree association is forgotten. Not certain if this should be just GraphicsNode, or CanvasGraphicsNode. -
getTree
Returns the GVT tree associated with this renderer -
setTransform
Sets the transform from the current user space (as defined by the top node of the GVT tree, to the associated device space.- Specified by:
setTransformin interfaceImageRenderer- Specified by:
setTransformin interfaceRenderer- Parameters:
usr2dev- the new user space to device space transform. If null, the identity transform will be set.
-
getTransform
Returns the transform from the current user space (as defined by the top node of the GVT tree) to the device space.- Specified by:
getTransformin interfaceImageRenderer- Specified by:
getTransformin interfaceRenderer
-
setRenderingHints
Description copied from interface:ImageRendererSets the specified rendering hints to be used for future renderings. This replaces current set of rendering hints.- Specified by:
setRenderingHintsin interfaceImageRenderer- Parameters:
rh- Set of rendering hints to use for future renderings
-
getRenderingHints
Description copied from interface:ImageRendererReturns the rendering hints this ImageRenderer is using for its rendering.- Specified by:
getRenderingHintsin interfaceImageRenderer- Returns:
- the RenderingHints which the Renderer is using for its rendering
-
isDoubleBuffered
public boolean isDoubleBuffered()Returns true if the Renderer is currently doubleBuffering is rendering requests. If it is then getOffscreen will only return completed renderings (or null if nothing is available).- Specified by:
isDoubleBufferedin interfaceRenderer
-
setDoubleBuffered
public void setDoubleBuffered(boolean isDoubleBuffered) Turns on/off double buffering in renderer. Turning off double buffering makes it possible to see the ongoing results of a render operation.- Specified by:
setDoubleBufferedin interfaceRenderer- Parameters:
isDoubleBuffered- the new value for double buffering
-
updateOffScreen
public void updateOffScreen(int width, int height) Update the size of the image to be returned by getOffScreen. Note that this change will not be reflected by calls to getOffscreen until either clearOffScreen has completed (when isDoubleBuffered is false) or reapint has completed (when isDoubleBuffered is true).- Specified by:
updateOffScreenin interfaceImageRenderer
-
getOffScreen
Returns the current offscreen image. The exact symantics of this vary base on the value of isDoubleBuffered. If isDoubleBuffered is false this will return the image currently being worked on as soon as it is available. if isDoubleBuffered is false this will return the most recently completed result of repaint.- Specified by:
getOffScreenin interfaceImageRenderer
-
clearOffScreen
public void clearOffScreen()Sets up and clears the current offscreen buffer. When not double buffering one should call this method before calling getOffscreen to get the offscreen being drawn into. This ensures the buffer is up to date and doesn't contain junk. When double buffering this call can effectively be skipped, since getOffscreen will only refect the new rendering after repaint completes.- Specified by:
clearOffScreenin interfaceImageRenderer
-
flush
public void flush()Description copied from interface:ImageRendererFlush any cached image data (preliminary interface).- Specified by:
flushin interfaceImageRenderer
-
flush
Description copied from interface:ImageRendererFlush a rectangle of cached image data (preliminary interface).- Specified by:
flushin interfaceImageRenderer
-
flush
Flush a list of rectangles of cached image data.- Specified by:
flushin interfaceImageRenderer
-
updateWorkingBuffers
protected void updateWorkingBuffers() -
repaint
-
repaint
Repaints the associated GVT tree under the list ofareas. If double buffered is true and this method completes cleanly it will set the result of the repaint as the image returned by getOffscreen otherwise the old image will still be returned. If double buffered is false it is possible some effects of the failed rendering will be visible in the image returned by getOffscreen.
-