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
|
--
-- File : Color.cdl
-- Created : Mon 11 Jan 1993
-- Author : CKY / Contract Toubro-Larsen ( Niraj RANGWALA )
--
---Copyright : MATRA-DATAVISION 1993
--
class Color from IGESGraph inherits ColorEntity
---Purpose : defines IGESColor, Type <314> Form <0>
-- in package IGESGraph
--
-- The Color Definition Entity is used to communicate the
-- relationship of primary colors to the intensity level of
-- the respective graphics devices as a percent of full
-- intensity range.
uses
IGESEntity from IGESData,
HAsciiString from TCollection
is
Create returns mutable Color;
-- Specific Methods pertaining to class
Init (me : mutable;
red : Real;
green : Real;
blue : Real;
aColorName : HAsciiString);
---Purpose : This method is used to set the fields of the class Color
-- - red : Red color intensity (range 0.0 to 100.0)
-- - green : Green color intensity (range 0.0 to 100.0)
-- - blue : Blue color intensity (range 0.0 to 100.0)
-- - aColorName : Name of the color (optional)
RGBIntensity (me; Red, Green, Blue : out Real);
-- returns the RGB intensities in the Red, Green, Blue
-- fields respectively
CMYIntensity (me; Cyan, Magenta, Yellow : out Real);
-- returns the CMY equivalents of RGB intensities.
--
-- The algorithm used for getting CMY from RGB is :
--
-- C = 100.0 - R where : R = red C = cyan
-- G = 100.0 - M G = green M = magenta
-- B = 100.0 - Y B = blue Y = yellow
--
HLSPercentage (me; Hue, Lightness, Saturation : out Real);
-- returns the HLS equivalents of RGB intensities.
--
-- The algorithm used for getting HLS from RGB is :
--
-- H = (1/(2*PI))*ARCTAN((2*R - G - B) / (SQUAREROOT(3)*(G - B)))
-- L = (1 / 3)*(R + G + B)
-- S = SQUAREROOT(R*R + G*G + B*B - R*G - R*B - B*G)
--
-- where H = Hue, L = Lightness, S = Saturation,
-- PI = 3.14... (constant)
--
HasColorName (me) returns Boolean;
---Purpose : returns True if optional character string is assigned,
-- False otherwise.
ColorName (me) returns HAsciiString from TCollection;
---Purpose : if HasColorName() is True returns the Verbal description of
-- the Color.
fields
--
-- Class : IGESGraph_Color
--
-- Purpose : Declaration of the variables specific to Color
--
-- Reminder : A Color is defined by :
-- - Red color intensity
-- - Green color intensity
-- - Blue color intensity
-- - Optional name of the color
--
theRed : Real;
theGreen : Real;
theBlue : Real;
theColorName : HAsciiString;
end Color;
|