summaryrefslogtreecommitdiff
path: root/html/en/canvas.html
blob: dc7721b669d0a6de1cda59db951cc7f98507ab6b (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
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="../style.css">
<title>Canvas</title>
</head>

<body>

<h1>Canvas</h1>

  <p>The canvas represents the drawing surface. It could be anything: a file, a 
  client area inside a window in a Window System, a paper used by a printer, 
  etc. Each canvas has its own attributes. </p>
  <h3>Initialization</h3>
  <p>You must call <b>cdCreateCanvas</b> to create a canvas, and <b>cdKillCanvas</b> when you do not need the canvas anymore. 
  It is not necessary to activate 
  a canvas using <b>cdCanvasActivate</b>, but some drivers may require that 
  call. </p>
  <p>To know if a feature is supported by a driver, use function
  <strong>cdContextCaps</strong> or see the driver's 
  documentation.</p>
  <h3>Control</h3>
  <p>Some canvases are buffered and need to be flushed; for that, use the <b>cdCanvasFlush</b> function. In some drivers, this function can also be used to 
  change to another page, as in drivers <b>CD_PRINTER</b>&nbsp; and <b>CD_PS</b>.
  </p>
  <p>You can clear the drawing surface with the <b>cdCanvasClear</b> function, 
  but in some drivers the function may just draw a rectangle using the 
  background color. </p>
  <h3>Coordinate System</h3>
  <p>You may retrieve the original canvas size using the <b>cdCanvasGetSize</b> 
  function. The canvas' origin is at the bottom left corner of the canvas, but 
  an origin change can be simulated with function <b>cdCanvasOrigin</b>. Usually 
  user interface libraries have their origin at the upper right corner, oriented 
  top down. In this case, the function <strong>cd</strong><b>Canvas</b><strong>UpdateYAxis</strong> 
  converts the Y coordinate from this orientation to CD's orientation and 
  vice-versa. </p>
  <h3>Other</h3>
  <p>Some canvas contents can be interpreted; the <b>cdCanvasPlay</b> function 
  interprets the contents of a canvas and calls library functions for the 
  contents to be displayed in the active canvas. </p>


</body>

</html>