7fd59977 |
1 | -- |
2 | -- File : Color.cdl |
3 | -- Created : Mon 11 Jan 1993 |
4 | -- Author : CKY / Contract Toubro-Larsen ( Niraj RANGWALA ) |
5 | -- |
6 | ---Copyright : MATRA-DATAVISION 1993 |
7 | -- |
8 | |
9 | class Color from IGESGraph inherits ColorEntity |
10 | |
11 | ---Purpose : defines IGESColor, Type <314> Form <0> |
12 | -- in package IGESGraph |
13 | -- |
14 | -- The Color Definition Entity is used to communicate the |
15 | -- relationship of primary colors to the intensity level of |
16 | -- the respective graphics devices as a percent of full |
17 | -- intensity range. |
18 | |
19 | uses |
20 | |
21 | IGESEntity from IGESData, |
22 | HAsciiString from TCollection |
23 | |
24 | is |
25 | |
26 | Create returns mutable Color; |
27 | |
28 | -- Specific Methods pertaining to class |
29 | |
30 | Init (me : mutable; |
31 | red : Real; |
32 | green : Real; |
33 | blue : Real; |
34 | aColorName : HAsciiString); |
35 | ---Purpose : This method is used to set the fields of the class Color |
36 | -- - red : Red color intensity (range 0.0 to 100.0) |
37 | -- - green : Green color intensity (range 0.0 to 100.0) |
38 | -- - blue : Blue color intensity (range 0.0 to 100.0) |
39 | -- - aColorName : Name of the color (optional) |
40 | |
41 | RGBIntensity (me; Red, Green, Blue : out Real); |
42 | -- returns the RGB intensities in the Red, Green, Blue |
43 | -- fields respectively |
44 | |
45 | CMYIntensity (me; Cyan, Magenta, Yellow : out Real); |
46 | -- returns the CMY equivalents of RGB intensities. |
47 | -- |
48 | -- The algorithm used for getting CMY from RGB is : |
49 | -- |
50 | -- C = 100.0 - R where : R = red C = cyan |
51 | -- G = 100.0 - M G = green M = magenta |
52 | -- B = 100.0 - Y B = blue Y = yellow |
53 | -- |
54 | |
55 | HLSPercentage (me; Hue, Lightness, Saturation : out Real); |
56 | -- returns the HLS equivalents of RGB intensities. |
57 | -- |
58 | -- The algorithm used for getting HLS from RGB is : |
59 | -- |
60 | -- H = (1/(2*PI))*ARCTAN((2*R - G - B) / (SQUAREROOT(3)*(G - B))) |
61 | -- L = (1 / 3)*(R + G + B) |
62 | -- S = SQUAREROOT(R*R + G*G + B*B - R*G - R*B - B*G) |
63 | -- |
64 | -- where H = Hue, L = Lightness, S = Saturation, |
65 | -- PI = 3.14... (constant) |
66 | -- |
67 | |
68 | HasColorName (me) returns Boolean; |
69 | ---Purpose : returns True if optional character string is assigned, |
70 | -- False otherwise. |
71 | |
72 | ColorName (me) returns HAsciiString from TCollection; |
73 | ---Purpose : if HasColorName() is True returns the Verbal description of |
74 | -- the Color. |
75 | |
76 | fields |
77 | |
78 | -- |
79 | -- Class : IGESGraph_Color |
80 | -- |
81 | -- Purpose : Declaration of the variables specific to Color |
82 | -- |
83 | -- Reminder : A Color is defined by : |
84 | -- - Red color intensity |
85 | -- - Green color intensity |
86 | -- - Blue color intensity |
87 | -- - Optional name of the color |
88 | -- |
89 | |
90 | theRed : Real; |
91 | |
92 | theGreen : Real; |
93 | |
94 | theBlue : Real; |
95 | |
96 | theColorName : HAsciiString; |
97 | |
98 | end Color; |