Class WMFHeaderProperties

java.lang.Object
org.apache.batik.transcoder.wmf.tosvg.AbstractWMFReader
org.apache.batik.transcoder.wmf.tosvg.WMFHeaderProperties

public class WMFHeaderProperties extends AbstractWMFReader
This class holds simple properties about a WMF Metafile. It can be used whenever general information must be retrieved about this file.
  • Field Details

  • Constructor Details

    • WMFHeaderProperties

      public WMFHeaderProperties(File wmffile) throws IOException
      Creates a new WMFHeaderProperties, and sets the associated WMF File.
      Parameters:
      wmffile - the WMF Metafile
      Throws:
      IOException
    • WMFHeaderProperties

      public WMFHeaderProperties()
      Creates a new WMFHeaderProperties, with no associated file.
  • Method Details

    • closeResource

      public void closeResource()
    • setFile

      public void setFile(File wmffile) throws IOException
      Creates the properties associated file.
      Throws:
      IOException
    • reset

      public void reset()
      Resets the internal storage and viewport coordinates.
      Specified by:
      reset in class AbstractWMFReader
    • getStream

      public DataInputStream getStream()
      Get the associated stream.
    • readRecords

      protected boolean readRecords(DataInputStream is) throws IOException
      Description copied from class: AbstractWMFReader
      Read this InputStream records. The aldus placeable header have already been read (see AbstractWMFReader.read(DataInputStream)). The behavior of this method is left to the subclass. Each Metafile record is composed of :
      • the size of the Record in int (32 bits)
      • the function ID for the Record on a short word (16 bits)
      • the function parameters, according to the WMF Metafile specification. the remaining size in short words (16 bits) for the parameters is equal to the total size for the record minus 3 short words (= 16 + 32 bits)

      Example :

      while (functionId > 0) {
              recSize = readInt( is );
              // Subtract size in 16-bit words of recSize and functionId;
              recSize -= 3;
              functionId = readShort( is );
              if ( functionId <= 0 )
                break;
              switch ( functionId ) {
                case WMFConstants.<a WMF function ID> {
                  do something when this function is encountered
                }
                break;
      
                default:
                   for ( int j = 0; j < recSize; j++ )
                     readShort(is);
                break;
       
      Specified by:
      readRecords in class AbstractWMFReader
      Throws:
      IOException
      See Also:
    • getWidthBoundsPixels

      public int getWidthBoundsPixels()
      Returns:
      the width of the Rectangle bounding the figures enclosed in the Metafile, in pixels
    • getHeightBoundsPixels

      public int getHeightBoundsPixels()
      Returns:
      the height of the Rectangle bounding the figures enclosed in the Metafile, in pixels.
    • getWidthBoundsUnits

      public int getWidthBoundsUnits()
      Returns:
      the width of the Rectangle bounding the figures enclosed in the Metafile, in Metafile Units.
    • getHeightBoundsUnits

      public int getHeightBoundsUnits()
      Returns:
      the height of the Rectangle bounding the figures enclosed in the Metafile in Metafile Units.
    • getXOffset

      public int getXOffset()
      Returns:
      the X offset of the Rectangle bounding the figures enclosed in the Metafile.
    • getYOffset

      public int getYOffset()
      Returns:
      the Y offset of the Rectangle bounding the figures enclosed in the Metafile.