comparison dwt/internal/cocoa/NSGradient.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSGradient;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSBezierPath;
19 import dwt.internal.cocoa.NSColor;
20 import dwt.internal.cocoa.NSColorSpace;
21 import dwt.internal.cocoa.NSInteger;
22 import dwt.internal.cocoa.NSObject;
23 import dwt.internal.cocoa.NSPoint;
24 import dwt.internal.cocoa.NSRect;
25 import dwt.internal.cocoa.OS;
26 import objc = dwt.internal.objc.runtime;
27
28 alias NSUInteger NSGradientDrawingOptions;
29
30 public class NSGradient : NSObject
31 {
32
33 public this ()
34 {
35 super();
36 }
37
38 public this (objc.id id)
39 {
40 super(id);
41 }
42
43 public NSColorSpace colorSpace ()
44 {
45 objc.id result = OS.objc_msgSend(this.id, OS.sel_colorSpace);
46 return result !is null ? new NSColorSpace(result) : null;
47 }
48
49 public void drawFromCenter (NSPoint startCenter, CGFloat startRadius, NSPoint endCenter, CGFloat endRadius, NSGradientDrawingOptions options)
50 {
51 OS.objc_msgSend(this.id, OS.sel_drawFromCenter_1radius_1toCenter_1radius_1options_1, startCenter, startRadius, endCenter, endRadius, options);
52 }
53
54 public void drawFromPoint (NSPoint startingPoint, NSPoint endingPoint, NSGradientDrawingOptions options)
55 {
56 OS.objc_msgSend(this.id, OS.sel_drawFromPoint_1toPoint_1options_1, startingPoint, endingPoint, options);
57 }
58
59 public void drawInBezierPath_angle_ (NSBezierPath path, CGFloat angle)
60 {
61 OS.objc_msgSend(this.id, OS.sel_drawInBezierPath_1angle_1, path !is null ? path.id : null, angle);
62 }
63
64 public void drawInBezierPath_relativeCenterPosition_ (NSBezierPath path, NSPoint relativeCenterPosition)
65 {
66 OS.objc_msgSend(this.id, OS.sel_drawInBezierPath_1relativeCenterPosition_1, path !is null ? path.id : null, relativeCenterPosition);
67 }
68
69 public void drawInRect_angle_ (NSRect rect, CGFloat angle)
70 {
71 OS.objc_msgSend(this.id, OS.sel_drawInRect_1angle_1, rect, angle);
72 }
73
74 public void drawInRect_relativeCenterPosition_ (NSRect rect, NSPoint relativeCenterPosition)
75 {
76 OS.objc_msgSend(this.id, OS.sel_drawInRect_1relativeCenterPosition_1, rect, relativeCenterPosition);
77 }
78
79 public void getColor (objc.id** color, CGFloat* location, NSInteger index)
80 {
81 OS.objc_msgSend(this.id, OS.sel_getColor_1location_1atIndex_1, color, location, index);
82 }
83
84 public NSGradient initWithColors_ (NSArray colorArray)
85 {
86 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithColors_1, colorArray !is null ? colorArray.id : null);
87 return result !is null ? this : null;
88 }
89
90 public NSGradient initWithColors_atLocations_colorSpace_ (NSArray colorArray, /*const*/CGFloat* locations, NSColorSpace colorSpace)
91 {
92 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithColors_1atLocations_1colorSpace_1, colorArray !is null ? colorArray.id : null,
93 locations, colorSpace !is null ? colorSpace.id : null);
94 return result !is null ? this : null;
95 }
96
97 public NSGradient initWithColorsAndLocations (NSColor initWithColorsAndLocations)
98 {
99 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithColorsAndLocations_1,
100 initWithColorsAndLocations !is null ? initWithColorsAndLocations.id : null);
101 return result !is null ? this : null;
102 }
103
104 public NSGradient initWithStartingColor (NSColor startingColor, NSColor endingColor)
105 {
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithStartingColor_1endingColor_1, startingColor !is null ? startingColor.id : null,
107 endingColor !is null ? endingColor.id : null);
108 return result !is null ? this : null;
109 }
110
111 public NSColor interpolatedColorAtLocation (CGFloat location)
112 {
113 objc.id result = OS.objc_msgSend(this.id, OS.sel_interpolatedColorAtLocation_1, location);
114 return result !is null ? new NSColor(result) : null;
115 }
116
117 public NSInteger numberOfColorStops ()
118 {
119 return OS.objc_msgSend(this.id, OS.sel_numberOfColorStops);
120 }
121
122 }