comparison dwt/internal/cocoa/NSColorSpace.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 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 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14
14 module dwt.internal.cocoa.NSColorSpace; 15 module dwt.internal.cocoa.NSColorSpace;
15 16
16 import dwt.internal.cocoa.CGColorSpace; 17 import dwt.dwthelper.utils;
17 import dwt.internal.cocoa.NSData; 18 import cocoa = dwt.internal.cocoa.id;
18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSObject; 19 import dwt.internal.cocoa.NSObject;
20 import dwt.internal.cocoa.NSString;
21 import dwt.internal.cocoa.OS; 20 import dwt.internal.cocoa.OS;
22 import objc = dwt.internal.objc.runtime; 21 import objc = dwt.internal.objc.runtime;
23 22
24 alias NSInteger NSColorSpaceModel; 23 public class NSColorSpace : NSObject {
25 24
26 enum 25 public this() {
27 { 26 super();
28 NSUnknownColorSpaceModel = -1,
29 NSGrayColorSpaceModel,
30 NSRGBColorSpaceModel,
31 NSCMYKColorSpaceModel,
32 NSLABColorSpaceModel,
33 NSDeviceNColorSpaceModel,
34 NSIndexedColorSpaceModel,
35 NSPatternColorSpaceModel
36 } 27 }
37 28
38 public class NSColorSpace : NSObject 29 public this(objc.id id) {
39 { 30 super(id);
31 }
40 32
41 public this () 33 public this(cocoa.id id) {
42 { 34 super(id);
43 super(); 35 }
44 }
45 36
46 public this (objc.id id) 37 public static NSColorSpace deviceRGBColorSpace() {
47 { 38 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_deviceRGBColorSpace);
48 super(id); 39 return result !is null ? new NSColorSpace(result) : null;
49 } 40 }
50
51 public objc.id CGColorSpace ()
52 {
53 return OS.objc_msgSend(this.id_, OS.sel_CGColorSpace);
54 }
55
56 public NSData ICCProfileData ()
57 {
58 objc.id result = OS.objc_msgSend(this.id_, OS.sel_ICCProfileData);
59 return result !is null ? new NSData(result) : null;
60 }
61
62 public static NSColorSpace adobeRGB1998ColorSpace ()
63 {
64 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_adobeRGB1998ColorSpace);
65 return result !is null ? new NSColorSpace(result) : null;
66 }
67
68 public NSColorSpaceModel colorSpaceModel ()
69 {
70 return cast(NSColorSpaceModel) OS.objc_msgSend(this.id_, OS.sel_colorSpaceModel);
71 }
72
73 public void* colorSyncProfile ()
74 {
75 return cast(void*) OS.objc_msgSend(this.id_, OS.sel_colorSyncProfile);
76 }
77
78 public static NSColorSpace deviceCMYKColorSpace ()
79 {
80 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_deviceCMYKColorSpace);
81 return result !is null ? new NSColorSpace(result) : null;
82 }
83
84 public static NSColorSpace deviceGrayColorSpace ()
85 {
86 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_deviceGrayColorSpace);
87 return result !is null ? new NSColorSpace(result) : null;
88 }
89
90 public static NSColorSpace deviceRGBColorSpace ()
91 {
92 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_deviceRGBColorSpace);
93 return result !is null ? new NSColorSpace(result) : null;
94 }
95
96 public static NSColorSpace genericCMYKColorSpace ()
97 {
98 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_genericCMYKColorSpace);
99 return result !is null ? new NSColorSpace(result) : null;
100 }
101
102 public static NSColorSpace genericGrayColorSpace ()
103 {
104 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_genericGrayColorSpace);
105 return result !is null ? new NSColorSpace(result) : null;
106 }
107
108 public static NSColorSpace genericRGBColorSpace ()
109 {
110 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_genericRGBColorSpace);
111 return result !is null ? new NSColorSpace(result) : null;
112 }
113
114 public NSColorSpace initWithCGColorSpace (CGColorSpaceRef cgColorSpace)
115 {
116 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithCGColorSpace_1, cgColorSpace);
117 return result !is null ? this : null;
118 }
119
120 public NSColorSpace initWithColorSyncProfile (void* prof)
121 {
122 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithColorSyncProfile_1, prof);
123 return result !is null ? this : null;
124 }
125
126 public NSColorSpace initWithICCProfileData (NSData iccData)
127 {
128 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithICCProfileData_1, iccData !is null ? iccData.id_ : null);
129 return result !is null ? this : null;
130 }
131
132 public NSString localizedName ()
133 {
134 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedName);
135 return result !is null ? new NSString(result) : null;
136 }
137
138 public NSInteger numberOfColorComponents ()
139 {
140 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfColorComponents);
141 }
142
143 public static NSColorSpace sRGBColorSpace ()
144 {
145 objc.id result = OS.objc_msgSend(OS.class_NSColorSpace, OS.sel_sRGBColorSpace);
146 return result !is null ? new NSColorSpace(result) : null;
147 }
148 41
149 } 42 }