comparison dwt/internal/cocoa/NSImageRep.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.NSImageRep;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSData;
19 import dwt.internal.cocoa.NSInteger;
20 import dwt.internal.cocoa.NSObject;
21 import dwt.internal.cocoa.NSPasteboard;
22 import dwt.internal.cocoa.NSPoint;
23 import dwt.internal.cocoa.NSRect;
24 import dwt.internal.cocoa.NSSize;
25 import dwt.internal.cocoa.NSString;
26 import dwt.internal.cocoa.NSURL;
27 import dwt.internal.cocoa.OS;
28 import objc = dwt.internal.objc.runtime;
29
30 public class NSImageRep : 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 NSInteger bitsPerSample ()
44 {
45 return OS.objc_msgSend(this.id, OS.sel_bitsPerSample);
46 }
47
48 public static bool canInitWithData (NSData data)
49 {
50 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_canInitWithData_1, data !is null ? data.id : null) !is null;
51 }
52
53 public static bool canInitWithPasteboard (NSPasteboard pasteboard)
54 {
55 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id : null) !is null;
56 }
57
58 public NSString colorSpaceName ()
59 {
60 objc.id result = OS.objc_msgSend(this.id, OS.sel_colorSpaceName);
61 return result !is null ? new NSString(result) : null;
62 }
63
64 public bool draw ()
65 {
66 return OS.objc_msgSend(this.id, OS.sel_draw) !is null;
67 }
68
69 public bool drawAtPoint (NSPoint point)
70 {
71 return OS.objc_msgSend(this.id, OS.sel_drawAtPoint_1, point) !is null;
72 }
73
74 public bool drawInRect (NSRect rect)
75 {
76 return OS.objc_msgSend(this.id, OS.sel_drawInRect_1, rect) !is null;
77 }
78
79 public bool hasAlpha ()
80 {
81 return OS.objc_msgSend(this.id, OS.sel_hasAlpha) !is null;
82 }
83
84 public static NSArray imageFileTypes ()
85 {
86 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageFileTypes);
87 return result !is null ? new NSArray(result) : null;
88 }
89
90 public static NSArray imagePasteboardTypes ()
91 {
92 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imagePasteboardTypes);
93 return result !is null ? new NSArray(result) : null;
94 }
95
96 public static objc.Class imageRepClassForData (NSData data)
97 {
98 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForData_1, data !is null ? data.id : null);
99 }
100
101 public static objc.Class imageRepClassForFileType (NSString type)
102 {
103 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForFileType_1, type !is null ? type.id : null);
104 }
105
106 public static objc.Class imageRepClassForPasteboardType (NSString type)
107 {
108 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForPasteboardType_1, type !is null ? type.id : null);
109 }
110
111 public static objc.Class imageRepClassForType (NSString type)
112 {
113 return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForType_1, type !is null ? type.id : null);
114 }
115
116 public static id imageRepWithContentsOfFile (NSString filename)
117 {
118 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithContentsOfFile_1, filename !is null ? filename.id : null);
119 return result !is null ? new id(result) : null;
120 }
121
122 public static id imageRepWithContentsOfURL (NSURL url)
123 {
124 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithContentsOfURL_1, url !is null ? url.id : null);
125 return result !is null ? new id(result) : null;
126 }
127
128 public static id imageRepWithPasteboard (NSPasteboard pasteboard)
129 {
130 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithPasteboard_1, pasteboard !is null ? pasteboard.id : null);
131 return result !is null ? new id(result) : null;
132 }
133
134 public static NSArray imageRepsWithContentsOfFile (NSString filename)
135 {
136 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithContentsOfFile_1, filename !is null ? filename.id : null);
137 return result !is null ? new NSArray(result) : null;
138 }
139
140 public static NSArray imageRepsWithContentsOfURL (NSURL url)
141 {
142 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithContentsOfURL_1, url !is null ? url.id : null);
143 return result !is null ? new NSArray(result) : null;
144 }
145
146 public static NSArray imageRepsWithPasteboard (NSPasteboard pasteboard)
147 {
148 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithPasteboard_1, pasteboard !is null ? pasteboard.id : null);
149 return result !is null ? new NSArray(result) : null;
150 }
151
152 public static NSArray imageTypes ()
153 {
154 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageTypes);
155 return result !is null ? new NSArray(result) : null;
156 }
157
158 public static NSArray imageUnfilteredFileTypes ()
159 {
160 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredFileTypes);
161 return result !is null ? new NSArray(result) : null;
162 }
163
164 public static NSArray imageUnfilteredPasteboardTypes ()
165 {
166 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredPasteboardTypes);
167 return result !is null ? new NSArray(result) : null;
168 }
169
170 public static NSArray imageUnfilteredTypes ()
171 {
172 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredTypes);
173 return result !is null ? new NSArray(result) : null;
174 }
175
176 public bool isOpaque ()
177 {
178 return OS.objc_msgSend(this.id, OS.sel_isOpaque) !is null;
179 }
180
181 public NSInteger pixelsHigh ()
182 {
183 return OS.objc_msgSend(this.id, OS.sel_pixelsHigh);
184 }
185
186 public NSInteger pixelsWide ()
187 {
188 return OS.objc_msgSend(this.id, OS.sel_pixelsWide);
189 }
190
191 public static void registerImageRepClass (objc.Class imageRepClass)
192 {
193 OS.objc_msgSend(OS.class_NSImageRep, OS.sel_registerImageRepClass_1, imageRepClass);
194 }
195
196 public static NSArray registeredImageRepClasses ()
197 {
198 objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_registeredImageRepClasses);
199 return result !is null ? new NSArray(result) : null;
200 }
201
202 public void setAlpha (bool flag)
203 {
204 OS.objc_msgSend(this.id, OS.sel_setAlpha_1, flag);
205 }
206
207 public void setBitsPerSample (NSInteger anInt)
208 {
209 OS.objc_msgSend(this.id, OS.sel_setBitsPerSample_1, anInt);
210 }
211
212 public void setColorSpaceName (NSString string)
213 {
214 OS.objc_msgSend(this.id, OS.sel_setColorSpaceName_1, string !is null ? string.id : null);
215 }
216
217 public void setOpaque (bool flag)
218 {
219 OS.objc_msgSend(this.id, OS.sel_setOpaque_1, flag);
220 }
221
222 public void setPixelsHigh (NSInteger anInt)
223 {
224 OS.objc_msgSend(this.id, OS.sel_setPixelsHigh_1, anInt);
225 }
226
227 public void setPixelsWide (NSInteger anInt)
228 {
229 OS.objc_msgSend(this.id, OS.sel_setPixelsWide_1, anInt);
230 }
231
232 public void setSize (NSSize aSize)
233 {
234 OS.objc_msgSend(this.id, OS.sel_setSize_1, aSize);
235 }
236
237 public NSSize size ()
238 {
239 NSSize result;
240 OS.objc_msgSend_stret(result, this.id, OS.sel_size);
241 return result;
242 }
243
244 public static void unregisterImageRepClass (objc.Class imageRepClass)
245 {
246 OS.objc_msgSend(OS.class_NSImageRep, OS.sel_unregisterImageRepClass_1, imageRepClass);
247 }
248
249 }