Main Page Alphabetical List Data Structures File List Data Fields Globals

# canvas.h File Reference

## Typedefs

typedef void * | wmfCanvas
typedef enum _wmf_canvas_arc_t | wmf_canvas_arc_t

## Enumerations

enum | _wmf_canvas_arc_t { wmf_CA_open = 0, wmf_CA_chord, wmf_CA_pie }

## Functions

wmfCanvas * | wmf_canvas (wmfAPI *, unsigned short, unsigned short, unsigned short)
unsigned char * | wmf_canvas_done (wmfAPI *, wmfCanvas *, unsigned char **, unsigned long *)
int | wmf_canvas_set_pen (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short, wmfRGB)
int | wmf_canvas_set_brush (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, wmfRGB)
int | wmf_canvas_set_font (wmfAPI *, wmfCanvas *, const char *, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short)
int | wmf_canvas_set_polyfill (wmfAPI *, wmfCanvas *, unsigned short)
int | wmf_canvas_set_background (wmfAPI *, wmfCanvas *, unsigned short)
int | wmf_canvas_set_bgcolor (wmfAPI *, wmfCanvas *, wmfRGB)
int | wmf_canvas_set_textcolor (wmfAPI *, wmfCanvas *, wmfRGB)
int | wmf_canvas_line (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short)
int | wmf_canvas_roundrect (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short)
int | wmf_canvas_rect (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short)
int | wmf_canvas_ellipse (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short)
int | wmf_canvas_arc (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, wmf_canvas_arc_t)
int | wmf_canvas_polyline (wmfAPI *, wmfCanvas *, unsigned short *, unsigned short *, unsigned short)
int | wmf_canvas_polygon (wmfAPI *, wmfCanvas *, unsigned short *, unsigned short *, unsigned short)
int | wmf_canvas_polygons (wmfAPI *, wmfCanvas *, unsigned short, unsigned short **, unsigned short **, unsigned short *)
int | wmf_canvas_text (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, const char *)
int | wmf_canvas_bitmap (wmfAPI *, wmfCanvas *, unsigned short, unsigned short, unsigned short, unsigned short, const unsigned char *, unsigned long)

## Typedef Documentation

typedef enum _wmf_canvas_arc_t wmf_canvas_arc_t

| wmf_canvas_arc_t is the (enumeration) type used to distinguish arc type.

typedef void* wmfCanvas

## Enumeration Type Documentation

enum _wmf_canvas_arc_t

wmf_canvas_arc_t is the (enumeration) type used to distinguish arc type.

Enumeration values:

  wmf_CA_open | drawn arc segment (no fill)
  wmf_CA_chord | start & end of arc joined together
  wmf_CA_pie | start & end of arc joined to centre

## Function Documentation

wmfCanvas* wmf_canvas | ( | wmfAPI * | API,
|  | unsigned short | width,
|  | unsigned short | height,
|  | unsigned short | dpi
| ) |

Get a handle for creating a new metafile.

Parameters:

  API | the API handle
  width | width in 'dots' (a.k.a. 'twips'?)
  height | height in 'dots' (a.k.a. 'twips'?)
  dpi | dots per inch: one of 1440, 2880, 720, or 360

In case you want to use simple drawing routines to create your own metafile; all drawing commands expect a wmfCanvas handle as well as the API handle.

Returns:
  Returns 0 on failure.

int wmf_canvas_arc | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | left,
|  | unsigned short | top,
|  | unsigned short | right,
|  | unsigned short | bottom,
|  | unsigned short | x1,
|  | unsigned short | y1,
|  | unsigned short | x2,
|  | unsigned short | y2,
|  | wmf_canvas_arc_t | type
| ) |

Draw an arc, open or fill as chord or pie.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  left | lower x-coordinate
  top | lower y-coordinate
  right | upper x-coordinate
  bottom | upper y-coordinate
  x1 | x-coordinate of start of arc
  y1 | y-coordinate of start of arc
  x2 | x-coordinate of end of arc
  y2 | y-coordinate of end of arc
  type | arc type (open, chord or pie)

Draw an arc in the given bounding box, from (x1,y1) to (x2,y2). Coordinate origin is at the top-left, y increasing down.

Returns:
  Returns 0 on success.

int wmf_canvas_bitmap | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | x,
|  | unsigned short | y,
|  | unsigned short | width,
|  | unsigned short | height,
|  | const unsigned char * | buffer,
|  | unsigned long | length
| ) |

Place a bitmap.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  x | x-coordinate of bitmap
  y | y-coordinate of bitmap
  width | (scaled) width of bitmap
  height | (scaled) height of bitmap
  buffer | buffer containing bitmap
  length | length of buffer

Place a bitmap.

Returns:
  Returns 0 on success.

unsigned char* wmf_canvas_done | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned char ** | buffer,
|  | unsigned long * | length
| ) |

Last command when creating a new metafile; returns the metafile you have drawn.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  buffer | metafile buffer return
  length | metafile length return

Cleans up memory etc. associated with the canvas process, except of course for the new metafile itself which gets returned.

Returns:
  Returns 0 on failure, *buffer on success

int wmf_canvas_ellipse | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | left,
|  | unsigned short | top,
|  | unsigned short | right,
|  | unsigned short | bottom
| ) |

Draw an ellipse.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  left | lower x-coordinate
  top | lower y-coordinate
  right | upper x-coordinate
  bottom | upper y-coordinate

Draw an ellipse in the given bounding box. Coordinate origin is at the top-left, y increasing down.

Returns:
  Returns 0 on success.

int wmf_canvas_line | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | x1,
|  | unsigned short | y1,
|  | unsigned short | x2,
|  | unsigned short | y2
| ) |

Draw a line.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  x1 | x-coordinate of start point
  y1 | y-coordinate of start point
  x2 | x-coordinate of end point
  y2 | y-coordinate of end point

Draw line from (x1,y1) to (x2,y2).

Returns:
  Returns 0 on success.

int wmf_canvas_polygon | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short * | x,
|  | unsigned short * | y,
|  | unsigned short | N
| ) |

Draw a polygon.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  x | array of N x-coordinates
  y | array of N y-coordinates
  N | number of points of polygon

Draw a polygon.

Returns:
  Returns 0 on success.

int wmf_canvas_polygons | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | count,
|  | unsigned short ** | x,
|  | unsigned short ** | y,
|  | unsigned short * | N
| ) |

Draw a set of polygons.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  count | number of polygons [i = 0..count-1]
  x | x[i] is array of N x-coordinates in ith polygon
  y | y[i] is array of N y-coordinates in ith polygon
  N | N[i] is number of points of ith polygon

Draw a set of polygons.

Returns:
  Returns 0 on success.

int wmf_canvas_polyline | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short * | x,
|  | unsigned short * | y,
|  | unsigned short | N
| ) |

Draw a line connecting a sequence of points.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  x | array of N x-coordinates
  y | array of N y-coordinates
  N | number of points on line

Draw a line connecting a sequence of points.

Returns:
  Returns 0 on success.

int wmf_canvas_rect | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | left,
|  | unsigned short | top,
|  | unsigned short | right,
|  | unsigned short | bottom
| ) |

Draw a rectangle.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  left | lower x-coordinate
  top | lower y-coordinate
  right | upper x-coordinate
  bottom | upper y-coordinate

Draw a rectangle. Coordinate origin is at the top-left, y increasing down.

Returns:
  Returns 0 on success.

int wmf_canvas_roundrect | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | left,
|  | unsigned short | top,
|  | unsigned short | right,
|  | unsigned short | bottom,
|  | unsigned short | rx,
|  | unsigned short | ry
| ) |

Draw a rounded rectangle.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  left | lower x-coordinate
  top | lower y-coordinate
  right | upper x-coordinate
  bottom | upper y-coordinate
  rx | x-axis of corner ellipse
  ry | y-axis of corner ellipse

Draw a rounded rectangle. Coordinate origin is at the top-left, y increasing down.

Returns:
  Returns 0 on success.

int wmf_canvas_set_background | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | mode
| ) |

Set background mode.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  mode | one of TRANSPARENT or OPAQUE

Set background mode.

Returns:
  Returns 0 on success.

int wmf_canvas_set_bgcolor | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | wmfRGB | color
| ) |

Set background color.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  color | background color

Set background color.

Returns:
  Returns 0 on success.

int wmf_canvas_set_brush | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | style,
|  | unsigned short | hatch,
|  | wmfRGB | color
| ) |

Change current brush style.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  style | one of BS_SOLID, BS_NULL, or BS_HATCHED
  hatch | one of HS_HORIZONTAL, HS_VERTICAL, HS_FDIAGONAL, HS_BDIAGONAL, HS_CROSS or HS_DIAGCROSS
  color | stroke color

Brush settings to be used with next drawing command.

Returns:
  Returns 0 on success.

int wmf_canvas_set_font | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | const char * | name,
|  | unsigned short | size,
|  | unsigned short | orient,
|  | unsigned short | weight,
|  | unsigned short | italic,
|  | unsigned short | strike,
|  | unsigned short | uscore,
|  | unsigned short | encode,
|  | unsigned short | pitch
| ) |

Change current font.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  name | font name
  size | font height (in twips)
  orient | text rotation in tenths of degrees
  weight | 400 for normal text, 700 for bold
  italic | 0 for normal text, 1 for oblique/italic
  strike | 0 for normal text, 1 for strike-through
  uscore | 0 for normal text, 1 for underscore (I think; and 2 for double uscore ??)
  encode | encoding; 0 for most fonts, 2 for symbol fonts; presumably others...
  pitch | italic angle; usually 0 (webdings), 16 (times), 32 (arial) or 48 (courier)

Font settings to be used with next drawing command.

Returns:
  Returns 0 on success.

int wmf_canvas_set_pen | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | line,
|  | unsigned short | endcap,
|  | unsigned short | join,
|  | unsigned short | width,
|  | wmfRGB | color
| ) |

Change current pen style.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  line | one of PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT, PS_NULL, PS_INSIDEFRAME, PS_USERSTYLE, or PS_ALTERNATE
  endcap | one of PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, or PS_ENDCAP_FLAT
  join | one of PS_JOIN_ROUND, PS_JOIN_BEVEL, or PS_JOIN_MITER
  width | stroke width
  color | stroke color

Pen settings to be used with next drawing command.

Returns:
  Returns 0 on success.

int wmf_canvas_set_polyfill | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | mode
| ) |

Set polygon fill mode.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  mode | one of ALTERNATE or WINDING

Set polygon fill mode.

Returns:
  Returns 0 on success.

int wmf_canvas_set_textcolor | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | wmfRGB | color
| ) |

Set text color.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  color | text color

Set text color.

Returns:
  Returns 0 on success.

int wmf_canvas_text | ( | wmfAPI * | API,
|  | wmfCanvas * | canvas,
|  | unsigned short | x,
|  | unsigned short | y,
|  | const char * | str
| ) |

Draw text.

Parameters:

  API | the API handle
  canvas | the Canvas handle for the metafile you are drawing to
  x | x-coordinate of string
  y | y-coordinate of string
  str | the text string to be drawn

Draw text.

Returns:
  Returns 0 on success.