Mercurial > projects > dwt-linux
comparison dwt/graphics/Transform.d @ 259:c0d810de7093
Update SWT 3.4M7 to 3.4
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 29 Jun 2008 14:33:38 +0200 |
parents | ce446666f5a2 |
children |
comparison
equal
deleted
inserted
replaced
257:cc1d3de0e80b | 259:c0d810de7093 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
33 * <p> | 33 * <p> |
34 * This class requires the operating system's advanced graphics subsystem | 34 * This class requires the operating system's advanced graphics subsystem |
35 * which may not be available on some platforms. | 35 * which may not be available on some platforms. |
36 * </p> | 36 * </p> |
37 * | 37 * |
38 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: GraphicsExample</a> | |
39 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
40 * | |
38 * @since 3.1 | 41 * @since 3.1 |
39 */ | 42 */ |
40 public class Transform : Resource { | 43 public class Transform : Resource { |
41 /** | 44 /** |
42 * the OS resource for the Transform | 45 * the OS resource for the Transform |
177 elements[3] = cast(float)handle[3]; | 180 elements[3] = cast(float)handle[3]; |
178 elements[4] = cast(float)handle[4]; | 181 elements[4] = cast(float)handle[4]; |
179 elements[5] = cast(float)handle[5]; | 182 elements[5] = cast(float)handle[5]; |
180 } | 183 } |
181 | 184 |
185 /** | |
186 * Modifies the receiver such that the matrix it represents becomes the | |
187 * identity matrix. | |
188 * | |
189 * @exception DWTException <ul> | |
190 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> | |
191 * </ul> | |
192 * | |
193 * @since 3.4 | |
194 */ | |
182 public void identity() { | 195 public void identity() { |
183 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 196 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
184 Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, 1, 0, 0, 1, 0, 0); | 197 Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, 1, 0, 0, 1, 0, 0); |
185 } | 198 } |
186 | 199 |
187 /** | 200 /** |
188 * Modifies the receiver such that the matrix it represents becomes the | 201 * Modifies the receiver such that the matrix it represents becomes |
189 * the mathematical inverse of the matrix it previously represented. | 202 * the mathematical inverse of the matrix it previously represented. |
190 * | 203 * |
191 * @exception DWTException <ul> | 204 * @exception DWTException <ul> |
192 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> | 205 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> |
193 * <li>ERROR_CANNOT_INVERT_MATRIX - if the matrix is not invertible</li> | 206 * <li>ERROR_CANNOT_INVERT_MATRIX - if the matrix is not invertible</li> |
301 public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) { | 314 public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) { |
302 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 315 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
303 Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy); | 316 Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy); |
304 } | 317 } |
305 | 318 |
319 /** | |
320 * Modifies the receiver so that it represents a transformation that is | |
321 * equivalent to its previous transformation sheared by (shearX, shearY). | |
322 * | |
323 * @param shearX the shear factor in the X direction | |
324 * @param shearY the shear factor in the Y direction | |
325 * | |
326 * @exception DWTException <ul> | |
327 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> | |
328 * </ul> | |
329 * | |
330 * @since 3.4 | |
331 */ | |
306 public void shear(float shearX, float shearY) { | 332 public void shear(float shearX, float shearY) { |
307 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 333 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
308 double[] matrix = [ 1.0, shearX, shearY, 1, 0, 0]; | 334 double[] matrix = [ 1.0, shearX, shearY, 1, 0, 0]; |
309 Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr, cast(cairo_matrix_t*)matrix.ptr, cast(cairo_matrix_t*)handle.ptr); | 335 Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr, cast(cairo_matrix_t*)matrix.ptr, cast(cairo_matrix_t*)handle.ptr); |
310 } | 336 } |