2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = cairo-cairo-matrix-t.html
28 * strct = cairo_matrix_t
46 * - surfaceT* -> Surface
51 module cairoLib
.Matrix
;
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gtkc
.cairoLibtypes
;
63 private import gtkc
.cairoLib
;
66 private import glib
.Str
;
73 * cairo_matrix_t is used throughout cairo to convert between different
74 * coordinate spaces. A cairo_matrix_t holds an affine transformation,
75 * such as a scale, rotation, shear, or a combination of these.
76 * The transformation of a point (x,y)
78 * x_new = xx * x + xy * y + x0;
79 * y_new = yx * x + yy * y + y0;
80 * The current transformation matrix of a cairo_t, represented as a
81 * cairo_matrix_t, defines the transformation from user-space
82 * coordinates to device-space coordinates. See cairo_get_matrix() and
88 /** the main Gtk struct */
89 protected cairo_matrix_t
* cairo_matrix
;
92 public cairo_matrix_t
* getMatrixStruct()
98 /** the main Gtk struct as a void* */
99 protected void* getStruct()
101 return cast(void*)cairo_matrix
;
105 * Sets our main struct and passes it to the parent class
107 public this (cairo_matrix_t
* cairo_matrix
)
111 if ( cairo_matrix
is null )
116 Stdout("struct cairo_matrix is null on constructor").newline
;
120 printf("struct cairo_matrix is null on constructor");
127 assert(cairo_matrix
!is null, "struct cairo_matrix is null on constructor");
129 this.cairo_matrix
= cairo_matrix
;
137 * Sets matrix to be the affine transformation given by
138 * xx, yx, xy, yy, x0, y0. The transformation is given
140 * x_new = xx * x + xy * y + x0;
141 * y_new = yx * x + yy * y + y0;
145 * xx component of the affine transformation
147 * yx component of the affine transformation
149 * xy component of the affine transformation
151 * yy component of the affine transformation
153 * X translation component of the affine transformation
155 * Y translation component of the affine transformation
157 public void init(double xx
, double yx
, double xy
, double yy
, double x0
, double y0
)
159 // void cairo_matrix_init (cairo_matrix_t *matrix, double xx, double yx, double xy, double yy, double x0, double y0);
160 cairo_matrix_init(cairo_matrix
, xx
, yx
, xy
, yy
, x0
, y0
);
164 * Modifies matrix to be an identity transformation.
168 public void initIdentity()
170 // void cairo_matrix_init_identity (cairo_matrix_t *matrix);
171 cairo_matrix_init_identity(cairo_matrix
);
175 * Initializes matrix to a transformation that translates by tx and
176 * ty in the X and Y dimensions, respectively.
180 * amount to translate in the X direction
182 * amount to translate in the Y direction
184 public void initTranslate(double tx
, double ty
)
186 // void cairo_matrix_init_translate (cairo_matrix_t *matrix, double tx, double ty);
187 cairo_matrix_init_translate(cairo_matrix
, tx
, ty
);
191 * Initializes matrix to a transformation that scales by sx and sy
192 * in the X and Y dimensions, respectively.
196 * scale factor in the X direction
198 * scale factor in the Y direction
200 public void initScale(double sx
, double sy
)
202 // void cairo_matrix_init_scale (cairo_matrix_t *matrix, double sx, double sy);
203 cairo_matrix_init_scale(cairo_matrix
, sx
, sy
);
207 * Initialized matrix to a transformation that rotates by radians.
211 * angle of rotation, in radians. The direction of rotation
212 * is defined such that positive angles rotate in the direction from
213 * the positive X axis toward the positive Y axis. With the default
214 * axis orientation of cairo, positive angles rotate in a clockwise
217 public void initRotate(double radians
)
219 // void cairo_matrix_init_rotate (cairo_matrix_t *matrix, double radians);
220 cairo_matrix_init_rotate(cairo_matrix
, radians
);
224 * Applies a translation by tx, ty to the transformation in
225 * matrix. The effect of the new transformation is to first translate
226 * the coordinates by tx and ty, then apply the original transformation
227 * to the coordinates.
231 * amount to translate in the X direction
233 * amount to translate in the Y direction
235 public void translate(double tx
, double ty
)
237 // void cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
238 cairo_matrix_translate(cairo_matrix
, tx
, ty
);
242 * Applies scaling by tx, ty to the transformation in matrix. The
243 * effect of the new transformation is to first scale the coordinates
244 * by sx and sy, then apply the original transformation to the coordinates.
248 * scale factor in the X direction
250 * scale factor in the Y direction
252 public void scale(double sx
, double sy
)
254 // void cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
255 cairo_matrix_scale(cairo_matrix
, sx
, sy
);
259 * Applies rotation by radians to the transformation in
260 * matrix. The effect of the new transformation is to first rotate the
261 * coordinates by radians, then apply the original transformation
262 * to the coordinates.
266 * angle of rotation, in radians. The direction of rotation
267 * is defined such that positive angles rotate in the direction from
268 * the positive X axis toward the positive Y axis. With the default
269 * axis orientation of cairo, positive angles rotate in a clockwise
272 public void rotate(double radians
)
274 // void cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
275 cairo_matrix_rotate(cairo_matrix
, radians
);
279 * Changes matrix to be the inverse of it's original value. Not
280 * all transformation matrices have inverses; if the matrix
281 * collapses points together (it is degenerate),
282 * then it has no inverse and this function will fail.
283 * Returns: If matrix has an inverse, modifies matrix to
284 * be the inverse matrix and returns CAIRO_STATUS_SUCCESS. Otherwise,
288 * CAIRO_STATUS_INVALID_MATRIX.
290 public cairo_status_t
invert()
292 // cairo_status_t cairo_matrix_invert (cairo_matrix_t *matrix);
293 return cairo_matrix_invert(cairo_matrix
);
297 * Multiplies the affine transformations in a and b together
298 * and stores the result in result. The effect of the resulting
299 * transformation is to first apply the transformation in a to the
300 * coordinates and then apply the transformation in b to the
302 * It is allowable for result to be identical to either a or b.
304 * a cairo_matrix_t in which to store the result
310 public void multiply(cairo_matrix_t
* a
, cairo_matrix_t
* b
)
312 // void cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b);
313 cairo_matrix_multiply(cairo_matrix
, a
, b
);
317 * Transforms the distance vector (dx,dy) by matrix. This is
318 * similar to cairo_matrix_transform_point() except that the translation
319 * components of the transformation are ignored. The calculation of
320 * the returned vector is as follows:
321 * dx2 = dx1 * a + dy1 * c;
322 * dy2 = dx1 * b + dy1 * d;
323 * Affine transformations are position invariant, so the same vector
324 * always transforms to the same vector. If (x1,y1) transforms
325 * to (x2,y2) then (x1+dx1,y1+dy1) will transform to
326 * (x1+dx2,y1+dy2) for all values of x1 and x2.
330 * X component of a distance vector. An in/out parameter
332 * Y component of a distance vector. An in/out parameter
334 public void transformDistance(double* dx
, double* dy
)
336 // void cairo_matrix_transform_distance (const cairo_matrix_t *matrix, double *dx, double *dy);
337 cairo_matrix_transform_distance(cairo_matrix
, dx
, dy
);
341 * Transforms the point (x, y) by matrix.
345 * X position. An in/out parameter
347 * Y position. An in/out parameter
349 public void transformPoint(double* x
, double* y
)
351 // void cairo_matrix_transform_point (const cairo_matrix_t *matrix, double *x, double *y);
352 cairo_matrix_transform_point(cairo_matrix
, x
, y
);