From d8f5733cca135168f0c197d24258253a3e6b6d08 Mon Sep 17 00:00:00 2001 From: scuri Date: Wed, 2 Dec 2009 17:28:14 +0000 Subject: New: functions wdCanvasSetTransform, wdCanvasGetTransform, wdCanvasTranslate and wdCanvasScale, to better control the WD transformation. --- html/en/func/wd.html | 29 +++++ html/en/history.html | 6 +- html/wb/wb_usr.lua | 16 +++ html/wb_tree.html | 280 ++++++++++++++++++++++++----------------------- include/wd.h | 4 + src/cd.def | 3 + src/lua5/cdlua5_canvas.c | 54 +++++++++ src/wd.c | 141 +++++++++++++++++++++++- 8 files changed, 390 insertions(+), 143 deletions(-) diff --git a/html/en/func/wd.html b/html/en/func/wd.html index eaef72d..938d19d 100644 --- a/html/en/func/wd.html +++ b/html/en/func/wd.html @@ -67,6 +67,34 @@ canvas:wCanvas2World(xv, yv: number) -> (xw, yw: number) [in Lua]

Converts canvas coordinates into world coordinates. It is not necessary to provide all return pointers, you can provide only the desired values and NULL for the others.

+ +
void wdCanvasSetTransform(cdCanvas* canvas, double sx, double sy, double tx, double ty); [in C]
+    
+canvas:wSetTransform(sx, sy, tx, ty: number) [in Lua]
+

Configures the world coordinate system transformation to be used to + convert world coordinates (with values in real numbers) into canvas + coordinates (with values in integers). The transformation is automatically + set by wdCanvasWindow and wdCanvasViewport.

+
void wdCanvasGetTransform(cdCanvas* canvas, double *sx, double *sy, double *tx, double *ty); [in C]
+
+canvas:wGetTransform() -> (sx, sy, tx, ty: number) [in Lua]
+

Queries the current transformation 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.

+ +
void wdCanvasTranslate(cdCanvas* canvas, double dtx, double dty); [in C]
+    
+canvas:wTranslate(dtx, dty: number) [in Lua]
+

Translates the transformation by a delta, by adding the given values to + the current tx and ty values.

+ +
void wdCanvasScale(cdCanvas* canvas, double dsx, double dsy); [in C]
+    
+canvas:wScale(dsx, dsy: number) [in Lua]
+

Scales the transformation by a delta, by multiplying the given values by + the current sx and sy values.

+

Extra

void wdCanvasHardcopy(cdCanvas *canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy)); [in C]
 
@@ -77,5 +105,6 @@ canvas:wCanvasHardcopy(ctx: number, data: string or userdata, draw_func: functio
       must use routines in WC) and, finally, removes the new canvas.

It is usually used for "hard copies" of drawings (print equivalent copy). The most common used contexts are Printer, PS and PDF.

+ diff --git a/html/en/history.html b/html/en/history.html index 8a83f67..ba6be12 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -19,10 +19,14 @@

History of Changes

-

CVS (01/Dec/2009)

+

CVS (02/Dec/2009)