Package org.apache.fop.util
Class AbstractPaintingState
java.lang.Object
org.apache.fop.util.AbstractPaintingState
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AFPPaintingState
,PDFPaintingState
A base class which holds information about the current painting state.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
A base painting state data holding objectclass
A stack implementation which holds state objects -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check the current transform.void
clear()
Clears the state stackvoid
Clears the current AffineTransform to the Identity AffineTransformclone()
void
Concatenates the given AffineTransform to the current one.Get the background color.Get a copy of the base transform for the page.getColor()
Get the color.getData()
Returns the currently valid stateGets the current font nameint
Gets the current font sizefloat
Returns the current line widthprotected Stack<AbstractPaintingState.AbstractData>
Return the state stackGet the current transform.protected abstract AbstractPaintingState
Instantiates a new state objectprotected abstract AbstractPaintingState.AbstractData
Instantiates a new state data objectvoid
Resets the current AffineTransform to the Base AffineTransform.restore()
Restore the current painting state.Restore all painting state data.void
save()
Save the current painting state.void
saveAll
(List<AbstractPaintingState.AbstractData> dataList) Save all painting state data.boolean
setBackColor
(Color col) Set the current background color.boolean
Set the current color.boolean
setDashArray
(float[] dash) Sets the dash array (line type) for the current basic strokeprotected void
Sets the current state databoolean
setFontName
(String internalFontName) Set the current font nameboolean
setFontSize
(int size) Set the current font size.boolean
setLineWidth
(float width) Set the current line width.toString()
-
Constructor Details
-
AbstractPaintingState
public AbstractPaintingState()
-
-
Method Details
-
instantiateData
Instantiates a new state data object- Returns:
- a new state data object
-
instantiate
Instantiates a new state object- Returns:
- a new state object
-
getData
Returns the currently valid state- Returns:
- the currently valid state
-
setColor
Set the current color. Check if the new color is a change and then set the current color.- Parameters:
col
- the color to set- Returns:
- true if the color has changed
-
getColor
Get the color.- Returns:
- the color
-
getBackColor
Get the background color.- Returns:
- the background color
-
setBackColor
Set the current background color. Check if the new background color is a change and then set the current background color.- Parameters:
col
- the background color to set- Returns:
- true if the color has changed
-
setFontName
Set the current font name- Parameters:
internalFontName
- the internal font name- Returns:
- true if the font name has changed
-
getFontName
Gets the current font name- Returns:
- the current font name
-
getFontSize
public int getFontSize()Gets the current font size- Returns:
- the current font size
-
setFontSize
public boolean setFontSize(int size) Set the current font size. Check if the font size is a change and then set the current font size.- Parameters:
size
- the font size to set- Returns:
- true if the font size has changed
-
setLineWidth
public boolean setLineWidth(float width) Set the current line width.- Parameters:
width
- the line width in points- Returns:
- true if the line width has changed
-
getLineWidth
public float getLineWidth()Returns the current line width- Returns:
- the current line width
-
setDashArray
public boolean setDashArray(float[] dash) Sets the dash array (line type) for the current basic stroke- Parameters:
dash
- the line dash array- Returns:
- true if the dash array has changed
-
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
-
checkTransform
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 the check against- Returns:
- true if the new transform is different then the current transform
-
getBaseTransform
Get a copy of the base transform for the page. Used to translate IPP/BPP values into X,Y positions when positioning is "fixed".- Returns:
- the base transform, or null if the state stack is empty
-
concatenate
Concatenates the given AffineTransform to the current one.- Parameters:
at
- the transform to concatenate to the current level transform
-
resetTransform
public void resetTransform()Resets the current AffineTransform to the Base AffineTransform. -
clearTransform
public void clearTransform()Clears the current AffineTransform to the Identity AffineTransform -
save
public void save()Save the current painting state. This pushes the current painting state onto the stack. This call should be used when the Q operator is used so that the state is known when popped. -
restore
Restore the current painting state. This pops the painting state from the stack and sets current values to popped state.- Returns:
- the restored state, null if the stack is empty
-
saveAll
Save all painting state data. This pushes all painting state data in the given list to the stack- Parameters:
dataList
- a state data list
-
restoreAll
Restore all painting state data. This pops all painting state data from the stack- Returns:
- a list of state data popped from the stack
-
setData
Sets the current state data- Parameters:
data
- the state data
-
clear
public void clear()Clears the state stack -
getStateStack
Return the state stack- Returns:
- the state stack
-
clone
-
toString
-