Class MetaState
- java.lang.Object
-
- com.itextpdf.kernel.pdf.canvas.wmf.MetaState
-
public class MetaState extends java.lang.ObjectClass to keep the state.
-
-
Field Summary
Fields Modifier and Type Field Description static intALTERNATEprivate intbackgroundModeThe current background mode.private ColorcurrentBackgroundColorThe current background color.private MetaBrushcurrentBrushCurrent Brush.private MetaFontcurrentFontCurrent Font.private MetaPencurrentPenCurrent Pen.private PointcurrentPointCurrent Point.private ColorcurrentTextColorCurrent text color.private intextentWxCurrent extent for Wx.private intextentWyCurrent extent for Wy.private intlineJoinCurent line join.private java.util.List<MetaObject>metaObjectsList of MetaObjects.private intoffsetWxCurrent offset for Wx.private intoffsetWyCurrent offset for Wy.static intOPAQUEprivate intpolyFillModeCurrent polygon fill mode.private java.util.Stack<MetaState>savedStatesStack of saved states.private floatscalingXCurrent x value for scaling.private floatscalingYCurrent y value for scaling.static intTA_BASELINEstatic intTA_BOTTOMstatic intTA_CENTERstatic intTA_LEFTstatic intTA_NOUPDATECPstatic intTA_RIGHTstatic intTA_TOPstatic intTA_UPDATECPprivate inttextAlignCurrent text alignment.static intTRANSPARENTstatic intWINDING
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMetaObject(MetaObject object)Add a MetaObject to the State.voidcleanup(PdfCanvas cb)Restres the state of the specified PdfCanvas object for as many times as there are saved states on the stack.voiddeleteMetaObject(int index)Deletes the MetaObject at the specified index.intgetBackgroundMode()Getter for property backgroundMode.ColorgetCurrentBackgroundColor()Getter for property currentBackgroundColor.MetaBrushgetCurrentBrush()Returns the current MetaBrush object.MetaFontgetCurrentFont()Returns the current MetaFont object.MetaPengetCurrentPen()Returns the current MetaPen object.PointgetCurrentPoint()Returns the current Point.ColorgetCurrentTextColor()Getter for property currentTextColor.booleangetLineNeutral()Returns true if lineJoin is 0.intgetPolyFillMode()Getter for property polyFillMode.intgetTextAlign()Getter for property textAlign.voidrestoreState(int index, PdfCanvas cb)Restores the state to the next state on the saved states stack.voidsaveState(PdfCanvas cb)Saves the state of this MetaState object.voidselectMetaObject(int index, PdfCanvas cb)Select the MetaObject at the specified index and prepare the PdfCanvas.voidsetBackgroundMode(int backgroundMode)Setter for property backgroundMode.voidsetCurrentBackgroundColor(Color currentBackgroundColor)Setter for property currentBackgroundColor.voidsetCurrentPoint(Point p)Sets the current Point to the specified Point.voidsetCurrentTextColor(Color currentTextColor)Setter for property currentTextColor.voidsetExtentWx(int extentWx)Sets the Wx extent value.voidsetExtentWy(int extentWy)Sets the Wy extent value.voidsetLineJoinPolygon(PdfCanvas cb)Sets the line join style toPdfCanvasConstants.LineJoinStyle.ROUNDif lineJoin is 0.voidsetLineJoinRectangle(PdfCanvas cb)Sets the line join style toPdfCanvasConstants.LineJoinStyle.MITERif lineJoin isn't 0.voidsetMetaState(MetaState state)Sets every field of this MetaState to the values of the fields of the specified MetaState.voidsetOffsetWx(int offsetWx)Sets the Wx offset value.voidsetOffsetWy(int offsetWy)Sets the Wy offset value.voidsetPolyFillMode(int polyFillMode)Setter for property polyFillMode.voidsetScalingX(float scalingX)Sets the x value for scaling.voidsetScalingY(float scalingY)Sets the y value for scaling.voidsetTextAlign(int textAlign)Setter for property textAlign.floattransformAngle(float angle)Transforms the specified angle.floattransformX(int x)Transform the specified value.floattransformY(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
private java.util.Stack<MetaState> savedStates
Stack of saved states.
-
metaObjects
private java.util.List<MetaObject> metaObjects
List of MetaObjects.
-
currentPoint
private Point currentPoint
Current Point.
-
currentPen
private MetaPen currentPen
Current Pen.
-
currentBrush
private MetaBrush currentBrush
Current Brush.
-
currentFont
private MetaFont currentFont
Current Font.
-
currentBackgroundColor
private Color currentBackgroundColor
The current background color. Default value is DeviceRgb#WHITE.
-
currentTextColor
private Color currentTextColor
Current text color. Default value is DeviceRgb#BLACK.
-
backgroundMode
private int backgroundMode
The current background mode. Default value is OPAQUE.
-
polyFillMode
private int polyFillMode
Current polygon fill mode. Default value is ALTERNATE.
-
lineJoin
private int lineJoin
Curent line join. Default value is 1.
-
textAlign
private int textAlign
Current text alignment.
-
offsetWx
private int offsetWx
Current offset for Wx.
-
offsetWy
private int offsetWy
Current offset for Wy.
-
extentWx
private int extentWx
Current extent for Wx.
-
extentWy
private int extentWy
Current extent for Wy.
-
scalingX
private float scalingX
Current x value for scaling.
-
scalingY
private 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.MITERif 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.ROUNDif 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
-
-