libwmf-0.2.0 Tutorial 2: The IPA
Contents
#introIntroduction #typesTypes #ipafnrefIPA Function Reference #ipafnsIPA Functions #bitmapBitmap Functions #fnsOther Functions #guideGuidelines #compileCompiling - The Distribution Introduction
This is a combination of tutorial and reference guide for writing new device
layers for 
libwmf.
Since no two graphics interfaces are identical, the task of the 
IPA(the interface between the interpreter and the device layer) is to simplify the
task of translating the metafile drawing commands. (It cannot be denied that
there is still considerable room for improvement.)
When writing a new device layer you will need to include the following headers:
#include <libwmf/ipa.h>
#include <libwmf/defs.h>
The former includes the 
API declarations as well as the IPAdeclarations, while the latter defines metafile constants.
Types
  
#RGBwmfRGB | 
#BMPwmfBMP | 
#BrushwmfBrush | 
#PenwmfPen | 
#FontwmfFont | 
#DCwmfDC | 
#FloodwmfFlood_t | 
#DrawPixelwmfDrawPixel_t | 
#DrawArcwmfDrawArc_t | 
#DrawLinewmfDrawLine_t | 
#PolyLinewmfPolyLine_t | 
#DrawRectwmfDrawRectangle_t | 
#PolyRectwmfPolyRectangle_t | 
#BMPReadwmfBMP_Read_t | 
#BMPDrawwmfBMP_Draw_t | 
#ROPDrawwmfROP_Draw_t | 
#DrawTextwmfDrawText_t | 
#UserDatawmfUserData_t | 
#CharDrawerwmfCharDrawer wmfRGB typedef struct _wmfRGB wmfRGB;
struct _wmfRGB
{	unsigned char r;
	unsigned char g;
	unsigned char b;
};
wmfRGB describes a color, with r = g = b = 255 corresponding
to 
white and r = g = b = 0 corresponding to black.
wmfBMP typedef struct _wmfBMP wmfBMP;
struct _wmfBMP
{	U16 width;
	U16 height;
	void* data;
};
Container for a bitmap, of dimensions 
width and height.
If non-zero, 
data is a pointer to an internal representation of the
bitmap. The interpreter does not reference 
data and will not attempt
to draw a bitmap if 
data is zero; however, a bitmap brush pattern
may be set even though 
data is zero. (data=0 indicates
either that the device layer has no support for bitmaps or that the bitmap
is corrupt or unreadable.)
wmfBrush typedef struct _wmfBrush wmfBrush;
struct _wmfBrush
{	U16 lbStyle;
	U16 lbHatch;
	wmfRGB lbColor;
	wmfBMP bmp;
};
wmfBrush is one element of the current drawing context.
lbStyle is one of the following:
/* Brush Styles */
#define BS_SOLID            0
#define BS_NULL             1
#define BS_HOLLOW     BS_NULL
#define BS_HATCHED          2
#define BS_PATTERN          3
#define BS_INDEXED          4
#define BS_DIBPATTERN       5
#define BS_DIBPATTERNPT     6
#define BS_PATTERN8X8       7
#define BS_DIBPATTERN8X8    8
where 
BS_NULL indicates that no brush is set. If
lbStyle=BS_HATCHED then the brush has the pattern, specified by
lbHatch which is one of:
/* Hatch Styles */
#define HS_HORIZONTAL       0       /* ----- */
#define HS_VERTICAL         1       /* ||||| */
#define HS_FDIAGONAL        2       /* \\\\\ */
#define HS_BDIAGONAL        3       /* ///// */
#define HS_CROSS            4       /* +++++ */
#define HS_DIAGCROSS        5       /* xxxxx */
If 
lbStyle=BS_HATCHED or lbStyle=BS_SOLID then the foreground
color of the brush is 
lbColor. Otherwise, if the brush is a bitmap,
ensure that 
bmp.data is non-zero.
The following macros should be used to retrieve the above info.:
#include 
/* WMF_BRUSH_STYLE(wmfBrush* B) -> (U16) brush style
 * WMF_BRUSH_HATCH(wmfBrush* B) -> (U16) brush hatch style
 * 
 * WMF_BRUSH_COLOR(wmfBrush* B) -> (wmfRGB*) brush color
 * 
 * WMF_BRUSH_BITMAP(wmfBrush* B) -> (wmfBMP*) brush bitmap
 */
#define WMF_BRUSH_STYLE(B)  ((B)->lbStyle)
#define WMF_BRUSH_HATCH(B)  ((B)->lbHatch)
#define WMF_BRUSH_COLOR(B)  (&((B)->lbColor))
#define WMF_BRUSH_BITMAP(B) (&((B)->bmp))
wmfPen typedef struct _wmfPen wmfPen;
struct _wmfPen
{	U16 lopnStyle;
	double width;
	double height;
	wmfRGB lopnColor;
};
wmfPen is one element of the current drawing context. The nib has
dimensions 
width and height and color lopnColor.
lopnStyle contains style information on the line itself, on the ends,
on the joins, and on the type:
#define PS_STYLE_MASK       0x0000000F
#define PS_ENDCAP_MASK      0x00000F00
#define PS_JOIN_MASK        0x0000F000
#define PS_TYPE_MASK        0x000F0000
lopnStyle & PS_STYLE_MASK is one of:
#define PS_SOLID            0
#define PS_DASH             1       /* -------  */
#define PS_DOT              2       /* .......  */
#define PS_DASHDOT          3       /* _._._._  */
#define PS_DASHDOTDOT       4       /* _.._.._  */
#define PS_NULL             5
#define PS_INSIDEFRAME      6
#define PS_USERSTYLE        7
#define PS_ALTERNATE        8
where PS_NULL indicates that no pen has been set.
lopnStyle & PS_ENDCAP_MASK is one of:
#define PS_ENDCAP_ROUND     0x00000000
#define PS_ENDCAP_SQUARE    0x00000100
#define PS_ENDCAP_FLAT      0x00000200
and 
lopnStyle & PS_JOIN_MASK is one of:
#define PS_JOIN_ROUND       0x00000000
#define PS_JOIN_BEVEL       0x00001000
#define PS_JOIN_MITER       0x00002000
Finally, 
lopnStyle & PS_TYPE_MASK is one of:
#define PS_COSMETIC         0x00000000
#define PS_GEOMETRIC        0x00010000
The following macros should be used to retrieve the above info.:
#include 
/* WMF_PEN_STYLE(wmfPen* P)  -> (U16) pen style
 * WMF_PEN_ENDCAP(wmfPen* P) -> (U16) endcap style
 * WMF_PEN_JOIN(wmfPen* P)   -> (U16) join style
 * WMF_PEN_TYPE(wmfPen* P)   -> (U16) `type' of pen (??)
 * 
 * WMF_PEN_WIDTH(wmfPen* P)  -> (double) pen `width'  (thickness w.r.t. x-axis)
 * WMF_PEN_HEIGHT(wmfPen* P) -> (double) pen `height' (thickness w.r.t. y-axis)
 * 
 * WMF_PEN_COLOR(wmfPen* P) -> (wmfRGB*) pen color
 */
#define WMF_PEN_STYLE(P)  ((P)->lopnStyle & PS_STYLE_MASK)
#define WMF_PEN_ENDCAP(P) ((P)->lopnStyle & PS_ENDCAP_MASK)
#define WMF_PEN_JOIN(P)   ((P)->lopnStyle & PS_JOIN_MASK)
#define WMF_PEN_TYPE(P)   ((P)->lopnStyle & PS_TYPE_MASK)
#define WMF_PEN_WIDTH(P)  ((P)->width)
#define WMF_PEN_HEIGHT(P) ((P)->height)
#define WMF_PEN_COLOR(P)  (&((P)->lopnColor))
wmfFont typedef struct _wmfFont wmfFont;
struct _wmfFont
{	U16 lfHeight;
	U16 lfWidth;
	S16 lfEscapement;
	S16 lfOrientation;
	U16 lfWeight;
	U8 lfItalic;
	U8 lfUnderline;
	U8 lfStrikeOut;
	U8 lfCharSet;
	U8 lfOutPrecision;
	U8 lfClipPrecision;
	U8 lfQuality;
	U8 lfPitchAndFamily;
	char* lfFaceName;
	char* ps_name;
	FT_Face ft_face;
};
wmfFont is one element of the current drawing context. Of all of this,
the most important elements are 
ps_name (the postscript font name) and
ft_face, the freetype (2) font face for which bold and
italics have already been determined.
The following macros should be used to retrieve the above info.:
#include 
/* WMF_TEXT_ANGLE(wmfFont* F) -> (double) text angle in radians
 * 
 * WMF_TEXT_UNDERLINE(wmfFont* F) -> (U8) ?? whether to underline (?? how thick)
 * WMF_TEXT_STRIKEOUT(wmfFont* F) -> (U8) ?? whether to strikeout (?? how thick)
 * 
 * WMF_FONT_NAME(wmfFont* F)   -> (char*) font name supplied by metafile
 * WMF_FONT_PSNAME(wmfFont* F) -> (char*) font name to use in postscript output
 * WMF_FONT_FTFACE(wmfFont* F) -> (FT_Face) freetype(2) font face
 */
#define WMF_TEXT_ANGLE(F)     ((((double) (F)->lfEscapement) / 10) * M_PI / 180)
#define WMF_TEXT_UNDERLINE(F) ((F)->lfUnderline)
#define WMF_TEXT_STRIKEOUT(F) ((F)->lfStrikeOut)
#define WMF_FONT_NAME(F)   ((F)->lfFaceName)
#define WMF_FONT_PSNAME(F) ((F)->ps_name)
#define WMF_FONT_FTFACE(F) ((F)->ft_face)
wmfDC typedef struct _wmfDC wmfDC;
struct _wmfDC
{	void* userdata;
	wmfBrush* brush;
	wmfPen* pen;
	wmfFont* font;
	int key;     /* Is this used ?? */
	wmfDC* next; /* Is this used ?? */
	wmfRGB textcolor;
	wmfRGB bgcolor;
	U16 textalign;
	U16 bgmode;
	U16 polyfillmode;
	U16 charextra;
	U16 breakextra;
	U16 ROPmode;
	struct
	{	S32 Ox;
		S32 Oy;
		S32 width;
		S32 height;
	} Window;
	double pixel_width; /* Display pixel dimensions (inches) */
	double pixel_height;
	U16 map_mode;
	void* clip;
};
Still very much a work in progress, especially with regard to the drawing
context 
wmfDC; there is much in this structure that is (or should
be) irrelevant to the 
IPA.
See 
wmfBrush, wmfPen and wmfFont. textcolor is
the color to draw text, 
bgcolor is the background color (generally, as
well as with text) unless 
bgmode=TRANSPARENT, in which case there is
no background. 
bgmode is one of:
#define TRANSPARENT         1
#define OPAQUE              2
#define BKMODE_LAST         2
The following macros should be used to retrieve the above info.:
#include 
/* WMF_DC_BRUSH(wmfDC* C) -> (wmfBrush*) current brush
 * WMF_DC_PEN(wmfDC* C)   -> (wmfPen*)   current pen
 * WMF_DC_FONT(wmfDC* C)  -> (wmfFont*)  current font
 * 
 * WMF_DC_TEXTCOLOR(wmfDC* C)  -> (wmfRGB*) text color
 * WMF_DC_BACKGROUND(wmfDC* C) -> (wmfRGB*) background color
 * 
 * WMF_DC_OPAQUE(wmfDC* C) -> (U16) whether to fill opaque (non-zero if true)
 * 
 * WMF_DC_POLYFILL(wmfDC* C) -> (U16) how to fill polygons
 * 
 * WMF_DC_ROP(wmfDC* C) -> (U16) ROP mode
 */
#define WMF_DC_BRUSH(C)      ((C)->brush)
#define WMF_DC_PEN(C)        ((C)->pen)
#define WMF_DC_FONT(C)       ((C)->font)
#define WMF_DC_TEXTCOLOR(C)  (&((C)->textcolor))
#define WMF_DC_BACKGROUND(C) (&((C)->bgcolor))
#define WMF_DC_OPAQUE(C)     ((C)->bgmode - 1)
#define WMF_DC_POLYFILL(C)   ((C)->polyfillmode)
#define WMF_DC_ROP(C)        ((C)->ROPmode)
wmfFlood_t typedef struct _wmfFlood_t wmfFlood_t;
struct _wmfFlood_t
{	wmfDC* dc;
	wmfD_Coord pt;
	wmfRGB color;
	U16 type;
	double pixel_width;
	double pixel_height;
};
Flood-fill region with color 
color, starting at point pt.
Since this is almost certainly not a vector operation, the pixel width and
height are given (and are probably best ignored...). 
type is one
of:
#define  FLOODFILLBORDER    0
#define  FLOODFILLSURFACE   1
wmfDrawPixel_t typedef struct _wmfDrawPixel_t wmfDrawPixel_t;
struct _wmfDrawPixel_t
{	wmfDC* dc;
	wmfD_Coord pt;
	wmfRGB color;
	double pixel_width;
	double pixel_height;
};
Set pixel at point 
pt to color color. The pixel width and
height are given.
wmfDrawArc_t typedef struct _wmfDrawArc_t wmfDrawArc_t;
struct _wmfDrawArc_t
{	wmfDC* dc;
	wmfD_Coord TL;
	wmfD_Coord BR;
	wmfD_Coord start; /* draw_ellipse: (ignored) */
	wmfD_Coord end;
};
Draw a complete or partial ellipse. 
TL and BR are the
coordinates of the top left and bottom right of the ellipse's bounding box
respectively. If incomplete, then 
start and end give the
start and end coordinates of the arc.
wmfDrawLine_t typedef struct _wmfDrawLine_t wmfDrawLine_t;
struct _wmfDrawLine_t
{	wmfDC* dc;
	wmfD_Coord from;
	wmfD_Coord to;
};
Draw line from point 
from to point to.
wmfPolyLine_t typedef struct _wmfPolyLine_t wmfPolyLine_t;
struct _wmfPolyLine_t
{	wmfDC* dc;
	wmfD_Coord* pt;
	U16 count;
};
An array (of length 
count) of points pt[]. This may be used
to describe polygons as well as line sequences.
wmfDrawRectangle_t typedef struct _wmfDrawRectangle_t wmfDrawRectangle_t;
struct _wmfDrawRectangle_t
{	wmfDC* dc;
	wmfD_Coord TL;
	wmfD_Coord BR;
	float width; /* draw_rectangle: axes of corner ellipses; zero if un-rounded */
	float height;
};
A rectangle, possibly with rounded corners - in which case 
width and
height give the elliptic axes of the rectangle's corners.
wmfPolyRectangle_t typedef struct _wmfPolyRectangle_t wmfPolyRectangle_t;
struct _wmfPolyRectangle_t
{	wmfDC* dc;
	wmfD_Coord* TL; /* region_frame & region_paint: TL[count],BR[count] give the */
	wmfD_Coord* BR; /* final `extents'... */
	unsigned int count;
	float width;  /* region_frame: border thickness; zero otherwise */
	float height;
};
Used by region and clip calls, 
wmfPolyRectangle_t is used to describe
multiple rectangles, whose top left and bottom right corners are given by the
TL and BR arrays respectively. These arrays are of length
count in the case of clip calls, and of length count + 1 in
the case of the region calls, the extra element containing the overall bounding
box (the region extents). In the case of 
region_frame, widthand 
height give the thickness of the frame.
wmfBMP_Read_t typedef struct _wmfBMP_Read_t wmfBMP_Read_t;
struct _wmfBMP_Read_t          /* Two means available for accessing BMP image:        */
{	long offset;           /* (1) position in source file of start of BMP;        *
                                * use API->bbuf.seek to set pos(ition), etc.          */
	long length;           /* (2) buffer of length length containing image of BMP */
	unsigned char* buffer;
	U16 width;  /* WMF player may preset these values; zero otherwise. */
	U16 height; /* Use caution - may be buggy... ?? [TODO]             */
	wmfBMP bmp;
};
There are two ways to read a bitmap presented by 
libwmf: the first is
to read it directly from the input stream using the internal stream functions:
/* Macro-wrappers for stream functions:
 * (int)  WMF_READ ((wmfAPI*) API)                 - returns unsigned char cast to int, or EOF
 * (int)  WMF_SEEK ((wmfAPI*) API,(long) position) - returns (-1) on error, else 0
 * (long) WMF_TELL ((wmfAPI*) API)                 - returns (-1) on error, else current position
 */
where the bitmap starts at offset 
offset; the second (which is
preferred) is to use the buffer 
buffer of length length.
To complicate matters, the bitmap's data may be truncated so that the bitmap's
header is incorrect - 
width and height give the realdimensions of the bitmap.
The bitmap's width and height should be entered into 
bmp (see
#BMPwmfBMP  above) as well as a pointer to the bitmap data (which
can be in any format you choose; the library does not need to know).
wmfBMP_Draw_t typedef struct _wmfBMP_Draw_t wmfBMP_Draw_t;
struct _wmfBMP_Draw_t
{	wmfDC* dc;
	wmfD_Coord pt;
	wmfBMP bmp;
	U32 type;
	struct
	{	U16 x;
		U16 y;
		U16 w;
		U16 h;
	} crop;
	double pixel_width;
	double pixel_height;
};
In contrast to earlier versions, 
libwmf no longer makes any attempt to
crop or scale the bitmap. Instead the crop data are presented to the device
layer to use as it sees fit, and the pixel width and height as well. The bitmap
referenced by 
bmp (see #BMPwmfBMP  above) is to be drawn
at point 
pt.
TODO: info on type
wmfROP_Draw_t typedef struct _wmfROP_Draw_t wmfROP_Draw_t;
struct _wmfROP_Draw_t
{	wmfDC* dc;
	wmfD_Coord TL;
	wmfD_Coord BR;
	U32 ROP;
	double pixel_width;
	double pixel_height;
};
TODO:
wmfDrawText_t typedef struct _wmfDrawText_t wmfDrawText_t;
struct _wmfDrawText_t
{	wmfDC* dc;
	wmfD_Coord pt;
	wmfD_Coord TL; /* Clip zone */
	wmfD_Coord BR;
	struct /* An estimated surround zone */
	{	wmfD_Coord TL;
		wmfD_Coord TR;
		wmfD_Coord BL;
		wmfD_Coord BR;
	} bbox;
	char* str;
	U16 flags;
	double font_height;
	double font_ratio;  /* width to height ratio */
};
Fonts and text are 
triiicky! Fortunately libwmf tries to do
most of the work. As such text justification is taken care of by the
interpreter, and fonts (
bold, italic, etc.) are selected
elsewhere. The emphasis with 
wmfDrawText_t is therefore the rendering
of text.
The text can be assumed to be left-justified, starting at point 
pt.
TL and BR are the corners of a clip rectangle. bboxgives four corners of rectangle - an 
estimate of the background zone.
str is the text to draw; font_height is the height of the
font and 
font_ratio is how much to stretch the font width-wise. The
values for 
flags are:
#define ETO_OPAQUE          0x0002
#define ETO_CLIPPED         0x0004
#define ETO_GLYPH_INDEX     0x0010
#define ETO_RTLREADING      0x0080
wmfUserData_t typedef struct _wmfUserData_t wmfUserData_t;
struct _wmfUserData_t	/* TODO: Need to be careful with usage here; not all these are set by the player! */
{	wmfDC* dc;          /* dc is guaranteed */
	void* data;         /* data also, except for init */
};
Redundant; may be removed at some point...
wmfCharDrawer typedef void (*wmfCharDrawer) (wmfAPI*,wmfDrawText_t*);
IPA Function Reference
Let us assume that you are writing a device layer called 
mydev, then the
first requirement is an initialization function:
#include <libwmf/ipa.h>
#include <libwmf/defs.h>
#include <libwmf/
mydev.h>
void wmf_
mydev_function (wmfAPI* API)
{	wmfFunctionReference* FR = (wmfFunctionReference*) API->function_reference;
	/* */
The function reference has the following definition:
typedef struct _wmfFunctionReference wmfFunctionReference;
struct _wmfFunctionReference
{	void (*device_open) (wmfAPI*);
	void (*device_close) (wmfAPI*);
	void (*device_begin) (wmfAPI*);
	void (*device_end) (wmfAPI*);
	void (*flood_interior) (wmfAPI*,wmfFlood_t*);
	void (*flood_exterior) (wmfAPI*,wmfFlood_t*);
	void (*draw_pixel) (wmfAPI*,wmfDrawPixel_t*);
	void (*draw_pie) (wmfAPI*,wmfDrawArc_t*);
	void (*draw_chord) (wmfAPI*,wmfDrawArc_t*);
	void (*draw_arc) (wmfAPI*,wmfDrawArc_t*);
	void (*draw_ellipse) (wmfAPI*,wmfDrawArc_t*);
	void (*draw_line) (wmfAPI*,wmfDrawLine_t*);
	void (*poly_line) (wmfAPI*,wmfPolyLine_t*);
	void (*draw_polygon) (wmfAPI*,wmfPolyLine_t*);
	void (*draw_rectangle) (wmfAPI*,wmfDrawRectangle_t*);
	void (*rop_draw) (wmfAPI*,wmfROP_Draw_t*);
	void (*bmp_draw) (wmfAPI*,wmfBMP_Draw_t*);
	void (*bmp_read) (wmfAPI*,wmfBMP_Read_t*);
	void (*bmp_free) (wmfAPI*,wmfBMP*);
	void (*draw_text) (wmfAPI*,wmfDrawText_t*);
	void (*udata_init) (wmfAPI*,wmfUserData_t*);
	void (*udata_copy) (wmfAPI*,wmfUserData_t*);
	void (*udata_set) (wmfAPI*,wmfUserData_t*);
	void (*udata_free) (wmfAPI*,wmfUserData_t*);
	void (*region_frame) (wmfAPI*,wmfPolyRectangle_t*);
	void (*region_paint) (wmfAPI*,wmfPolyRectangle_t*);
	void (*region_clip) (wmfAPI*,wmfPolyRectangle_t*);
};
The initialization function has two purposes, the first being to establish the
links that create the 
IPA by pointing the function reference variables
to your own drawing functions:
#include <libwmf/ipa.h>
#include <libwmf/defs.h>
#include <libwmf/
mydev.h>
void wmf_
mydev_function (wmfAPI* API)
{	wmfFunctionReference* FR = (wmfFunctionReference*) API->function_reference;
	FR->device_open  = wmf_
mydev_device_open;
	FR->device_close = wmf_
mydev_device_close;
	FR->device_begin = wmf_
mydev_device_begin;
	FR->device_end   = wmf_
mydev_device_end;
	/* etc. */
	/* */
}
void wmf_
mydev_device_open (wmfAPI* API)
{	/* */
}
/* etc. */
The second purpose of the initialization function is to allocate the device's
data structure, set the device parameters to default values if necessary, and
then to attach the data to the 
API->device_data hook.
/* */
typedef struct _wmf_
mydev_t wmf_mydev_t;
struct _wmf_
mydev_t
{	/* */
	unsigned long flags;
}
void wmf_
mydev_function (wmfAPI* API)
{	wmfFunctionReference* FR = (wmfFunctionReference*) API->function_reference;
	wmf_
mydev_t* ddata = 0;
	FR->device_open  = wmf_
mydev_device_open;
	/* etc. */
	API->device_data = wmf_malloc (API,sizeof (wmf_
mydev_t));
	if (API->err != wmf_E_None) return; /* insufficient memory? */
	ddata = (wmf_
mydev_t*) API->device_data;
	/* */
	ddata->flags = 0;
}
/* */
IPA Functions
The 
IPA functions are called by wmf_play (), the only exception
being 
device_close which is called by wmf_api_destroy () -
and then only if 
device_open has been called by wmf_play ().
device_open is called the first time (and only the first time)
wmf_play () is called, and is the very first IPA function to be
called, just as 
device_close will be the very last.
At the beginning of each 
play cycle (i.e., each call to
wmf_play ()) device_begin is called (after
device_open if it is the first cycle), and at the end of each cycle
device_end is called. The metafile graphics use other IPAfunctions.
device_open, device_begin, device_end and
device_close should be written so that wmf_play () can
be called repeatedly.
The names of the functions are not important. The generic names are used below:
  
#devopendevice_open | 
#devclosedevice_close | 
#devbegindevice_begin | 
#devenddevice_end | 
#floodintflood_interior | 
#floodextflood_exterior | 
#dpixeldraw_pixel | 
#dpiedraw_pie | 
#dchorddraw_chord | 
#darcdraw_arc | 
#dellipsedraw_ellipse | 
#dlinedraw_line | 
#plinepoly_line | 
#dpolydraw_polygon | 
#drectdraw_rectangle | 
#ropdrawrop_draw | 
#bmpdrawbmp_draw | 
#bmpreadbmp_read | 
#bmpfreebmp_free | 
#dtextdraw_text | 
#uinitudata_init | 
#ucopyudata_copy | 
#usetudata_set | 
#ufreeudata_free | 
#rframeregion_frame | 
#rpaintregion_paint | 
#rclipregion_clip device_open void device_open (wmfAPI*);
device_open is the very first IPA function to be called. It is
called only once, the first time 
wmf_play () is called.
device_close void device_close (wmfAPI*);
device_close is the very last IPA function to be called. It is
called by 
wmf_api_destroy (), and only if device_open has
been called earlier.
device_begin void device_begin (wmfAPI*);
device_begin is the first IPA function called from
wmf_play () (with the exception of device_open the first time
wmf_play () is called).
device_end void device_end (wmfAPI*);
device_end is the last IPA function called from
wmf_play ().
flood_interior void flood_interior (wmfAPI*,
#FloodwmfFlood_t *);
flood_exterior void flood_exterior (wmfAPI*,
#FloodwmfFlood_t *);
draw_pixel void draw_pixel (wmfAPI*,
#DrawPixelwmfDrawPixel_t *);
draw_pie void draw_pie (wmfAPI*,
#DrawArcwmfDrawArc_t *);
draw_chord void draw_chord (wmfAPI*,
#DrawArcwmfDrawArc_t *);
draw_arc void draw_arc (wmfAPI*,
#DrawArcwmfDrawArc_t *);
draw_ellipse void draw_ellipse (wmfAPI*,
#DrawArcwmfDrawArc_t *);
draw_line void draw_line (wmfAPI*,
#DrawLinewmfDrawLine_t *);
poly_line void poly_line (wmfAPI*,
#PolyLinewmfPolyLine_t *);
draw_polygon void draw_polygon (wmfAPI*,
#PolyLinewmfPolyLine_t *);
draw_rectangle void draw_rectangle (wmfAPI*,
#DrawRectwmfDrawRectangle_t *);
rop_draw void rop_draw (wmfAPI*,
#ROPDrawwmfROP_Draw_t *);
TODO:
bmp_draw void bmp_draw (wmfAPI*,
#BMPDrawwmfBMP_Draw_t *);
Note: Unless you're feeling masochistic and want to write, or re-write,
your own suite of functions for the reading, writing and general manipulation
of bitmaps, you should defer this to 
libwmf's built-in support which
is adapted from 
ImageMagick's excellent BMP coder.
See section on bitmaps below.
bmp_read void bmp_read (wmfAPI*,
#BMPReadwmfBMP_Read_t *);
Note: Unless you're feeling masochistic and want to write, or re-write,
your own suite of functions for the reading, writing and general manipulation
of bitmaps, you should defer this to 
libwmf's built-in support which
is adapted from 
ImageMagick's excellent BMP coder.
void bmp_read (wmfAPI* API,
#BMPReadwmfBMP_Read_t * bmp_read)
{	wmf_ipa_bmp_read (API,bmp_read);
}
bmp_free void bmp_free (wmfAPI*,
#BMPwmfBMP *);
Note: Unless you're feeling masochistic and want to write, or re-write,
your own suite of functions for the reading, writing and general manipulation
of bitmaps, you should defer this to 
libwmf's built-in support which
is adapted from 
ImageMagick's excellent BMP coder.
void bmp_free (wmfAPI* API,
#BMPwmfBMP * bmp)
{	wmf_ipa_bmp_free (API,bmp);
}
draw_text void draw_text (wmfAPI*,
#DrawTextwmfDrawText_t *);
If desired, strings can be decomposed into individual chars using
wmf_ipa_draw_text (). Best to see source for the various device layers
in 
libwmf.
udata_init void udata_init (wmfAPI*,
#UserDatawmfUserData_t *);
Redundant; may be removed at some point...
udata_copy void udata_copy (wmfAPI*,
#UserDatawmfUserData_t *);
Redundant; may be removed at some point...
udata_set void udata_set (wmfAPI*,
#UserDatawmfUserData_t *);
Redundant; may be removed at some point...
udata_free void udata_free (wmfAPI*,
#UserDatawmfUserData_t *);
Redundant; may be removed at some point...
region_frame void region_frame (wmfAPI*,
#PolyRectwmfPolyRectangle_t *);
region_paint void region_paint (wmfAPI*,
#PolyRectwmfPolyRectangle_t *);
region_clip void region_clip (wmfAPI*,
#PolyRectwmfPolyRectangle_t *);
If the number of clip rectangles is zero, the current clip region should be
unset.
Bitmap Functions
Other Functions
Guidelines
Compiling - The Distribution
The section applies only if you are working on the 
libwmf sources.
The build system uses 
automake and autoconf. If any changes are
made to any of the various 
Makefile.am files, or to
configure.in or libwmf.m4, then the build system will need to
be updated. Change to the top source directory (containing
configure.in and libwmf.m4) and:
# aclocal
# automake
# autoheader
# autoconf
# date > stamp-h.in
When adding a new device layer, 
include/libwmf/Makefile.am and
src/ipa/Makefile.am will need to be modifiled. Source files
(
src/ipa/new.c) and installing header files
(
include/libwmf/new.h) do not need to be added to the distribution,
but other headers (
src/ipa/new.h & src/ipa/new/*.h) will.
Copyright 2001 wvWare/libwmf 
http://www.wvware.com/http://www.wvware.com/ 