CD_SVG - Scalable Vector Graphics Driver (cdsvg.h)
This driver allows the generation of a SVG file, a modularized language for
describing two-dimensional vector and mixed vector/raster graphics in XML. The
SVG specification is an open standard
that has been under development by the World Wide
Web Consortium (W3C) since 1999.
The driver uses the LodePNG module by
The file is created by calling function
Data). The Data parameter is a string that must contain the filename and the canvas
dimensions, in the following format:
"filename [width_mmxheight_mm] [resolution]" or in C "%s %gx%g %g"
Only the parameter filename is required. The filename must be inside double quotes (")
if it has spaces. width_mm and height_mm 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.
IMPORTANT: because the SVG specification states that
floating point number must use dots "." for floating point separators, we set
the numeric locale to "C" when the canvas is created, and restore it when
it is destroyed. But since it uses the global C function setlocale
if you use other C functions that are locale dependent while the SVG canvas is
being used then be aware that they will be affected.
Behavior of Functions
Play: does nothing, returns
Clear: does nothing.
Coordinate System and Clipping
UpdateYAxis: the orientation of axis Y is the
opposite to its orientation in the CD library.
Complex Regions: not supported.
FontDim: is simulated.
TextSize: is simulated.
WriteMode: does nothing,
GetColorPlanes: always returns 24.
Palette: does nothing.
Background: accepts the transparency information encoded in the
color. (since 5.13)
does not exist in SVG, is simulated using a circle with radius=0.1.
Floating point primitives are supported.
GetImageRGB: does nothing.
All functions do nothing.
- "UTF8MODE": enables the usage
of the UTF-8 encoding for strings. It can have the following
values: "1" or "0". Default is "0". (since 5.13)
- "CMD": saves a string directly to the file. Allows adding
to the file generated by the CD library. (set only)
- "OPACITY": allows the usage of a global
opacity value. The value passed must be a string containing an integer
("%d") [0=full transparent, 255=full opaque]. Use NULL to reset to the
default. Default: 255.
defines the size of smallest hatch box pattern. This affects the spacing
between the hatch lines. The value passed must be a string containing an
integer ("%d"). If the value of the attribute passed is NULL, the value is
rest to the default. When consulted returns the current value ("%d"). Default: