b311480e |
1 | -- Created on: 1993-08-24 |
2 | -- Created by: GG |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
b311480e |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
7fd59977 |
10 | -- |
b311480e |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
7fd59977 |
13 | -- |
b311480e |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | class ColorMap from Xw inherits TShared from MMgt |
23 | |
24 | ---Version: 0.0 |
25 | |
26 | ---Purpose: This class defines a GenericColorMap object. |
27 | |
28 | ---Keywords: |
29 | ---Warning: |
30 | ---References: |
31 | |
32 | uses |
33 | |
34 | ColorMap from Aspect, |
35 | ColorMapEntry from Aspect, |
36 | Parameter from Quantity, |
37 | Color from Quantity, |
38 | NameOfColor from Quantity, |
39 | TypeOfVisual from Xw, |
40 | TypeOfMapping from Xw, |
41 | Handle from Aspect |
42 | |
43 | raises |
44 | |
45 | ColorMapDefinitionError from Aspect, |
46 | BadAccess from Aspect |
47 | |
48 | is |
49 | |
50 | Create |
51 | returns mutable ColorMap from Xw |
52 | is protected; |
53 | ---Level: Internal |
54 | |
55 | Create (Connexion : CString from Standard ; |
56 | Visual : TypeOfVisual from Xw = Xw_TOV_PREFERRED_PSEUDOCOLOR; |
57 | Mapping : TypeOfMapping from Xw = Xw_TOM_COLORCUBE; |
58 | Ncolors : Integer from Standard = 0; |
59 | UseDefault: Boolean from Standard = Standard_True ) |
60 | returns mutable ColorMap from Xw |
61 | ---Level: Public |
62 | ---Purpose: Creates a generic ColorMap with a maximum of |
63 | -- unallocated ColorMapEntry. |
64 | -- Sets this colormap with the best colorcube in |
65 | -- the Default HardWare Colormap. |
66 | raises ColorMapDefinitionError from Aspect; |
67 | ---Error if ColorMap creation failed according |
68 | -- to the supported hardware |
69 | |
70 | SetEntry ( me : mutable ; |
71 | Index: Integer from Standard; |
72 | Red,Green,Blue: Real from Standard) |
73 | ---Level: Public |
74 | ---Purpose: Modifies an entry in the color map <me>. |
75 | raises BadAccess from Aspect is virtual; |
76 | ---Purpose: Warning if Index is < 0 or >= MaxColors() |
77 | -- or ColorMap is not defined properly |
78 | |
79 | SetEntry ( me : mutable ; |
80 | Entry : ColorMapEntry from Aspect) |
81 | ---Level: Public |
82 | ---Purpose: Modifies an entry in the color map <me>. |
83 | raises BadAccess from Aspect is virtual; |
84 | ---Purpose: Warning if ColorMap size is exceeded. |
85 | -- or ColorMap is not defined properly |
86 | -- or ColorMapEntry Index is out of range according |
87 | -- to the supported hardware, |
88 | -- or the Mapping type of this colormap is READ_ONLY. |
89 | |
90 | SetEntries ( me : mutable ; |
91 | Colormap : ColorMap from Aspect ) |
92 | ---Level: Public |
93 | ---Purpose: Modifies all Entries from the new colormap |
94 | raises BadAccess from Aspect is virtual; |
95 | ---Purpose: Warning if ColorMap size is exceeded. |
96 | -- or ColorMap is not defined properly |
97 | -- or One of the new ColorMapEntry Index is out of range |
98 | -- according to the supported hardware |
99 | |
100 | SetHighlightColor( me : mutable ; aColor : Color from Quantity ) |
101 | ---Level: Public |
102 | ---Purpose: Sets the Highlight Color for all Windows |
103 | -- which use it . |
104 | -- Error if Colormap is not defined properly |
105 | raises BadAccess from Aspect is virtual; |
106 | |
107 | Destroy( me : mutable ) is virtual; |
108 | ---Level: Public |
109 | ---Purpose: Destroies the Colormap |
110 | ---C++: alias ~ |
111 | |
112 | ---------------------------- |
113 | -- Category: Inquire methods |
114 | ---------------------------- |
115 | |
116 | HighlightColor( me ) |
117 | returns Color from Quantity is virtual; |
118 | ---Level: Public |
119 | ---Purpose: Returns the highlight color . |
120 | |
121 | PixelOfColor ( me ; aColor : Color from Quantity ) |
122 | returns Integer from Standard |
123 | ---Level: Public |
124 | ---Purpose: Returns a pixel value of an RGB color given as |
125 | -- Quantity_Color, depending of the HardWare and |
126 | -- Visual class. |
127 | raises BadAccess from Aspect is virtual; |
128 | ---Error If ColorMap is not defined properly |
129 | |
130 | AllocatesPixelOfColor ( me ) |
131 | returns Integer from Standard |
132 | ---Level: Advanced |
133 | ---Purpose: Returns an allocated pixel of color |
134 | -- writable by using the method SetColorOfPixel(..) |
135 | -- or -1 if no more pixel must be allocated. |
136 | -- Warning: this call take has an effect in PseudoColor model only. |
137 | raises BadAccess from Aspect is virtual; |
138 | ---Error If ColorMap is not defined properly |
139 | |
140 | FreePixelOfColor ( me ; aPixel: Integer from Standard ); |
141 | ---Level: Advanced |
142 | ---Purpose: Free an allocated pixel of color |
143 | -- Warning: this call take has an effect in PseudoColor model only. |
144 | |
145 | SetColorOfPixel ( me ; aPixel: Integer from Standard; |
146 | aColor : Color from Quantity ) |
147 | returns Boolean from Standard |
148 | ---Level: Advanced |
149 | ---Purpose: Returns TRUE if the allocated pixel <aPixel> |
150 | -- has been updated correctly with the color <aColor> |
151 | raises BadAccess from Aspect is virtual; |
152 | ---Error If ColorMap is not defined properly |
153 | |
154 | Entry ( me ; Index : Integer from Standard; |
155 | Red,Green,Blue: out Real from Standard ) |
156 | returns Integer from Standard |
157 | ---Level: Public |
158 | ---Purpose: Returns a pixel value and the components of the |
159 | -- corresponding color index. |
160 | raises BadAccess from Aspect is virtual; |
161 | ---Error If ColorMap is not defined properly |
162 | -- or Index is < 0 or >= MaxColors(). |
163 | |
164 | HighlightPixel (me) |
165 | returns Integer from Standard |
166 | ---Level: Public |
167 | ---Purpose: Returns the current HighLight pixel value , |
168 | -- depending of the HardWare and Visual class |
169 | raises BadAccess from Aspect is virtual; |
170 | ---Error If ColorMap is not defined properly |
171 | |
172 | MaxColors ( me ) |
173 | returns Integer from Standard is static; |
174 | ---Level: Public |
175 | ---Purpose: Returns the number of available colors in the colormap. |
176 | -- or 0 if the colormap is not enabled. |
177 | |
178 | MaxOverlayColors ( me ) |
179 | returns Integer from Standard is static; |
180 | ---Level: Public |
181 | ---Purpose: Returns the number of available colors in the associated |
182 | -- overlay colormap if any. |
183 | -- or 0 if the overlay colormap is not enabled. |
184 | |
185 | XColorMap ( me ) |
186 | returns Handle from Aspect |
187 | ---Level: Public |
188 | ---Purpose: Returns the Colormap XId of the Colormap |
189 | -- depending of the HardWare and Visual class |
190 | raises BadAccess from Aspect is static; |
191 | ---Error If ColorMap is not defined properly |
192 | |
193 | XColorCube ( me ; ColormapID: out Handle from Aspect; |
194 | VisualID: out Integer from Standard; |
195 | BasePixel: out Integer from Standard; |
196 | RedMax: out Integer from Standard; |
197 | RedMult: out Integer from Standard; |
198 | GreenMax: out Integer from Standard; |
199 | GreenMult: out Integer from Standard; |
200 | BlueMax: out Integer from Standard; |
201 | BlueMult: out Integer from Standard ) |
202 | returns Boolean from Standard is static; |
203 | ---Level: Public |
204 | ---Purpose: Returns TRUE and the color-cube definition of the colormap |
205 | -- depending of the HardWare and Visual class |
206 | -- or returns FALSE if the colormap dont't have a color-cube defined. |
207 | -- Color computation from the colorcube : |
208 | -- colorindex = BasePixel + |
209 | -- r*RedMax*RedMult + g*GreenMax*GreenMult + b*BlueMax*BlueMult |
210 | -- where r,g,b are the red,green,blue components of the color in the |
211 | -- range [0.,1.] |
212 | |
213 | XGrayRamp ( me ; ColormapID: out Handle from Aspect; |
214 | VisualID: out Integer from Standard; |
215 | BasePixel: out Integer from Standard; |
216 | GrayMax: out Integer from Standard; |
217 | GrayMult: out Integer from Standard) |
218 | returns Boolean from Standard is static; |
219 | ---Level: Public |
220 | ---Purpose: Returns TRUE and the gray-ramp definition of the colormap |
221 | -- depending of the HardWare and Visual class |
222 | -- or returns FALSE if the colormap dont't have a gray-ramp defined. |
223 | -- Color computation from the grayramp : |
224 | -- colorindex = BasePixel + g*GrayMax*GrayMult |
225 | -- where g is the gray intensity of the color in the |
226 | -- range [0.,1.] |
227 | |
228 | XOverlayColorMap ( me ) |
229 | returns Handle from Aspect |
230 | ---Level: Public |
231 | ---Purpose: Returns the Colormap XId of the associated Overlay Colormap |
232 | -- depending of the HardWare and Visual class |
233 | raises BadAccess from Aspect is static; |
234 | ---Error If ColorMap is not defined properly |
235 | |
236 | XVisual ( me ) |
237 | returns Address from Standard |
238 | ---Level: Public |
239 | ---Purpose: Returns the Visual address of the Colormap |
240 | -- depending of the HardWare |
241 | raises BadAccess from Aspect is static; |
242 | ---Error If ColorMap is not defined properly |
243 | |
244 | XOverlayVisual ( me ) |
245 | returns Address from Standard |
246 | ---Level: Public |
247 | ---Purpose: Returns the Visual address of the associated Overlay Colormap |
248 | -- depending of the HardWare |
249 | raises BadAccess from Aspect is static; |
250 | ---Error If ColorMap is not defined properly |
251 | |
252 | VisualClass ( me ) |
253 | returns TypeOfVisual from Xw |
254 | ---Level: Public |
255 | ---Purpose: Returns the Visual Class of the Colormap |
256 | -- depending of the HardWare |
257 | raises BadAccess from Aspect is static; |
258 | ---Error If ColorMap is not defined properly |
259 | |
260 | OverlayVisualClass ( me ) |
261 | returns TypeOfVisual from Xw |
262 | ---Level: Public |
263 | ---Purpose: Returns the Visual Class of the associated Overlay Colormap |
264 | -- depending of the HardWare |
265 | raises BadAccess from Aspect is static; |
266 | ---Error If ColorMap is not defined properly |
267 | |
268 | VisualID ( me ) |
269 | returns Integer from Standard |
270 | ---Level: Public |
271 | ---Purpose: Returns the Visual ID of the Colormap |
272 | -- depending of the HardWare |
273 | raises BadAccess from Aspect is static; |
274 | ---Error If ColorMap is not defined properly |
275 | |
276 | OverlayVisualID ( me ) |
277 | returns Integer from Standard |
278 | ---Level: Public |
279 | ---Purpose: Returns the Visual ID of the associated Overlay Colormap |
280 | -- depending of the HardWare |
281 | raises BadAccess from Aspect is static; |
282 | ---Error If ColorMap is not defined properly |
283 | |
284 | ExtendedColorMap ( me ) |
285 | returns Address from Standard |
286 | is static protected ; |
287 | ---Level: Public |
288 | ---Purpose: Returns extended data colormap structure pointer. |
289 | ---Category: Inquire methods |
290 | |
291 | ExtendedOverlayColorMap ( me ) |
292 | returns Address from Standard |
293 | is static protected ; |
294 | ---Level: Public |
295 | ---Purpose: Returns extended data overlay colormap structure pointer. |
296 | ---Category: Inquire methods |
297 | |
298 | PrintError(myclass) is protected; |
299 | ---Purpose: Print last error or raise depending of the error gravity. |
300 | |
301 | fields |
302 | |
303 | MyExtendedDisplay : Address from Standard ; |
304 | MyExtendedColorMap : Address from Standard ; |
305 | MyExtendedOverlayColorMap : Address from Standard ; |
306 | MyMapping : TypeOfMapping from Xw ; |
307 | |
308 | friends |
309 | |
310 | class GraphicDevice from Xw, |
311 | class Window from Xw |
312 | |
313 | end ColorMap; |