Class MetaState
java.lang.Object
com.itextpdf.kernel.pdf.canvas.wmf.MetaState
Class to keep the state.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
int
The current background mode.The current background color.Current Brush.Current Font.Current Pen.Current Point.Current text color.int
Current extent for Wx.int
Current extent for Wy.int
Curent line join.List of MetaObjects.int
Current offset for Wx.int
Current offset for Wy.static final int
int
Current polygon fill mode.Stack of saved states.float
Current x value for scaling.float
Current y value for scaling.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
Current text alignment.static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMetaObject
(MetaObject object) Add a MetaObject to the State.void
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
Getter for property backgroundMode.Getter for property currentBackgroundColor.Returns the current MetaBrush object.Returns the current MetaFont object.Returns the current MetaPen object.Returns the current Point.Getter for property currentTextColor.boolean
Returns true if lineJoin is 0.int
Getter for property polyFillMode.int
Getter for property textAlign.void
restoreState
(int index, PdfCanvas cb) Restores the state to the next state on the saved states stack.void
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
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
Sets the line join style toPdfCanvasConstants.LineJoinStyle.ROUND
if lineJoin is 0.void
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 Details
-
TA_NOUPDATECP
public static final int TA_NOUPDATECP- See Also:
-
TA_UPDATECP
public static final int TA_UPDATECP- See Also:
-
TA_LEFT
public static final int TA_LEFT- See Also:
-
TA_RIGHT
public static final int TA_RIGHT- See Also:
-
TA_CENTER
public static final int TA_CENTER- See Also:
-
TA_TOP
public static final int TA_TOP- See Also:
-
TA_BOTTOM
public static final int TA_BOTTOM- See Also:
-
TA_BASELINE
public static final int TA_BASELINE- See Also:
-
TRANSPARENT
public static final int TRANSPARENT- See Also:
-
OPAQUE
public static final int OPAQUE- See Also:
-
ALTERNATE
public static final int ALTERNATE- See Also:
-
WINDING
public static final int WINDING- See Also:
-
savedStates
Stack of saved states. -
MetaObjects
List of MetaObjects. -
currentPoint
Current Point. -
currentPen
Current Pen. -
currentBrush
Current Brush. -
currentFont
Current Font. -
currentBackgroundColor
The current background color. Default value is DeviceRgb#WHITE. -
currentTextColor
Current text color. Default value is DeviceRgb#BLACK. -
backgroundMode
public int backgroundModeThe current background mode. Default value is OPAQUE. -
polyFillMode
public int polyFillModeCurrent polygon fill mode. Default value is ALTERNATE. -
lineJoin
public int lineJoinCurent line join. Default value is 1. -
textAlign
public int textAlignCurrent text alignment. -
offsetWx
public int offsetWxCurrent offset for Wx. -
offsetWy
public int offsetWyCurrent offset for Wy. -
extentWx
public int extentWxCurrent extent for Wx. -
extentWy
public int extentWyCurrent extent for Wy. -
scalingX
public float scalingXCurrent x value for scaling. -
scalingY
public float scalingYCurrent y value for scaling.
-
-
Constructor Details
-
MetaState
public MetaState()Creates new MetaState -
MetaState
Clones a new MetaState from the specified MetaState.- Parameters:
-
state
- the state to clone
-
-
Method Details
-
setMetaState
Sets every field of this MetaState to the values of the fields of the specified MetaState.- Parameters:
-
state
- state to copy
-
addMetaObject
Add a MetaObject to the State.- Parameters:
-
object
- MetaObject to be added
-
selectMetaObject
Select the MetaObject at the specified index and prepare the PdfCanvas.- Parameters:
-
index
- position of the MetaObject -
cb
- 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
Saves the state of this MetaState object.- Parameters:
-
cb
- PdfCanvas object on which saveState() will be called
-
restoreState
Restores the state to the next state on the saved states stack.- Parameters:
-
index
- index of the state to be restored -
cb
- PdfCanvas object on which restoreState() will be called
-
cleanup
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
Sets the current Point to the specified Point.- Parameters:
-
p
- Point to set
-
getCurrentPoint
Returns the current Point.- Returns:
- current Point
-
getCurrentBrush
Returns the current MetaBrush object.- Returns:
- current MetaBrush
-
getCurrentPen
Returns the current MetaPen object.- Returns:
- current MetaPen
-
getCurrentFont
Returns the current MetaFont object.- Returns:
- current MetaFont
-
getCurrentBackgroundColor
Getter for property currentBackgroundColor.- Returns:
- Value of property currentBackgroundColor.
-
setCurrentBackgroundColor
Setter for property currentBackgroundColor.- Parameters:
-
currentBackgroundColor
- New value of property currentBackgroundColor.
-
getCurrentTextColor
Getter for property currentTextColor.- Returns:
- Value of property currentTextColor.
-
setCurrentTextColor
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
Sets the line join style toPdfCanvasConstants.LineJoinStyle.MITER
if lineJoin isn't 0.- Parameters:
-
cb
- PdfCanvas to set the line join style
-
setLineJoinPolygon
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
-