Class MetaState
- java.lang.Object
-
- com.itextpdf.kernel.pdf.canvas.wmf.MetaState
-
public class MetaState extends java.lang.Object
Class to keep the state.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALTERNATE
int
backgroundMode
The current background mode.Color
currentBackgroundColor
The current background color.MetaBrush
currentBrush
Current Brush.MetaFont
currentFont
Current Font.MetaPen
currentPen
Current Pen.Point
currentPoint
Current Point.Color
currentTextColor
Current text color.int
extentWx
Current extent for Wx.int
extentWy
Current extent for Wy.int
lineJoin
Curent line join.java.util.List<MetaObject>
MetaObjects
List of MetaObjects.int
offsetWx
Current offset for Wx.int
offsetWy
Current offset for Wy.static int
OPAQUE
int
polyFillMode
Current polygon fill mode.java.util.Stack<MetaState>
savedStates
Stack of saved states.float
scalingX
Current x value for scaling.float
scalingY
Current y value for scaling.static int
TA_BASELINE
static int
TA_BOTTOM
static int
TA_CENTER
static int
TA_LEFT
static int
TA_NOUPDATECP
static int
TA_RIGHT
static int
TA_TOP
static int
TA_UPDATECP
int
textAlign
Current text alignment.static int
TRANSPARENT
static int
WINDING
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMetaObject(MetaObject object)
Add a MetaObject to the State.void
cleanup(PdfCanvas cb)
Restres the state of the specified PdfCanvas object for as many times as there are saved states on the stack.void
deleteMetaObject(int index)
Deletes the MetaObject at the specified index.int
getBackgroundMode()
Getter for property backgroundMode.Color
getCurrentBackgroundColor()
Getter for property currentBackgroundColor.MetaBrush
getCurrentBrush()
Returns the current MetaBrush object.MetaFont
getCurrentFont()
Returns the current MetaFont object.MetaPen
getCurrentPen()
Returns the current MetaPen object.Point
getCurrentPoint()
Returns the current Point.Color
getCurrentTextColor()
Getter for property currentTextColor.boolean
getLineNeutral()
Returns true if lineJoin is 0.int
getPolyFillMode()
Getter for property polyFillMode.int
getTextAlign()
Getter for property textAlign.void
restoreState(int index, PdfCanvas cb)
Restores the state to the next state on the saved states stack.void
saveState(PdfCanvas cb)
Saves the state of this MetaState object.void
selectMetaObject(int index, PdfCanvas cb)
Select the MetaObject at the specified index and prepare the PdfCanvas.void
setBackgroundMode(int backgroundMode)
Setter for property backgroundMode.void
setCurrentBackgroundColor(Color currentBackgroundColor)
Setter for property currentBackgroundColor.void
setCurrentPoint(Point p)
Sets the current Point to the specified Point.void
setCurrentTextColor(Color currentTextColor)
Setter for property currentTextColor.void
setExtentWx(int extentWx)
Sets the Wx extent value.void
setExtentWy(int extentWy)
Sets the Wy extent value.void
setLineJoinPolygon(PdfCanvas cb)
Sets the line join style toPdfCanvasConstants.LineJoinStyle.ROUND
if lineJoin is 0.void
setLineJoinRectangle(PdfCanvas cb)
Sets the line join style toPdfCanvasConstants.LineJoinStyle.MITER
if lineJoin isn't 0.void
setMetaState(MetaState state)
Sets every field of this MetaState to the values of the fields of the specified MetaState.void
setOffsetWx(int offsetWx)
Sets the Wx offset value.void
setOffsetWy(int offsetWy)
Sets the Wy offset value.void
setPolyFillMode(int polyFillMode)
Setter for property polyFillMode.void
setScalingX(float scalingX)
Sets the x value for scaling.void
setScalingY(float scalingY)
Sets the y value for scaling.void
setTextAlign(int textAlign)
Setter for property textAlign.float
transformAngle(float angle)
Transforms the specified angle.float
transformX(int x)
Transform the specified value.float
transformY(int y)
Transform the specified value.
-
-
-
Field Detail
-
TA_NOUPDATECP
public static final int TA_NOUPDATECP
- See Also:
- Constant Field Values
-
TA_UPDATECP
public static final int TA_UPDATECP
- See Also:
- Constant Field Values
-
TA_LEFT
public static final int TA_LEFT
- See Also:
- Constant Field Values
-
TA_RIGHT
public static final int TA_RIGHT
- See Also:
- Constant Field Values
-
TA_CENTER
public static final int TA_CENTER
- See Also:
- Constant Field Values
-
TA_TOP
public static final int TA_TOP
- See Also:
- Constant Field Values
-
TA_BOTTOM
public static final int TA_BOTTOM
- See Also:
- Constant Field Values
-
TA_BASELINE
public static final int TA_BASELINE
- See Also:
- Constant Field Values
-
TRANSPARENT
public static final int TRANSPARENT
- See Also:
- Constant Field Values
-
OPAQUE
public static final int OPAQUE
- See Also:
- Constant Field Values
-
ALTERNATE
public static final int ALTERNATE
- See Also:
- Constant Field Values
-
WINDING
public static final int WINDING
- See Also:
- Constant Field Values
-
savedStates
public java.util.Stack<MetaState> savedStates
Stack of saved states.
-
MetaObjects
public java.util.List<MetaObject> MetaObjects
List of MetaObjects.
-
currentPoint
public Point currentPoint
Current Point.
-
currentPen
public MetaPen currentPen
Current Pen.
-
currentBrush
public MetaBrush currentBrush
Current Brush.
-
currentFont
public MetaFont currentFont
Current Font.
-
currentBackgroundColor
public Color currentBackgroundColor
The current background color. Default value is DeviceRgb#WHITE.
-
currentTextColor
public Color currentTextColor
Current text color. Default value is DeviceRgb#BLACK.
-
backgroundMode
public int backgroundMode
The current background mode. Default value is OPAQUE.
-
polyFillMode
public int polyFillMode
Current polygon fill mode. Default value is ALTERNATE.
-
lineJoin
public int lineJoin
Curent line join. Default value is 1.
-
textAlign
public int textAlign
Current text alignment.
-
offsetWx
public int offsetWx
Current offset for Wx.
-
offsetWy
public int offsetWy
Current offset for Wy.
-
extentWx
public int extentWx
Current extent for Wx.
-
extentWy
public int extentWy
Current extent for Wy.
-
scalingX
public float scalingX
Current x value for scaling.
-
scalingY
public float scalingY
Current y value for scaling.
-
-
Constructor Detail
-
MetaState
public MetaState()
Creates new MetaState
-
MetaState
public MetaState(MetaState state)
Clones a new MetaState from the specified MetaState.- Parameters:
state
- the state to clone
-
-
Method Detail
-
setMetaState
public void setMetaState(MetaState state)
Sets every field of this MetaState to the values of the fields of the specified MetaState.- Parameters:
state
- state to copy
-
addMetaObject
public void addMetaObject(MetaObject object)
Add a MetaObject to the State.- Parameters:
object
- MetaObject to be added
-
selectMetaObject
public void selectMetaObject(int index, PdfCanvas cb)
Select the MetaObject at the specified index and prepare the PdfCanvas.- Parameters:
index
- position of the MetaObjectcb
- PdfCanvas to prepare
-
deleteMetaObject
public void deleteMetaObject(int index)
Deletes the MetaObject at the specified index.- Parameters:
index
- index of the MetaObject to delete
-
saveState
public void saveState(PdfCanvas cb)
Saves the state of this MetaState object.- Parameters:
cb
- PdfCanvas object on which saveState() will be called
-
restoreState
public void restoreState(int index, PdfCanvas cb)
Restores the state to the next state on the saved states stack.- Parameters:
index
- index of the state to be restoredcb
- PdfCanvas object on which restoreState() will be called
-
cleanup
public void cleanup(PdfCanvas cb)
Restres the state of the specified PdfCanvas object for as many times as there are saved states on the stack.- Parameters:
cb
- PdfCanvas object
-
transformX
public float transformX(int x)
Transform the specified value.- Parameters:
x
- the value to transform- Returns:
- the transformed value
-
transformY
public float transformY(int y)
Transform the specified value.- Parameters:
y
- the value to transform- Returns:
- transformed value
-
setScalingX
public void setScalingX(float scalingX)
Sets the x value for scaling.- Parameters:
scalingX
- x value for scaling
-
setScalingY
public void setScalingY(float scalingY)
Sets the y value for scaling.- Parameters:
scalingY
- y value for scaling
-
setOffsetWx
public void setOffsetWx(int offsetWx)
Sets the Wx offset value.- Parameters:
offsetWx
- Wx offset value
-
setOffsetWy
public void setOffsetWy(int offsetWy)
Sets the Wy offset value.- Parameters:
offsetWy
- Wy offset value
-
setExtentWx
public void setExtentWx(int extentWx)
Sets the Wx extent value.- Parameters:
extentWx
- Wx extent value
-
setExtentWy
public void setExtentWy(int extentWy)
Sets the Wy extent value.- Parameters:
extentWy
- Wy extent value
-
transformAngle
public float transformAngle(float angle)
Transforms the specified angle. If scalingY is less than 0, the angle is multiplied by -1. If scalingX is less than 0, the angle is subtracted from Math.PI.- Parameters:
angle
- the angle to transform- Returns:
- the transformed angle
-
setCurrentPoint
public void setCurrentPoint(Point p)
Sets the current Point to the specified Point.- Parameters:
p
- Point to set
-
getCurrentPoint
public Point getCurrentPoint()
Returns the current Point.- Returns:
- current Point
-
getCurrentBrush
public MetaBrush getCurrentBrush()
Returns the current MetaBrush object.- Returns:
- current MetaBrush
-
getCurrentPen
public MetaPen getCurrentPen()
Returns the current MetaPen object.- Returns:
- current MetaPen
-
getCurrentFont
public MetaFont getCurrentFont()
Returns the current MetaFont object.- Returns:
- current MetaFont
-
getCurrentBackgroundColor
public Color getCurrentBackgroundColor()
Getter for property currentBackgroundColor.- Returns:
- Value of property currentBackgroundColor.
-
setCurrentBackgroundColor
public void setCurrentBackgroundColor(Color currentBackgroundColor)
Setter for property currentBackgroundColor.- Parameters:
currentBackgroundColor
- New value of property currentBackgroundColor.
-
getCurrentTextColor
public Color getCurrentTextColor()
Getter for property currentTextColor.- Returns:
- Value of property currentTextColor.
-
setCurrentTextColor
public void setCurrentTextColor(Color currentTextColor)
Setter for property currentTextColor.- Parameters:
currentTextColor
- New value of property currentTextColor.
-
getBackgroundMode
public int getBackgroundMode()
Getter for property backgroundMode.- Returns:
- Value of property backgroundMode.
-
setBackgroundMode
public void setBackgroundMode(int backgroundMode)
Setter for property backgroundMode.- Parameters:
backgroundMode
- New value of property backgroundMode.
-
getTextAlign
public int getTextAlign()
Getter for property textAlign.- Returns:
- Value of property textAlign.
-
setTextAlign
public void setTextAlign(int textAlign)
Setter for property textAlign.- Parameters:
textAlign
- New value of property textAlign.
-
getPolyFillMode
public int getPolyFillMode()
Getter for property polyFillMode.- Returns:
- Value of property polyFillMode.
-
setPolyFillMode
public void setPolyFillMode(int polyFillMode)
Setter for property polyFillMode.- Parameters:
polyFillMode
- New value of property polyFillMode.
-
setLineJoinRectangle
public void setLineJoinRectangle(PdfCanvas cb)
Sets the line join style toPdfCanvasConstants.LineJoinStyle.MITER
if lineJoin isn't 0.- Parameters:
cb
- PdfCanvas to set the line join style
-
setLineJoinPolygon
public void setLineJoinPolygon(PdfCanvas cb)
Sets the line join style toPdfCanvasConstants.LineJoinStyle.ROUND
if lineJoin is 0.- Parameters:
cb
- PdfCanvas to set the line join style
-
getLineNeutral
public boolean getLineNeutral()
Returns true if lineJoin is 0.- Returns:
- true if lineJoin is 0
-
-