Mercurial > projects > dwt-mac
comparison dwt/graphics/Pattern.d @ 36:db5a898b2119
Fixed a lot of compile errors
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 07 Oct 2008 12:56:18 +0200 |
parents | 93b13b15f0b1 |
children | d8635bb48c7c |
comparison
equal
deleted
inserted
replaced
35:7d135fe0caf2 | 36:db5a898b2119 |
---|---|
45 * </p> | 45 * </p> |
46 * | 46 * |
47 * @since 3.1 | 47 * @since 3.1 |
48 */ | 48 */ |
49 public class Pattern : Resource { | 49 public class Pattern : Resource { |
50 alias Resource.init_ init_; | |
51 | |
50 NSColor color; | 52 NSColor color; |
51 NSGradient gradient; | 53 NSGradient gradient; |
52 NSPoint pt1, pt2; | 54 NSPoint pt1, pt2; |
53 Image image; | 55 Image image; |
54 float[] color1, color2; | 56 float[] color1, color2; |
84 if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 86 if (image is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
85 if (image.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); | 87 if (image.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); |
86 this.image = image; | 88 this.image = image; |
87 color = NSColor.colorWithPatternImage(image.handle); | 89 color = NSColor.colorWithPatternImage(image.handle); |
88 color.retain(); | 90 color.retain(); |
89 init(); | 91 init_(); |
90 } | 92 } |
91 | 93 |
92 /** | 94 /** |
93 * Constructs a new Pattern that represents a linear, two color | 95 * Constructs a new Pattern that represents a linear, two color |
94 * gradient. Drawing with the pattern will cause the resulting area to be | 96 * gradient. Drawing with the pattern will cause the resulting area to be |
177 this.alpha1 = alpha1; | 179 this.alpha1 = alpha1; |
178 this.alpha2 = alpha2; | 180 this.alpha2 = alpha2; |
179 NSColor start = NSColor.colorWithDeviceRed(cast(CGFloat) color1.handle[0], cast(CGFloat) color1.handle[1], cast(CGFloat) color1.handle[2], cast(CGFloat) (alpha1 / 255f)); | 181 NSColor start = NSColor.colorWithDeviceRed(cast(CGFloat) color1.handle[0], cast(CGFloat) color1.handle[1], cast(CGFloat) color1.handle[2], cast(CGFloat) (alpha1 / 255f)); |
180 NSColor end = NSColor.colorWithDeviceRed(cast(CGFloat) color2.handle[0], cast(CGFloat) color2.handle[1], cast(CGFloat) color2.handle[2], cast(CGFloat) (alpha2 / 255f)); | 182 NSColor end = NSColor.colorWithDeviceRed(cast(CGFloat) color2.handle[0], cast(CGFloat) color2.handle[1], cast(CGFloat) color2.handle[2], cast(CGFloat) (alpha2 / 255f)); |
181 gradient = (cast(NSGradient)(new NSGradient()).alloc()).initWithStartingColor(start, end); | 183 gradient = (cast(NSGradient)(new NSGradient()).alloc()).initWithStartingColor(start, end); |
182 init(); | 184 init_(); |
183 } | 185 } |
184 | 186 |
185 void destroy() { | 187 void destroy() { |
186 if (color !is null) color.release(); | 188 if (color !is null) color.release(); |
187 color = null; | 189 color = null; |