fop 0.92beta

org.apache.fop.render.java2d
Interface RendererState

All Known Implementing Classes:
Java2DGraphicsState

public interface RendererState

An interface for the classes which hold the state of the current graphics context.


Method Summary
 boolean checkClip(java.awt.Shape cl)
          Check if the clip will change the current state.
 boolean checkTransform(java.awt.geom.AffineTransform tf)
          Check the current transform.
 int getStackLevel()
          Get the current stack level.
 java.awt.geom.AffineTransform getTransform()
          Get the current transform.
 java.awt.Graphics2D pop()
          Pop the state from the stack and restore the graphics context.
 void push()
          Push the current state onto the stack.
 void setTransform(java.awt.geom.AffineTransform tf)
          Overwrites the Transform in the Graphics2D context.
 void transform(java.awt.geom.AffineTransform tf)
          Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.
 boolean updateClip(java.awt.Shape cl)
          Set the current clip.
 boolean updateColor(ColorType col, boolean fill, java.lang.StringBuffer pdf)
          Establishes a new foreground or fill color.
 boolean updateFont(java.lang.String name, int size, java.lang.StringBuffer pdf)
          Set the current font name.
 boolean updatePaint(java.awt.Paint p)
          Set the current paint.
 boolean updateStroke(float width, int style)
          Sets the current Stroke.
 

Method Detail

push

public void push()
Push the current state onto the stack.


pop

public java.awt.Graphics2D pop()
Pop the state from the stack and restore the graphics context.

Returns:
the restored state, null if the stack is empty.

getStackLevel

public int getStackLevel()
Get the current stack level.

Returns:
the current stack level

updateColor

public boolean updateColor(ColorType col,
                           boolean fill,
                           java.lang.StringBuffer pdf)
Establishes a new foreground or fill color.

Parameters:
col - the color to apply (null skips this operation)
fill - true to set the fill color, false for the foreground color
pdf - only used by the PDFRenderer, is set to null.
Returns:
true if the new Color changes the current Color

updateFont

public boolean updateFont(java.lang.String name,
                          int size,
                          java.lang.StringBuffer pdf)
Set the current font name. Check if the font name will change and then set the new name.

Parameters:
name - the new font name
size -
pdf -
Returns:
true if the new Font changes the current Font

updateStroke

public boolean updateStroke(float width,
                            int style)
Sets the current Stroke. The line width should be set with updateLineWidth() before calling this method

Parameters:
style - the constant for the style of the line as an int
Returns:
true if the new Stroke changes the current Stroke

updatePaint

public boolean updatePaint(java.awt.Paint p)
Set the current paint. This checks if the paint will change and then sets the current paint.

Parameters:
p - the new paint
Returns:
true if the new paint changes the current paint

checkClip

public boolean checkClip(java.awt.Shape cl)
Check if the clip will change the current state. A clip is assumed to be used in a situation where it will add to any clip in the current or parent states. A clip cannot be cleared, this can only be achieved by going to a parent level with the correct clip. If the clip is different then it may start a new state so that it can return to the previous clip.

Parameters:
cl - the clip shape to check
Returns:
true if the clip will change the current clip.

updateClip

public boolean updateClip(java.awt.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.

Parameters:
cl - the new clip in the current state

checkTransform

public boolean checkTransform(java.awt.geom.AffineTransform tf)
Check the current transform. The transform for the current state is the combination of all transforms in the current state. The parameter is compared against this current transform.

Parameters:
tf - the transform to check against
Returns:
true if the new transform is different from the current transform

setTransform

public void setTransform(java.awt.geom.AffineTransform tf)
Overwrites the Transform in the Graphics2D context. Use transform() if you wish to compose with the current Affinetransform instead.

Parameters:
tf - the transform to concatonate to the current level transform
See Also:
Graphics2D.setTransform(AffineTransform tf).

transform

public void transform(java.awt.geom.AffineTransform tf)
Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.

Parameters:
tf - the transform to concatonate to the current level transform
See Also:
Graphics2D.transform(AffineTransform tf).

getTransform

public java.awt.geom.AffineTransform getTransform()
Get the current transform. This gets the combination of all transforms in the current state.

Returns:
the calculate combined transform for the current state

fop 0.92beta

Copyright 1999-2006 The Apache Software Foundation. All Rights Reserved.