Name | Executed | Routines | % | Executed | Lines | % | Unexecuted |
/home/matt/eu/rds/include/std/graphcst.e | 0 | 3 | 0.00% | 36 | 50 | 72.00% | 14 |
Routine | Executed | Lines | Unexecuted | |
mixture() | 0 | 10 | 0.00% | 10 |
color() | 0 | 2 | 0.00% | 2 |
video_config() | 0 | 2 | 0.00% | 2 |
# | Executed | |
1 | -- (c) Copyright - See License.txt | |
2 | -- | |
3 | ||
4 | --**** | |
5 | -- === Error Code Constants | |
6 | -- | |
7 | namespace graphcst | |
8 | ||
9 | public enum | |
10 | 4 | BMP_SUCCESS, |
11 | 4 | BMP_OPEN_FAILED, |
12 | 4 | BMP_UNEXPECTED_EOF, |
13 | 4 | BMP_UNSUPPORTED_FORMAT, |
14 | 4 | BMP_INVALID_MODE |
15 | ||
16 | --**** | |
17 | -- === video_config sequence accessors | |
18 | ||
19 | public enum | |
20 | 4 | VC_COLOR, |
21 | 4 | VC_MODE, |
22 | 4 | VC_LINES, |
23 | 4 | VC_COLUMNS, |
24 | 4 | VC_XPIXELS, |
25 | 4 | VC_YPIXELS, |
26 | 4 | VC_NCOLORS, |
27 | 4 | VC_PAGES, |
28 | 4 | VC_SCRNLINES, |
29 | 4 | VC_SCRNCOLS |
30 | ||
31 | -- COLOR values -- for characters and pixels | |
32 | --** in graphics modes BLACK is "transparent" | |
33 | ||
34 | ||
35 | --**** | |
36 | -- ==== Colors | |
37 | -- | |
38 | ||
39 | public constant | |
40 | 4 | BLACK = 0, |
41 | 4 | BLUE = 1, |
42 | 4 | GREEN = 2, |
43 | 4 | CYAN = 3, |
44 | 4 | RED = 4, |
45 | 4 | MAGENTA = 5, |
46 | 4 | BROWN = 6, |
47 | 4 | WHITE = 7, |
48 | 4 | GRAY = 8, |
49 | 4 | BRIGHT_BLUE = 9, |
50 | 4 | BRIGHT_GREEN = 10, |
51 | 4 | BRIGHT_CYAN = 11, |
52 | 4 | BRIGHT_RED = 12, |
53 | 4 | BRIGHT_MAGENTA = 13, |
54 | 4 | YELLOW = 14, |
55 | 4 | BRIGHT_WHITE = 15, |
56 | $ | |
57 | ||
58 | 4 | ifdef OSX then |
59 | export constant true_color = { 0, 4, 2, 6, 1, 5, 3, 7, 8,12,10,14, 9,13,11,15, | |
60 | 16,20,18,22,17,21,19,23,24,28,26,28,25,29,17,31} | |
61 | -- BLACK = 0, | |
62 | -- RED = 1, | |
63 | -- GREEN = 2, | |
64 | -- BROWN = 3, | |
65 | -- BLUE = 4, | |
66 | -- MAGENTA = 5, | |
67 | -- CYAN = 6, | |
68 | -- WHITE = 7, | |
69 | -- GRAY = 8, | |
70 | -- BRIGHT_RED = 9, | |
71 | -- BRIGHT_GREEN = 10, | |
72 | -- YELLOW = 11, | |
73 | -- BRIGHT_BLUE = 12, | |
74 | -- BRIGHT_MAGENTA = 13, | |
75 | -- BRIGHT_CYAN = 14, | |
76 | -- BRIGHT_WHITE = 15, | |
77 | elsifdef UNIX then | |
78 | 4 | export constant true_color = { 0, 4, 2, 6, 1, 5, 3, 7, 8,12,10,14, 9,13,11,15, |
79 | 16,20,18,22,17,21,19,23,24,28,26,28,25,29,17,31} | |
80 | -- BLACK = 0, | |
81 | -- RED = 1, | |
82 | -- GREEN = 2, | |
83 | -- BROWN = 3, | |
84 | -- BLUE = 4, | |
85 | -- MAGENTA = 5, | |
86 | -- CYAN = 6, | |
87 | -- WHITE = 7, | |
88 | -- GRAY = 8, | |
89 | -- BRIGHT_RED = 9, | |
90 | -- BRIGHT_GREEN = 10, | |
91 | -- YELLOW = 11, | |
92 | -- BRIGHT_BLUE = 12, | |
93 | -- BRIGHT_MAGENTA = 13, | |
94 | -- BRIGHT_CYAN = 14, | |
95 | -- BRIGHT_WHITE = 15, | |
96 | end ifdef | |
97 | ||
98 | --** | |
99 | -- Add to color to get blinking text | |
100 | 4 | public constant BLINKING = 16 |
101 | ||
102 | 4 | public constant BYTES_PER_CHAR = 2 |
103 | ||
104 | 0 | |
105 | 0 | return x >= 0 and x <= 255 |
106 | end type | |
107 | ||
108 | --**** | |
109 | -- === Routines | |
110 | ||
111 | --** | |
112 | -- Mixture Type | |
113 | -- | |
114 | -- Comments: | |
115 | -- | |
116 | -- A mixture is a ##{red, green, blue}## triple of intensities, which enables you to define | |
117 | -- custom colors. Intensities must be from 0 (weakest) to 63 (strongest). Thus, the brightest | |
118 | -- white is {63, 63, 63}. | |
119 | ||
120 | 0 | |
121 | 0 | if length(s) != 3 then |
122 | 0 | return 0 |
123 | end if | |
124 | 0 | for i=1 to 3 do |
125 | 0 | if not integer(s[i]) then |
126 | 0 | return 0 |
127 | end if | |
128 | 0 | if and_bits(s[i],#FFFFFFC0) then |
129 | 0 | return 0 |
130 | end if | |
131 | 0 | end for |
132 | 0 | return 1 |
133 | end type | |
134 | ||
135 | constant | |
136 | 4 | M_VIDEO_CONFIG = 13 |
137 | ||
138 | --** | |
139 | -- Return a description of the current video configuration: | |
140 | -- | |
141 | -- Returns: | |
142 | -- A **sequence**, of 10 non-negative integers, laid out as follows: | |
143 | -- # color monitor? ~-- 1 0 if monochrome, 1 otherwise | |
144 | -- # current video mode | |
145 | -- # number of text rows in console buffer | |
146 | -- # number of text columns in console buffer | |
147 | -- # screen width in pixels | |
148 | -- # screen height in pixels | |
149 | -- # number of colors | |
150 | -- # number of display pages | |
151 | -- # number of text rows for current screen size | |
152 | -- # number of text columns for current screen size | |
153 | -- | |
154 | -- Comments: | |
155 | -- | |
156 | -- A public enum is available for convenient access to the returned configuration data: | |
157 | -- * ##VC_COLOR## | |
158 | -- * ##VC_MODE## | |
159 | -- * ##VC_LINES## | |
160 | -- * ##VC_COLUMNS## | |
161 | -- * ##VC_XPIXELS## | |
162 | -- * ##VC_YPIXELS## | |
163 | -- * ##VC_NCOLORS## | |
164 | -- * ##VC_PAGES## | |
165 | -- * ##VC_LINES## | |
166 | -- * ##VC_COLUMNS## | |
167 | -- * ##VC_SCRNLINES## | |
168 | -- * ##VC_SCRNCOLS## | |
169 | -- | |
170 | -- This routine makes it easy for you to parameterize a program so it will work in many | |
171 | -- different graphics modes. | |
172 | -- | |
173 | -- Example: | |
174 | -- | |
175 | -- vc = video_config() | |
176 | -- -- vc could be {1, 3, 300, 132, 0, 0, 32, 8, 37, 90} | |
177 | -- | |
178 | -- | |
179 | -- See Also: | |
180 | -- [[:graphics_mode]] | |
181 | ||
182 | 0 | |
183 | 0 | return machine_func(M_VIDEO_CONFIG, 0) |
184 | end function | |
185 |