Class 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 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 stored
        scale - the scale of the image
      • WMFPainter

        public WMFPainter​(WMFRecordStore currentStore,
                          int xOffset,
                          int yOffset,
                          float scale)
        Basic constructor.
        Parameters:
        scale - the scale of the image
        currentStore - where the WMF records are stored
        xOffset - x value for offset
        yOffset - 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)