piet.jonas.com

WMFWriter

Home News Example Features Download Usage


 WMFViewer 

 WMF2Viewer 


 JSF FormBuilder 

Features

The WMFWriter package can be used to write standard 16 Bit Windows Metafiles (compatible with Windows 3.1, Win9x, WinNT, Win2000, WinXP).

The WMFGraphics2D class can be used as a standard java.awt.Graphics2D object with all Java2 JDKs (1.2-5.0). It implements almost all Graphics2D methods except:
 

      • copyArea

      • setXORMode

      • setPaintMode


which are not supported in a Windows Metafile (these methods write an error message to System.err).
All important features of the Java 2D system are supported except Composite objects. This means the WMF keeps all drawing attributes like complex line styles, fill patterns, odd shaped clippings etc. Due to the limitations of the Windows GDI using these features can lead to larger WMF because some of them have to be reproduced by bitmaps or large polygons. The WMFGraphics2D class has methods to control the WMF creation process by either creating smaller and fast WMF which can have a lightly different appearance or fully compatible but larger WMF.

The WMFGraphics class can be used as a normal java.awt.Graphics object with all JDKs (1.0-5.0). It implements almost all Graphics methods except:
 

      • copyArea

      • setXORMode

      • setPaintMode


which are not supported in a Windows Metafile. These methods write an error message to System.err. Most drawing routines are mapped directly to their Windows GDI counterparts which produces small and fast WMF. In addition the WMFGraphics class provides special methods to change the line thickness, line style, fill pattern (bitmap or hatched) and the font rotation.

The WMF class implements the most important GDI command which can be used in a Windows 3.1 Metafile. It provides methods to write a Metafile to a standard java.io.OutputStream object with the standard Windows Metafile header or the Placeable Metafile header (contains additional size information compared to the standard header). It supports the following GDI commands:
 

      • selectObject

      • deleteObject

      • createPenIndirect

      • createBrushIndirect

      • createPatternBrush

      • createFontIndirect

      • setWindowOrg

      • setWindowExt

      • offsetWindowOrg

      • scaleWindowExt

      • setViewportOrg

      • setViewportExt

      • offsetViewportOrg

      • scaleViewportExt

      • setBKColor

      • setBKMode

      • setMapMode

      • setPolyFillMode

      • setROP2

      • setStretchBltMode

      • setTextAlign

      • setTextColor

      • setTextCharacterExtra

      • setTextJustification

      • moveTo

      • lineTo

      • arc

      • chord

      • pie

      • rectangle

      • ellipse

      • roundRect

      • polygon

      • polyline

      • polypolygon

      • intersectClipRect

      • setClipRgn

      • textOut

      • extTextOut

      • escape

      • setPixel

      • stretchBlt

      • bitBlt

      • patBlt


The necessary GDI constants e.g. for the line styles are defined in the WMF class as well.





Piet Jonas