org.apache.fop.render.java2d
Class Java2DGraphicsState
java.lang.Object
org.apache.fop.render.java2d.Java2DGraphicsState
public class Java2DGraphicsState
extends java.lang.Object
Keeps information about the current state of the Graphics2D currentGraphics.
It is also used as a stack to hold a graphics context.
The graphics context is updated with the updateXXX() methods.
void | dispose() - Frees resources allocated by the current Graphics2D instance.
|
Color | getColor()
|
java.awt.Font | getFont()
|
Graphics2D | getGraph()
|
BasicStroke | getStroke()
|
AffineTransform | getTransform() - Get the current transform.
|
String | toString()
|
void | transform(AffineTransform tf) - Composes an AffineTransform object with the Transform in this Graphics2D
according to the rule last-specified-first-applied.
|
boolean | updateClip(Shape cl) - Set the current clip.
|
boolean | updateColor(Color col) - Set the current background color.
|
boolean | updateFont(String name, int size) - Set the current font name.
|
boolean | updatePaint(Paint p) - Set the current paint.
|
boolean | updateStroke(float width, int style) - Sets the current Stroke.
|
Java2DGraphicsState
public Java2DGraphicsState(Graphics2D graphics,
FontInfo fontInfo,
AffineTransform at)
State for storing graphics state.
graphics
- the graphics associated with the BufferedImagefontInfo
- the FontInfo from the rendererat
- the initial AffineTransform containing the scale transformation
Java2DGraphicsState
public Java2DGraphicsState(Java2DGraphicsState org)
Copy constructor.
org
- the instance to copy
dispose
public void dispose()
Frees resources allocated by the current Graphics2D instance.
getColor
public Color getColor()
- the current java.awt.Color
getFont
public java.awt.Font getFont()
- the current java.awt.Font
getGraph
public Graphics2D getGraph()
- the currently valid state
getStroke
public BasicStroke getStroke()
- the currently active Stroke
getTransform
public AffineTransform getTransform()
Get the current transform. This gets the combination of all transforms in
the current state.
- the calculate combined transform for the current state
toString
public String toString()
java.lang.Object.toString()
transform
public void transform(AffineTransform tf)
Composes an AffineTransform object with the Transform in this Graphics2D
according to the rule last-specified-first-applied.
tf
- the transform to concatonate to the current level transform
updateClip
public boolean updateClip(Shape cl)
Set the current clip. This either sets a new clip or sets the clip to the
intersect of the old clip and the new clip.
cl
- the new clip in the current state
- true if the clip shape needed to be updated
updateColor
public boolean updateColor(Color col)
Set the current background color. Check if the background color will
change and then set the new color.
col
- the new color as a java.awt.Color
- true if the background color has changed
updateFont
public boolean updateFont(String name,
int size)
Set the current font name. Check if the font name will change and then
set the new name.
name
- the new font namesize
- the font size
- true if the new Font changes the current Font
updatePaint
public boolean updatePaint(Paint p)
Set the current paint. This checks if the paint will change and then sets
the current paint.
- true if the new paint changes the current paint
updateStroke
public boolean updateStroke(float width,
int style)
Sets the current Stroke. The line width should be set with
updateLineWidth() before calling this method
width
- the line widthstyle
- the constant for the style of the line as an int
- true if the new Stroke changes the current Stroke
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.