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 a Graphics object.
Version:
$Id: WMFPainter.java 1831630 2018-05-15 12:56:55Z ssteiner $
  • Field Details

    • INPUT_BUFFER_SIZE

      private static final int INPUT_BUFFER_SIZE
      Size of the buffer used for reading input WMF files
      See Also:
    • INTEGER_0

      private static final 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 Color frgdColor
    • bkgdColor

      private Color bkgdColor
    • opaque

      private boolean opaque
    • firstEffectivePaint

      private transient boolean firstEffectivePaint
    • solid

      private static BasicStroke solid
    • textSolid

      private static BasicStroke textSolid
    • observer

      private transient ImageObserver observer
    • bufStream

      private transient BufferedInputStream bufStream
  • Constructor Details

    • WMFPainter

      public WMFPainter(WMFRecordStore currentStore, float scale)
      Basic constructor.
      Parameters:
      currentStore - where the WMF records are stored
      scale - the scale of the image
    • WMFPainter

      public WMFPainter(WMFRecordStore currentStore, int xOffset, int yOffset, float scale)
      Basic constructor.
      Parameters:
      currentStore - where the WMF records are stored
      xOffset - x value for offset
      yOffset - y value for offset
      scale - the scale of the image
  • Method Details

    • paint

      public void paint(Graphics g)
      Renders the WMF image(s).
    • getPaint

      private Paint getPaint(byte[] bit)
    • drawString

      private void drawString(int flag, Graphics2D g2d, AttributedCharacterIterator ati, float x, float y, 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, Graphics2D g2d, float x, float y, float width, TextLayout layout)
    • drawPolyPolygon

      private void drawPolyPolygon(Graphics2D g2d, List pols)
      Just to be consistent with PolyPolygon filling.
    • fillPolyPolygon

      private void fillPolyPolygon(Graphics2D g2d, List pols)
      Need to do this for POLYPOLYGON, because only GeneralPaths can handle complex WMF shapes.
    • setStroke

      private void setStroke(Graphics2D g2d, int penStyle, float penWidth, float scale)
    • setPenColor

      private void setPenColor(WMFRecordStore currentStore, Graphics2D g2d, int penObject)
    • getHorizontalAlignement

      private int getHorizontalAlignement(int align)
    • setBrushPaint

      private void setBrushPaint(WMFRecordStore currentStore, Graphics2D g2d, int brushObject)
    • getStoredPaint

      private Paint getStoredPaint(WMFRecordStore currentStore, int object)
    • paint

      private void paint(int brushObject, int penObject, Shape shape, Graphics2D g2d)
      Draw or / and fill the Shape, depending on the pen or brush Objects selected.
    • paintWithPen

      private void paintWithPen(int penObject, Shape shape, Graphics2D g2d)
      Draw the Shape, depending on the pen or brush Objects selected.
    • getVerticalAlignmentValue

      private float getVerticalAlignmentValue(TextLayout layout, int vertAlign)
    • getRecordStore

      public WMFRecordStore getRecordStore()
      Returns the WMFRecordStore this WMFPainter renders
      Overrides:
      getRecordStore in class AbstractWMFPainter