Changeset 213:36f5cb12e1a2 for dwt/graphics/Transform.d
- Timestamp:
- 05/17/08 11:34:28 (8 months ago)
- Files:
-
- dwt/graphics/Transform.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/graphics/Transform.d
r212 r213 40 40 */ 41 41 public class Transform : Resource { 42 42 alias Resource.init_ init_; 43 43 /** 44 44 * the OS resource for the Transform … … 138 138 */ 139 139 public this (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { 140 if (device is null) device = Device.getDevice(); 141 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 142 this.device = device; 143 device.checkGDIP(); 140 super(device); 141 this.device.checkGDIP(); 144 142 handle = Gdip.Matrix_new(m11, m12, m21, m22, dx, dy); 145 143 if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); 146 i f (device.tracking) device.new_Object(this);144 init_(); 147 145 } 148 146 … … 153 151 } 154 152 155 /** 156 * Disposes of the operating system resources associated with 157 * the Transform. Applications must dispose of all Transforms that 158 * they allocate. 159 */ 160 override public void dispose() { 161 if (handle is null) return; 162 if (device.isDisposed()) return; 153 void destroy() { 163 154 Gdip.Matrix_delete(handle); 164 155 handle = null; 165 if (device.tracking) device.dispose_Object(this);166 device = null;167 156 } 168 157 … … 185 174 if (elements is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 186 175 if (elements.length < 6) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 187 Gdip.Matrix_GetElements(handle, elements );176 Gdip.Matrix_GetElements(handle, elements.ptr); 188 177 } 189 178 190 179 /** 191 180 * Modifies the receiver such that the matrix it represents becomes the 181 * identity matrix. 182 * 183 * @exception DWTException <ul> 184 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 185 * </ul> 186 * 187 * @since 3.4 188 */ 189 public void identity() { 190 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 191 Gdip.Matrix_SetElements(handle, 1, 0, 0, 1, 0, 0); 192 } 193 194 /** 195 * Modifies the receiver such that the matrix it represents becomes 192 196 * the mathematical inverse of the matrix it previously represented. 193 197 * … … 304 308 305 309 /** 310 * Modifies the receiver so that it represents a transformation that is 311 * equivalent to its previous transformation sheared by (shearX, shearY). 312 * 313 * @param shearX the shear factor in the X direction 314 * @param shearY the shear factor in the Y direction 315 * 316 * @exception DWTException <ul> 317 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 318 * </ul> 319 * 320 * @since 3.4 321 */ 322 public void shear(float shearX, float shearY) { 323 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 324 Gdip.Matrix_Shear(handle, shearX, shearY, Gdip.MatrixOrderPrepend); 325 } 326 327 /** 306 328 * Given an array containing points described by alternating x and y values, 307 329 * modify that array such that each point has been replaced with the result of … … 320 342 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 321 343 if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 322 Gdip.Matrix_TransformPoints(handle, cast(Gdip.PointF [])pointArray, pointArray.length / 2);344 Gdip.Matrix_TransformPoints(handle, cast(Gdip.PointF*)pointArray.ptr, pointArray.length / 2); 323 345 } 324 346
