org.apache.batik.gvt.renderer

Class MacRenderer

public class MacRenderer extends Object implements ImageRenderer

Simple implementation of the Renderer that supports dynamic updates.
Field Summary
protected BufferedImagecurrImg
protected RectListManagerdamagedAreas
protected static RenderingHintsdefaultRenderingHints
protected booleanisDoubleBuffered
static intIMAGE_TYPE
protected intoffScreenHeight
protected intoffScreenWidth
protected RenderingHintsrenderingHints
protected GraphicsNoderootGN
static ColorTRANSPARENT_WHITE
protected AffineTransformusr2dev
protected BufferedImageworkImg
Constructor Summary
MacRenderer()
Constructs a new dynamic renderer with the specified buffer image.
MacRenderer(RenderingHints rh, AffineTransform at)
Method Summary
voidclearOffScreen()
Sets up and clears the current offscreen buffer.
voiddispose()
voidflush()
voidflush(Rectangle r)
voidflush(Collection areas)
Flush a list of rectangles of cached image data.
BufferedImagegetOffScreen()
Returns the current offscreen image.
RenderingHintsgetRenderingHints()
AffineTransformgetTransform()
Returns the transform from the current user space (as defined by the top node of the GVT tree) to the device space.
GraphicsNodegetTree()
Returns the GVT tree associated with this renderer
booleanisDoubleBuffered()
Returns true if the Renderer is currently doubleBuffering is rendering requests.
voidrepaint(Shape area)
voidrepaint(RectListManager devRLM)
Repaints the associated GVT tree under the list of areas.
voidsetDoubleBuffered(boolean isDoubleBuffered)
Turns on/off double buffering in renderer.
voidsetRenderingHints(RenderingHints rh)
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 voidupdateWorkingBuffers()

Field Detail

currImg

protected BufferedImage currImg

damagedAreas

protected RectListManager damagedAreas

defaultRenderingHints

protected static RenderingHints defaultRenderingHints

isDoubleBuffered

protected boolean isDoubleBuffered

IMAGE_TYPE

public static int IMAGE_TYPE

offScreenHeight

protected int offScreenHeight

offScreenWidth

protected int offScreenWidth

renderingHints

protected RenderingHints renderingHints

rootGN

protected GraphicsNode rootGN

TRANSPARENT_WHITE

public static Color TRANSPARENT_WHITE

usr2dev

protected AffineTransform usr2dev

workImg

protected BufferedImage workImg

Constructor Detail

MacRenderer

public MacRenderer()
Constructs a new dynamic renderer with the specified buffer image.

MacRenderer

public MacRenderer(RenderingHints rh, AffineTransform at)

Method Detail

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.

dispose

public void dispose()

flush

public void flush()

flush

public void flush(Rectangle r)

flush

public void flush(Collection areas)
Flush a list of rectangles of cached image data.

getOffScreen

public BufferedImage 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.

getRenderingHints

public RenderingHints getRenderingHints()

Returns: the RenderingHints which the Renderer is using for its rendering

getTransform

public AffineTransform getTransform()
Returns the transform from the current user space (as defined by the top node of the GVT tree) to the device space.

getTree

public GraphicsNode getTree()
Returns the GVT tree associated with this renderer

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).

repaint

public void repaint(Shape area)

repaint

public void repaint(RectListManager devRLM)
Repaints the associated GVT tree under the list of areas. 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.

Parameters: devRLM regions to be repainted, in the current user space coordinate system.

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.

Parameters: isDoubleBuffered the new value for double buffering

setRenderingHints

public void setRenderingHints(RenderingHints rh)

Parameters: rh Set of rendering hints to use for future renderings

setTransform

public void setTransform(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.

setTree

public void setTree(GraphicsNode treeRoot)
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.

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).

updateWorkingBuffers

protected void updateWorkingBuffers()
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.