CD_METAFILE

CD - Canvas Draw

CD_METAFILE - CD Metafile Driver (cdmf.h)

This driver allows the generation of a CD Metafile, a very simple format that includes calls to functions of the CD library and provides persistence to its primitives.

Use

The file is created by calling function cdCreateCanvas(CD_METAFILE, Data). The Data parameter is a string that must contain the filename and the canvas dimensions, in the following format:

"filename [widthxheight resolution]" or in C use "%s %gx%g %g"

Only the parameter filename is required. The filename must be inside double quotes (") if it has spaces. Width and height are provided in millimeters (note the lowercase "x" between them), and their default value in pixels is INT_MAX for both dimensions. Resolution is the number of pixels per millimeter; its default value is "3.78 pixels/mm" (96 DPI). Width, height and resolution are real values.

Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to close the file properly.

Images - Be careful when saving images in the file, because it uses a text format to store all numbers and texts of primitives, including images, which significantly increases its size.

Extension - Although this is not required, we recommend the extension used for the file to be ".MF".

Behavior of Functions

Coordinate System and Clipping

  • Play: implemented.
  • UpdateYAxis: does nothing.
  • Complex Regions: not supported.
  • Clear: removes all primitives from the picture.

Attributes

  • FontDim: uses a size estimator, returning approximate values.
  • TextSize: uses a size estimator, returning approximate values.
  • Colors

    Primitives

    • Floating point primitives are supported.

    Client Images

    Server Images

    • All functions do nothing.