summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_ColorMap.cdl
blob: 24ca71b6e1801ec5e8bd37554195ade697853e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
--
-- File:	Xw_ColorMap.cdl
-- Created:	24/08/93
-- Author:	GG
--
---Copyright:	MatraDatavision 1993
--

class ColorMap from Xw inherits TShared from MMgt

	---Version: 0.0

	---Purpose: This class defines a GenericColorMap object.

	---Keywords:
	---Warning:
	---References:

uses

	ColorMap		from Aspect,
	ColorMapEntry		from Aspect,
	Parameter		from Quantity,
	Color 			from Quantity,
	NameOfColor 		from Quantity,
	TypeOfVisual		from Xw,
	TypeOfMapping		from Xw,
	Handle			from Aspect

raises

	ColorMapDefinitionError	from Aspect,
	BadAccess from Aspect

is

	Create
	returns mutable ColorMap from Xw
	is protected;
	---Level: Internal

	Create (Connexion : CString from Standard ;
		Visual	  : TypeOfVisual from Xw = Xw_TOV_PREFERRED_PSEUDOCOLOR;
		Mapping	  : TypeOfMapping from Xw = Xw_TOM_COLORCUBE;
		Ncolors	  : Integer from Standard = 0;
		UseDefault: Boolean from Standard = Standard_True )
	returns mutable ColorMap from Xw
	---Level: Public
	---Purpose: Creates a generic ColorMap with a maximum of
	--	    unallocated ColorMapEntry.
	--	    Sets this colormap with the best colorcube in
	--	    the Default HardWare Colormap.
	raises ColorMapDefinitionError from Aspect;
        ---Error if ColorMap creation failed according
        --       to the supported hardware

	SetEntry ( me : mutable ;
		   Index: Integer from Standard;
		   Red,Green,Blue: Real from Standard)
	---Level: Public
	---Purpose: Modifies an entry in the color map <me>.
	raises BadAccess from Aspect is virtual;
	---Purpose:  Warning if Index is < 0 or >= MaxColors() 
	--	   or ColorMap is not defined properly

	SetEntry ( me : mutable ;
		  Entry : ColorMapEntry from Aspect)
	---Level: Public
	---Purpose: Modifies an entry in the color map <me>.
	raises BadAccess from Aspect is virtual;
	---Purpose:  Warning if ColorMap size is exceeded.
	--	   or ColorMap is not defined properly
        --         or ColorMapEntry Index is out of range according
        --         to the supported hardware,
	--	   or the Mapping type of this colormap is READ_ONLY.

	SetEntries ( me : mutable ;
		  Colormap : ColorMap from Aspect )
	---Level: Public
	---Purpose: Modifies all Entries from the new colormap
	raises BadAccess from Aspect is virtual;
	---Purpose:  Warning if ColorMap size is exceeded.
	--	   or ColorMap is not defined properly
        --         or One of the new ColorMapEntry Index is out of range
	--	   according to the supported hardware

	SetHighlightColor( me : mutable ; aColor : Color from Quantity )
	---Level: Public
	---Purpose: Sets the Highlight Color for all Windows
	--	    which use it .
	--  Error if Colormap is not defined properly
	raises BadAccess from Aspect is virtual;

	Destroy( me : mutable )  is virtual;
	---Level: Public
	---Purpose: Destroies the Colormap
	---C++: alias ~

        ----------------------------
        -- Category: Inquire methods
        ----------------------------

	HighlightColor( me )
	returns Color from Quantity  is virtual;
	---Level: Public
	---Purpose: Returns the highlight color .

	PixelOfColor ( me ; aColor : Color from Quantity )
	returns Integer from Standard
	---Level: Public
	---Purpose: Returns a pixel value of an RGB color given as
	--	    Quantity_Color, depending of the HardWare and
	--	    Visual class.
	raises BadAccess from Aspect is virtual;
	---Error If ColorMap is not defined properly

	AllocatesPixelOfColor ( me )
	returns Integer from Standard
	---Level: Advanced
	---Purpose: Returns an allocated pixel of color
	--	    writable by using the method SetColorOfPixel(..) 
	--	    or -1 if no more pixel must be allocated.
	--  Warning: this call take has an effect in PseudoColor model only.
	raises BadAccess from Aspect is virtual;
	---Error If ColorMap is not defined properly

	FreePixelOfColor ( me ; aPixel: Integer from Standard );
	---Level: Advanced
	---Purpose: Free an allocated pixel of color
	--  Warning: this call take has an effect in PseudoColor model only.

	SetColorOfPixel ( me ; aPixel: Integer from Standard;
			       aColor : Color from Quantity )
	returns Boolean from Standard
	---Level: Advanced
	---Purpose: Returns TRUE if the allocated pixel <aPixel>
	--	    has been updated correctly with the color <aColor>
	raises BadAccess from Aspect is virtual;
	---Error If ColorMap is not defined properly

	Entry ( me ; Index : Integer from Standard;
			  Red,Green,Blue: out Real from Standard )
	returns Integer from Standard
	---Level: Public
	---Purpose: Returns a pixel value and the components of the 
	--	    corresponding  color index. 
	raises BadAccess from Aspect is virtual;
	---Error If ColorMap is not defined properly
	--       or Index is < 0 or >= MaxColors().

	HighlightPixel (me)
	returns Integer from Standard
	---Level: Public
	---Purpose: Returns the current HighLight pixel value ,
	--	    depending of the HardWare and Visual class
	raises BadAccess from Aspect is virtual;
	---Error If ColorMap is not defined properly

	MaxColors ( me )
	returns Integer from Standard is static;
	---Level: Public
	---Purpose: Returns the number of available colors in the colormap.
	-- 	   or 0 if the colormap is not enabled.

	MaxOverlayColors ( me )
	returns Integer from Standard is static;
	---Level: Public
	---Purpose: Returns the number of available colors in the associated
	--	   overlay colormap if any.
	-- 	   or 0 if the overlay colormap is not enabled.

	XColorMap ( me )
	returns Handle from Aspect
	---Level: Public
	---Purpose: Returns the Colormap XId of the Colormap
	--	    depending of the HardWare and Visual class
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	XColorCube ( me ; ColormapID: out Handle from Aspect;
			 VisualID: out Integer from Standard;
			 BasePixel: out Integer from Standard;
			 RedMax: out Integer from Standard;
			 RedMult: out Integer from Standard;
			 GreenMax: out Integer from Standard;
			 GreenMult: out Integer from Standard;
			 BlueMax: out Integer from Standard;
			 BlueMult: out Integer from Standard )
	returns Boolean from Standard is static;
	---Level: Public
	---Purpose: Returns TRUE and the color-cube definition of the colormap 
	--	    depending of the HardWare and Visual class
	-- or returns FALSE if the colormap dont't have a color-cube defined.
	-- Color computation from the colorcube :
	-- colorindex = BasePixel + 
	--	r*RedMax*RedMult + g*GreenMax*GreenMult + b*BlueMax*BlueMult
	--  where r,g,b are the red,green,blue components of the color in the
	--  range [0.,1.]

	XGrayRamp ( me ; ColormapID: out Handle from Aspect;
			 VisualID: out Integer from Standard;
			 BasePixel: out Integer from Standard;
			 GrayMax: out Integer from Standard;
			 GrayMult: out Integer from Standard)
	returns Boolean from Standard is static;
	---Level: Public
	---Purpose: Returns TRUE and the gray-ramp definition of the colormap 
	--	    depending of the HardWare and Visual class
	-- or returns FALSE if the colormap dont't have a gray-ramp defined.
	-- Color computation from the grayramp :
	-- colorindex = BasePixel + g*GrayMax*GrayMult
	--  where g is the gray intensity of the color in the
	--  range [0.,1.]

	XOverlayColorMap ( me )
	returns Handle from Aspect
	---Level: Public
	---Purpose: Returns the Colormap XId of the associated Overlay Colormap
	--	    depending of the HardWare and Visual class
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	XVisual ( me )
	returns Address from Standard
	---Level: Public
	---Purpose: Returns the Visual address of the Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	XOverlayVisual ( me )
	returns Address from Standard
	---Level: Public
	---Purpose: Returns the Visual address of the associated Overlay Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	VisualClass ( me )
	returns TypeOfVisual from Xw
	---Level: Public
	---Purpose: Returns the Visual Class of the Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	OverlayVisualClass ( me )
	returns TypeOfVisual from Xw
	---Level: Public
	---Purpose: Returns the Visual Class of the associated Overlay Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	VisualID ( me )
	returns Integer from Standard 
	---Level: Public
	---Purpose: Returns the Visual ID of the Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

	OverlayVisualID ( me )
	returns Integer from Standard
	---Level: Public
	---Purpose: Returns the Visual ID of the associated Overlay Colormap
	--	    depending of the HardWare
	raises BadAccess from Aspect is static;
	---Error If ColorMap is not defined properly

        ExtendedColorMap ( me )
	returns Address from Standard
	is static protected ;
	---Level: Public
        ---Purpose: Returns extended data colormap structure pointer.
        ---Category: Inquire methods

        ExtendedOverlayColorMap ( me )
	returns Address from Standard
	is static protected ;
	---Level: Public
        ---Purpose: Returns extended data overlay colormap structure pointer.
        ---Category: Inquire methods

        PrintError(myclass) is protected;
        ---Purpose: Print last error or raise depending of the error gravity.

fields

	MyExtendedDisplay	:	Address from Standard ;
	MyExtendedColorMap 	:	Address from Standard ;
	MyExtendedOverlayColorMap 	:	Address from Standard ;
	MyMapping		:	TypeOfMapping from Xw ;

friends

	class GraphicDevice from Xw,
	class Window from Xw

end ColorMap;