Class WMFPainter
- java.lang.Object
-
- org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter
-
- org.apache.batik.transcoder.wmf.tosvg.WMFPainter
-
public class WMFPainter extends AbstractWMFPainter
Core class for rendering the WMF image. It is able to render a WMF file in aGraphicsobject.- Version:
- $Id: WMFPainter.java 1831630 2018-05-15 12:56:55Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.ColorbkgdColorprivate java.io.BufferedInputStreambufStreamprivate floatconvprivate booleanfirstEffectivePaintprivate java.awt.ColorfrgdColorprivate static intINPUT_BUFFER_SIZESize of the buffer used for reading input WMF filesprivate static java.lang.IntegerINTEGER_0private java.awt.image.ImageObserverobserverprivate booleanopaqueprivate floatscaleprivate floatscaleXprivate floatscaleYprivate static java.awt.BasicStrokesolidprivate static java.awt.BasicStroketextSolidprivate floatvpHprivate floatvpWprivate floatvpXprivate floatvpYprivate floatxOffsetprivate floatyOffset-
Fields inherited from class org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter
bReadingWMF, BRUSH, currentHorizAlign, currentStore, currentVertAlign, FONT, NULL_BRUSH, NULL_PEN, OBJ_BITMAP, OBJ_REGION, PALETTE, PEN, WMF_FILE_EXTENSION, wmfFont
-
-
Constructor Summary
Constructors Constructor Description WMFPainter(WMFRecordStore currentStore, float scale)Basic constructor.WMFPainter(WMFRecordStore currentStore, int xOffset, int yOffset, float scale)Basic constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddrawPolyPolygon(java.awt.Graphics2D g2d, java.util.List pols)Just to be consistent with PolyPolygon filling.private voiddrawString(int flag, java.awt.Graphics2D g2d, java.text.AttributedCharacterIterator ati, float x, float y, java.awt.font.TextLayout layout, WMFFont wmfFont, int align)Draw an AttributedCharacterIterator taking into account the following characteristics.private voidfillPolyPolygon(java.awt.Graphics2D g2d, java.util.List pols)Need to do this for POLYPOLYGON, because only GeneralPaths can handle complex WMF shapes.private voidfillTextBackground(int align, int flag, java.awt.Graphics2D g2d, float x, float y, float width, java.awt.font.TextLayout layout)private intgetHorizontalAlignement(int align)private java.awt.PaintgetPaint(byte[] bit)WMFRecordStoregetRecordStore()Returns the WMFRecordStore this WMFPainter rendersprivate java.awt.PaintgetStoredPaint(WMFRecordStore currentStore, int object)private floatgetVerticalAlignmentValue(java.awt.font.TextLayout layout, int vertAlign)private voidpaint(int brushObject, int penObject, java.awt.Shape shape, java.awt.Graphics2D g2d)Draw or / and fill the Shape, depending on the pen or brush Objects selected.voidpaint(java.awt.Graphics g)Renders the WMF image(s).private voidpaintWithPen(int penObject, java.awt.Shape shape, java.awt.Graphics2D g2d)Draw the Shape, depending on the pen or brush Objects selected.private voidsetBrushPaint(WMFRecordStore currentStore, java.awt.Graphics2D g2d, int brushObject)private voidsetPenColor(WMFRecordStore currentStore, java.awt.Graphics2D g2d, int penObject)private voidsetStroke(java.awt.Graphics2D g2d, int penStyle, float penWidth, float scale)-
Methods inherited from class org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter
addObject, addObjectAt, getAttributedString, getCharacterIterator, getCharacterIterator, getImage, getImage, getImageDimension, setRecordStore
-
-
-
-
Field Detail
-
INPUT_BUFFER_SIZE
private static final int INPUT_BUFFER_SIZE
Size of the buffer used for reading input WMF files- See Also:
- Constant Field Values
-
INTEGER_0
private static final java.lang.Integer INTEGER_0
-
scale
private float scale
-
scaleX
private float scaleX
-
scaleY
private float scaleY
-
conv
private float conv
-
xOffset
private float xOffset
-
yOffset
private float yOffset
-
vpX
private float vpX
-
vpY
private float vpY
-
vpW
private float vpW
-
vpH
private float vpH
-
frgdColor
private java.awt.Color frgdColor
-
bkgdColor
private java.awt.Color bkgdColor
-
opaque
private boolean opaque
-
firstEffectivePaint
private transient boolean firstEffectivePaint
-
solid
private static java.awt.BasicStroke solid
-
textSolid
private static java.awt.BasicStroke textSolid
-
observer
private transient java.awt.image.ImageObserver observer
-
bufStream
private transient java.io.BufferedInputStream bufStream
-
-
Constructor Detail
-
WMFPainter
public WMFPainter(WMFRecordStore currentStore, float scale)
Basic constructor.- Parameters:
currentStore- where the WMF records are storedscale- the scale of the image
-
WMFPainter
public WMFPainter(WMFRecordStore currentStore, int xOffset, int yOffset, float scale)
Basic constructor.- Parameters:
scale- the scale of the imagecurrentStore- where the WMF records are storedxOffset- x value for offsetyOffset- y value for offset
-
-
Method Detail
-
paint
public void paint(java.awt.Graphics g)
Renders the WMF image(s).
-
getPaint
private java.awt.Paint getPaint(byte[] bit)
-
drawString
private void drawString(int flag, java.awt.Graphics2D g2d, java.text.AttributedCharacterIterator ati, float x, float y, java.awt.font.TextLayout layout, WMFFont wmfFont, int align)Draw an AttributedCharacterIterator taking into account the following characteristics. :- the orientation (escapement) of the WMF Font
- the aligment of the text
The other characteristics of the text, deriving from the WMF Font, must have been collected before to constitute the AttributedCharacterIterator.
-
fillTextBackground
private void fillTextBackground(int align, int flag, java.awt.Graphics2D g2d, float x, float y, float width, java.awt.font.TextLayout layout)
-
drawPolyPolygon
private void drawPolyPolygon(java.awt.Graphics2D g2d, java.util.List pols)Just to be consistent with PolyPolygon filling.
-
fillPolyPolygon
private void fillPolyPolygon(java.awt.Graphics2D g2d, java.util.List pols)Need to do this for POLYPOLYGON, because only GeneralPaths can handle complex WMF shapes.
-
setStroke
private void setStroke(java.awt.Graphics2D g2d, int penStyle, float penWidth, float scale)
-
setPenColor
private void setPenColor(WMFRecordStore currentStore, java.awt.Graphics2D g2d, int penObject)
-
getHorizontalAlignement
private int getHorizontalAlignement(int align)
-
setBrushPaint
private void setBrushPaint(WMFRecordStore currentStore, java.awt.Graphics2D g2d, int brushObject)
-
getStoredPaint
private java.awt.Paint getStoredPaint(WMFRecordStore currentStore, int object)
-
paint
private void paint(int brushObject, int penObject, java.awt.Shape shape, java.awt.Graphics2D g2d)Draw or / and fill the Shape, depending on the pen or brush Objects selected.
-
paintWithPen
private void paintWithPen(int penObject, java.awt.Shape shape, java.awt.Graphics2D g2d)Draw the Shape, depending on the pen or brush Objects selected.
-
getVerticalAlignmentValue
private float getVerticalAlignmentValue(java.awt.font.TextLayout layout, int vertAlign)
-
getRecordStore
public WMFRecordStore getRecordStore()
Returns the WMFRecordStore this WMFPainter renders- Overrides:
getRecordStorein classAbstractWMFPainter
-
-