summaryrefslogtreecommitdiff
path: root/html/en/drv/svg.html
blob: c9cfcbdb113c0f15b934590e8a77feaa7fc55005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>CD_SVG</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<h2 style="text-align: left">CD_SVG - Scalable Vector Graphics Driver (cdsvg.h)</h2>

  <p>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
  <a href="http://www.w3.org/TR/SVG/">SVG specification</a> is an open standard 
  that has been under development by the <a href="http://www.w3.org/">World Wide 
  Web Consortium</a> (W3C) since 1999.</p>

<h3>Use</h3>

  <p>The file is created by calling function <font face="Courier">
  <a href="../func/init.html#cdCreateCanvas"><strong>cdCreateCanvas</strong></a>(CD_SVG, 
  Data)</font>. The <font face="Courier">Data</font> parameter is a string that must contain the filename and the canvas 
  dimensions, in the following format:</p>
  
    <pre>&quot;<em>filename [widthxheight] [resolution]</em>&quot; or in C<em> &quot;<strong><tt>%s %gx%g %g</tt></strong>&quot;</em></pre>
  
  <p>Only the parameter <font face="Courier">filename</font> is required. The filename must be inside double quotes (&quot;) 
  if it has spaces.<font face="Courier"> Width</font> and <font face="Courier">height</font> are provided in millimeters 
  (note the lowercase &quot;x&quot; between them), and their default value in pixels is <font face="Courier">INT_MAX</font> for 
  both dimensions. <font face="Courier">Resolution </font>is the number of pixels per millimeter; its default value is 
  &quot;3.78 pixels/mm&quot; (96 DPI). <font face="Courier">Width</font>, <font face="Courier">height</font> and
  <font face="Courier">resolution</font> are real values.</p>
  <p>Any amount of such canvases may exist simultaneously. It is important to note that a call to function
  <a href="../func/init.html#cdKillCanvas"><font face="Courier"><strong>
  cdKillCanvas</strong></font></a> is required to <b>close</b> the file properly.</p>
<p><strong>IMPORTANT:</strong> because the SVG specification states that 
floating point number must use dots &quot;.&quot; for floating point separators, we set 
the numeric locale to &quot;English&quot; when the canvas is created, and restore it when 
it is destroyed. But since it uses the global C function <strong>setlocale</strong> 
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.</p>
  <h3>Behavior of Functions</h3>
<h4>Control</h4>
<dir>
  <li><a href="http://www.tecgraf.puc-rio.br/cd/en/func/other.html#cdPlay">
  <font face="Courier"><strong>Play</strong></font></a>: does nothing, returns
  <font face="Courier">CD_ERROR</font>.</li>
	<li><a href="http://www.tecgraf.puc-rio.br/cd/en/func/control.html#cdClear">
	<font face="Courier"><strong>Clear</strong></font></a>: does nothing.</li>
</dir>
<h4>Coordinate System and Clipping </h4>
<dir>
  <li><a href="../func/coordinates.html#cdUpdateYAxis"><font face="Courier">
  <strong>UpdateYAxis</strong></font></a>: does nothing.</li>
	<li><b>Complex Regions</b>: not supported.</li>
</dir>
<h4>Attributes</h4>
<dir>
    <li><a href="http://www.tecgraf.puc-rio.br/cd/en/func/text.html#cdFontDim">
	<font face="Courier"><strong>FontDim</strong></font></a>: is simulated.</li>
	<li><a href="http://www.tecgraf.puc-rio.br/cd/en/func/text.html#cdTextSize">
	<font face="Courier"><strong>TextSize</strong></font></a>: is simulated.</li>
	<li>
	<a href="http://www.tecgraf.puc-rio.br/cd/en/func/attributes.html#cdWriteMode">
	<font face="Courier"><strong>WriteMode</strong></font></a>: does nothing, 
	returns <font face="Courier">CD_REPLACE</font>.</li>
</dir>
<h4>Colors</h4>
<dir>
  <li><a href="../func/color.html#cdGetColorPlanes"><font face="Courier">
  <strong>
  GetColorPlanes</strong></font></a>: always returns 24.</li>
	<li><a href="http://www.tecgraf.puc-rio.br/cd/en/func/color.html#cdPalette">
	<font face="Courier"><strong>Palette</strong></font></a>: does nothing.</li>
</dir>
<h4>Primitives</h4>
<dir>
  <li><font face="Courier"><strong>
  <a href="http://www.tecgraf.puc-rio.br/cd/en/func/marks.html#cdPixel">Pixel</a></strong></font>: 
  does not exist in SVG, is simulated using a circle with radius=0.1.</li>
	<li>Floating point primitives are supported.</li>
</dir>
<h4>Client Images</h4>
<dir>
    <li><a href="../func/client.html#cdGetImageRGB"><font face="Courier"><strong>
  GetImageRGB</strong></font></a>: does nothing.</li>
</dir>
<h4>Server Images</h4>
<dir>
    <li>All functions do nothing.</li>
</dir>

<h4>Exclusive Attributes</h4>
<ul>
  <li>&quot;<b><font face="Courier">CMD</font></b>&quot;: saves a string directly to the file. Allows adding 
	SVG commands 
  to the file generated by the CD library. (set only)</li>
</ul>
<ul>
  <li>&quot;<b><font face="Courier">OPACITY</font></b>&quot;:&nbsp; allows the usage of a global 
	opacity value. The value passed must be a string containing an integer 
	(&quot;%d&quot;) [0=full transparent, 255=full opaque]. Use NULL to reset to the 
	default. Default: 255.</li>
</ul>
<ul>
  <li><strong><span style="font-family: Courier">&quot;HATCHBOXSIZE&quot;</span></strong>: 
  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 (&quot;%d&quot;). If the value of the attribute passed is NULL, the value is 
  rest to the default. When consulted returns the current value (&quot;%d&quot;). Default: 
  &quot;8&quot;.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>

</body>

</html>