From 837b9b863299bd05b5348b47f9c028091c70de61 Mon Sep 17 00:00:00 2001 From: scuri Date: Tue, 1 Dec 2009 20:33:02 +0000 Subject: New: function CanvasYAxisMode to control the Y axis orientation. --- html/en/func/coordinates.html | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'html/en/func') diff --git a/html/en/func/coordinates.html b/html/en/func/coordinates.html index 9f119bb..a56b12d 100644 --- a/html/en/func/coordinates.html +++ b/html/en/func/coordinates.html @@ -18,6 +18,18 @@ canvas:GetSize() -> (width, height, mm_width, mm_height: number) [in Lua]Returns the canvas size in pixels and in millimeters. You can provide only the desired values and NULL for the others.

+
int cdCanvasYAxisMode(cdCanvas* canvas, int invert); [in C]
+
+canvas:YAxisMode(invert: number) -> (old_invert: number) [in Lua]
+ +

Controls the orientation of the Y axis. Internally in some drivers the + native axis orientation is top-bottom, so the CD primitives must invert the + Y axis since the CD orientation is bottom-top. Using CD_QUERY will return + the current Y axis mode, if needs to be invert or not. Using 1 or 0 you can + control if the Y axis should be inverted or not independent from the native + orientation, with that you can in fact invert the orientation of the CD + primitives.

+
int cdCanvasUpdateYAxis(cdCanvas* canvas, int *y); [in C]
 double cdfCanvasUpdateYAxis(cdCanvas* canvas, double *y); [in C]
 int cdCanvasInvertYAxis(cdCanvas* canvas, int y); [in C]
@@ -26,11 +38,9 @@ double cdfCanvasInvertYAxis(cdCanvas* canvas, double y); [in C]
 canvas:UpdateYAxis(yc: number) -> (yr: number) [in Lua]
 canvas:InvertYAxis(yc: number) -> (yr: number) [in Lua]
-

In some graph systems, the origin is at the upper left corner of the - canvas, with the direction of the Y axis pointing down. In this case, the - function converts the coordinate system of the CD library into the internal - system of the active canvas' driver, and the other way round. If this is not - the case, nothing happens. This is just "y = height-1 - +

Converts the coordinate system of the CD library into the internal + system of the active canvas' driver, and the other way round, if they are + invert, or else do nothing. This is just "y = height-1 - y". It returns the changed value. The "Invert" will always invert the given value, the "Update" function will invert only if the canvas has the Y axis inverted.

-- cgit v1.2.3