Package org.apache.fop.pdf
Class PDFPaintingState
java.lang.Object
org.apache.fop.util.AbstractPaintingState
org.apache.fop.pdf.PDFPaintingState
- All Implemented Interfaces:
Serializable,Cloneable
This keeps information about the current painting state when writing to pdf.
It allows for creating new graphics states with the q operator.
This class is only used to store the information about the state
the caller needs to handle the actual pdf operators.
When setting the state for pdf there are three possible ways of
handling the situation.
The values can be set to override previous or default values.
A new state can be added and then the values set.
The current state can be popped and values will return to a
previous state then the necessary values can be overridden.
The current transform behaves differently to other values as the
matrix is combined with the current resolved value.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.fop.util.AbstractPaintingState
AbstractPaintingState.AbstractData, AbstractPaintingState.StateStack<E> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the clip will change the current state.floatReturns the current character spacing (Tc) value.Get the graphics state.getLayer()booleanintGet the current stack level.protected AbstractPaintingStateInstantiates a new state objectprotected AbstractPaintingState.AbstractDataInstantiates a new state data objectvoidsave()Push the current state onto the stack.booleansetCharacterSpacing(float value) Sets the character spacing (Tc).voidSet the current clip.voidbooleanSet the current paint.Methods inherited from class org.apache.fop.util.AbstractPaintingState
checkTransform, clear, clearTransform, clone, concatenate, getBackColor, getBaseTransform, getColor, getData, getFontName, getFontSize, getLineWidth, getStateStack, getTransform, resetTransform, restore, restoreAll, saveAll, setBackColor, setColor, setDashArray, setData, setFontName, setFontSize, setLineWidth, toString
-
Constructor Details
-
PDFPaintingState
public PDFPaintingState()PDF State for storing graphics state.
-
-
Method Details
-
setPaint
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
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.
-
setClip
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
-
setCharacterSpacing
public boolean setCharacterSpacing(float value) Sets the character spacing (Tc).- Parameters:
value- the new value- Returns:
- true if the value was changed with respect to the previous value
-
getCharacterSpacing
public float getCharacterSpacing()Returns the current character spacing (Tc) value.- Returns:
- the Tc value
-
getStackLevel
public int getStackLevel()Get the current stack level.- Returns:
- the current stack level
-
getGState
Get the graphics state. This gets the combination of all graphic states for the current context. This is the graphic state set with the gs operator not the other graphic state changes.- Returns:
- the calculated ExtGState in the current context
-
setLayer
-
getLayer
-
getLayerChanged
public boolean getLayerChanged() -
instantiateData
Instantiates a new state data object- Specified by:
instantiateDatain classAbstractPaintingState- Returns:
- a new state data object
-
instantiate
Instantiates a new state object- Specified by:
instantiatein classAbstractPaintingState- Returns:
- a new state object
-
save
public void save()Push the current state onto the stack. This call should be used when the q operator is used so that the state is known when popped.- Overrides:
savein classAbstractPaintingState
-