summaryrefslogtreecommitdiff
path: root/html/en/func/wd.html
diff options
context:
space:
mode:
authorscuri <scuri>2008-10-17 06:10:33 +0000
committerscuri <scuri>2008-10-17 06:10:33 +0000
commit7b52cc13af4e85f1ca2deb6b6c77de9c95ea0dcf (patch)
treed0857278bde2eff784227c57dcaf930346ceb7ac /html/en/func/wd.html
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'html/en/func/wd.html')
-rw-r--r--html/en/func/wd.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/html/en/func/wd.html b/html/en/func/wd.html
new file mode 100644
index 0000000..9c83ec5
--- /dev/null
+++ b/html/en/func/wd.html
@@ -0,0 +1,80 @@
+<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title>World Coordinates</title>
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" type="text/css" href="../../style.css">
+ </head>
+ <body>
+ <h2 align="center">World Coordinates</h2>
+ <p>Allows the use of a World Coordinate System. In this system you can attribute
+ coordinates to any unit you want. After you define a window (rectangular
+ region) in your world, each given coordinate is then mapped to canvas
+ coordinates to draw the primitives. You can define a viewport in your canvas to
+ change the coordinate mapping from world to canvas. The image below shows the
+ relation between Window and Viewport.</p>
+ <p align="center"><font size="4">Window x Viewport</font><br>
+ <img src="../../img/wc-dc.gif" border="2" width="330" height="182"></p>
+ <p>If you want to map coordinates from one system to another, use the <font>wdWorld2Canvas</font>
+ e <font>wdCanvas2World</font> functions.
+ </p>
+ <p>The quality of the picture depends on the conversion from World to Canvas, so
+ if the canvas has a small size the picture quality will be poor. To increase
+ picture quality create a canvas with a larger size, if possible.</p>
+ <p>All World Coordinate drawing in all drivers are simulated using other CD
+ primitives.</p>
+ <hr>
+ <pre class="function"><span class="mainFunction">void <a name="wdWindow">wdCanvasWindow</a>(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); [in C]</span>
+
+canvas:wWindow(xmin, xmax, ymin, ymax: number) [in Lua]</pre>
+ <p>Configures a window in the world coordinate system to be used to convert world
+ coordinates (with values in real numbers) into canvas coordinates (with values
+ in integers). The default window is the size in millimeters of the whole
+ canvas.</p>
+ <pre class="function"><span class="mainFunction">void <a name="wdGetWindow">wdCanvasGetWindow</a>(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax); [in C]</span>
+
+canvas:wGetWindow() -&gt; (xmin, xmax, ymin, ymax: number) [in Lua]</pre>
+ <p>Queries the current window in the world coordinate system being used to
+ convert world coordinates into canvas coordinates (and the other way round). It
+ is not necessary to provide all return pointers, you can provide only the
+ desired values.</p>
+ <pre class="function"><span class="mainFunction">void <a name="wdViewport">wdCanvasViewport</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); [in C]</span>
+
+canvas:wViewport(xmin, xmax, ymin, ymax: number) [in Lua]</pre>
+ <p>Configures a viewport in the canvas coordinate system to be used to convert
+ world coordinates (with values in real numbers) into canvas coordinates (with
+ values in integers). The default viewport is the whole canvas <font>(0,w-1,0,h-1)</font>.
+ If the canvas size is changed, the viewport will not be automatically updated.
+ </p>
+ <pre class="function"><span class="mainFunction">void <a name="wdGetViewport">wdCanvasGetViewport</a>(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax); [in C]</span>
+
+canvas:wGetViewport() -&gt; (xmin, xmax, ymin, ymax: number) [in Lua]</pre>
+ <p>Queries the current viewport in the world coordinate system being used to
+ convert world coordinates into canvas coordinates (and the other way round). It
+ is not necessary to provide all return pointers, you can provide only the
+ desired values and <font>NULL</font> for the others.</p>
+ <pre class="function"><span class="mainFunction">void <a name="wdWorld2Canvas">wdCanvasWorld2Canvas</a>(cdCanvas* canvas, double xw, double yw, int *xv, int *yv); [in C]</span>
+
+canvas:wWorld2Canvas(xw, yw: number) -&gt; (xv, yv: number) [in Lua]</pre>
+ <p>Converts world coordinates into canvas coordinates. It is not necessary to
+ provide all return pointers, you can provide only the desired values and <font>NULL</font>
+ for the others.</p>
+ <pre class="function"><span class="mainFunction">void <a name="wdCanvas2World">wdCanvasCanvas2World</a>(cdCanvas* canvas, int xv, int yv, double *xw, double *yw); [in C]</span>
+
+canvas:wCanvas2World(xv, yv: number) -&gt; (xw, yw: number) [in Lua]</pre>
+ <p>Converts canvas coordinates into world coordinates. It is not necessary to
+ provide all return pointers, you can provide only the desired values and <font>NULL</font>
+ for the others.</p>
+ <h3>Extra</h3>
+ <pre class="function"><span class="mainFunction">void <a name="wdHardcopy">wdCanvasHardcopy</a>(cdCanvas *canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy)); [in C]</span>
+
+canvas:wCanvasHardcopy(ctx: number, data: string or userdata, draw_func: function) [in Lua]</pre>
+ <p>Creates a new canvas, prepares Window and Viewport according to
+ the provided canvas, maintaining the aspect ratio and making the drawing occupy
+ the largest possible area of the new canvas, calls the drawing function (which
+ must use routines in WC) and, finally, removes the new canvas.</p>
+ <p>It is usually used for "hard copies" of drawings (print equivalent copy). The
+ most common used contexts are Printer, PS and PDF.</p>
+ </body>
+</html>