| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CAD::Drawing::Defined; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.62'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
75
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
84
|
|
|
5
|
3
|
|
|
3
|
|
15
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
84
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
222
|
|
|
7
|
3
|
|
|
|
|
7687
|
use vars qw( |
|
8
|
|
|
|
|
|
|
@ISA |
|
9
|
|
|
|
|
|
|
@EXPORT |
|
10
|
|
|
|
|
|
|
$debug |
|
11
|
|
|
|
|
|
|
$linkdebug |
|
12
|
|
|
|
|
|
|
$loaddebug |
|
13
|
|
|
|
|
|
|
$colordebug |
|
14
|
|
|
|
|
|
|
%color_names |
|
15
|
|
|
|
|
|
|
%call_syntax |
|
16
|
|
|
|
|
|
|
%ac_storage_method |
|
17
|
|
|
|
|
|
|
%defaults |
|
18
|
|
|
|
|
|
|
@defaultkeys |
|
19
|
|
|
|
|
|
|
@std_opts_syntax |
|
20
|
|
|
|
|
|
|
$pi |
|
21
|
|
|
|
|
|
|
@aci2hex |
|
22
|
|
|
|
|
|
|
@aci2rgb |
|
23
|
3
|
|
|
3
|
|
16
|
); |
|
|
3
|
|
|
|
|
6
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
require Exporter; |
|
26
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
|
27
|
|
|
|
|
|
|
@EXPORT = qw( |
|
28
|
|
|
|
|
|
|
$debug |
|
29
|
|
|
|
|
|
|
$linkdebug |
|
30
|
|
|
|
|
|
|
$loaddebug |
|
31
|
|
|
|
|
|
|
$colordebug |
|
32
|
|
|
|
|
|
|
%color_names |
|
33
|
|
|
|
|
|
|
%call_syntax |
|
34
|
|
|
|
|
|
|
%ac_storage_method |
|
35
|
|
|
|
|
|
|
%defaults |
|
36
|
|
|
|
|
|
|
@defaultkeys |
|
37
|
|
|
|
|
|
|
@std_opts_syntax |
|
38
|
|
|
|
|
|
|
$pi |
|
39
|
|
|
|
|
|
|
@aci2hex |
|
40
|
|
|
|
|
|
|
@aci2rgb |
|
41
|
|
|
|
|
|
|
check_select |
|
42
|
|
|
|
|
|
|
color_translate |
|
43
|
|
|
|
|
|
|
checkarcangs |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
# @EXPORT_OK = qw( |
|
46
|
|
|
|
|
|
|
# color_translate |
|
47
|
|
|
|
|
|
|
# ); |
|
48
|
|
|
|
|
|
|
$debug = 0; |
|
49
|
|
|
|
|
|
|
$linkdebug = 0; |
|
50
|
|
|
|
|
|
|
$colordebug = 0; |
|
51
|
|
|
|
|
|
|
$loaddebug = 0; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
%defaults = ( |
|
54
|
|
|
|
|
|
|
"layer" => "0", |
|
55
|
|
|
|
|
|
|
"color" => 256, |
|
56
|
|
|
|
|
|
|
"linetype" => "default", |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
@defaultkeys = keys(%defaults); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
######################################################################## |
|
62
|
|
|
|
|
|
|
=head1 NAME |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
CAD::Drawing::Defined - exported constants for CAD::Drawing::* |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 Description |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Everything in this module is exported by default. This module is not |
|
69
|
|
|
|
|
|
|
intended to be used directly, but is required by each module in the |
|
70
|
|
|
|
|
|
|
CAD::Drawing tree. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Eric L. Wilhelm |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
http://scratchcomputing.com |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This module is copyright (C) 2004-2006 by Eric L. Wilhelm. Portions |
|
81
|
|
|
|
|
|
|
copyright (C) 2003 by Eric L. Wilhelm and A. Zahner Co. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LICENSE |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This module is distributed under the same terms as Perl. See the Perl |
|
86
|
|
|
|
|
|
|
source package for details. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
You may use this software under one of the following licenses: |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
(1) GNU General Public License |
|
91
|
|
|
|
|
|
|
(found at http://www.gnu.org/copyleft/gpl.html) |
|
92
|
|
|
|
|
|
|
(2) Artistic License |
|
93
|
|
|
|
|
|
|
(found at http://www.perl.com/pub/language/misc/Artistic.html) |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NO WARRANTY |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is distributed with ABSOLUTELY NO WARRANTY. The author, |
|
98
|
|
|
|
|
|
|
his former employer, and any other contributors will in no way be held |
|
99
|
|
|
|
|
|
|
liable for any loss or damages resulting from its use. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 Modifications |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The source code of this module is made freely available and |
|
104
|
|
|
|
|
|
|
distributable under the GPL or Artistic License. Modifications to and |
|
105
|
|
|
|
|
|
|
use of this software must adhere to one of these licenses. Changes to |
|
106
|
|
|
|
|
|
|
the code should be noted as such and this notification (as well as the |
|
107
|
|
|
|
|
|
|
above copyright information) must remain intact on all copies of the |
|
108
|
|
|
|
|
|
|
code. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Additionally, while the author is actively developing this code, |
|
111
|
|
|
|
|
|
|
notification of any intended changes or extensions would be most helpful |
|
112
|
|
|
|
|
|
|
in avoiding repeated work for all parties involved. Please contact the |
|
113
|
|
|
|
|
|
|
author with any such development plans. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
######################################################################## |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 Useful Functions |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
These were functions that didn't seem appropriate as object-oriented but |
|
121
|
|
|
|
|
|
|
were needed in multiple places. They are exported by default (as is |
|
122
|
|
|
|
|
|
|
nearly everything in this package. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
######################################################################## |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 check_select |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Provides a uniform interface to selection processing. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
NOTE: this is not an object method and is exported by default! |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Direct calling should be for internal use only, but you may have been |
|
134
|
|
|
|
|
|
|
sent to this documentation by one of the modules which uses this |
|
135
|
|
|
|
|
|
|
function to process %option arguments. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
%opts hash may contain (alias) |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Inclusive lists: |
|
140
|
|
|
|
|
|
|
"select layers" (sl) |
|
141
|
|
|
|
|
|
|
"select colors" (sc) |
|
142
|
|
|
|
|
|
|
"select types" (st) |
|
143
|
|
|
|
|
|
|
"select linetypes" (slt) |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Exclusive lists: |
|
146
|
|
|
|
|
|
|
"not layers" (nl) |
|
147
|
|
|
|
|
|
|
"not colors" (nc) |
|
148
|
|
|
|
|
|
|
"not types" (nt) |
|
149
|
|
|
|
|
|
|
"not linetypes" (nlt) |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
The values must be list references. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
The space-separated terms in the keys above may now be underscore ("_") |
|
154
|
|
|
|
|
|
|
separated as well (this saves having to double-quote the item when using |
|
155
|
|
|
|
|
|
|
it as a hash key in the %options argument.) |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
If an option is omitted, all of that category are selected. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
($s, $n) = check_select(\%selection_options); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$s will be a hash reference to inclusive items |
|
162
|
|
|
|
|
|
|
$n will be a hash reference to excluded items |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Keys in the returned hash references are according to the above-listed |
|
165
|
|
|
|
|
|
|
alias conventions ($s->{l} contains a set of true values for selected |
|
166
|
|
|
|
|
|
|
layers (where the layer name is a string acting as the hash key.)) |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Note that the \%selection_options hash reference is a required argument |
|
169
|
|
|
|
|
|
|
(at this level.) Any functions which make it optional must declare a |
|
170
|
|
|
|
|
|
|
hash before passing to this. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
|
173
|
|
|
|
|
|
|
sub check_select { |
|
174
|
0
|
|
|
0
|
1
|
|
my ($opt) = @_; |
|
175
|
0
|
|
|
|
|
|
my %opts = %$opt; |
|
176
|
0
|
|
|
|
|
|
my %s = ( |
|
177
|
|
|
|
|
|
|
"l" => undef(), |
|
178
|
|
|
|
|
|
|
"c" => undef(), |
|
179
|
|
|
|
|
|
|
"t" => undef(), |
|
180
|
|
|
|
|
|
|
"lt" => undef(), |
|
181
|
|
|
|
|
|
|
); |
|
182
|
0
|
|
|
|
|
|
my %n = ( |
|
183
|
|
|
|
|
|
|
"l" => undef(), |
|
184
|
|
|
|
|
|
|
"c" => undef(), |
|
185
|
|
|
|
|
|
|
"t" => undef(), |
|
186
|
|
|
|
|
|
|
"lt" => undef(), |
|
187
|
|
|
|
|
|
|
); |
|
188
|
0
|
|
|
|
|
|
my %res = ( "s" => \%s, "n" => \%n); |
|
189
|
0
|
|
|
|
|
|
my @choices = keys(%res); |
|
190
|
0
|
|
|
|
|
|
my %mapch = ( |
|
191
|
|
|
|
|
|
|
"s" => "select", |
|
192
|
|
|
|
|
|
|
"n" => "not", |
|
193
|
|
|
|
|
|
|
); |
|
194
|
0
|
|
|
|
|
|
my %mapit = ( |
|
195
|
|
|
|
|
|
|
"l" => "layers", |
|
196
|
|
|
|
|
|
|
"c" => "colors", |
|
197
|
|
|
|
|
|
|
"t" => "types", |
|
198
|
|
|
|
|
|
|
"lt" => "linetypes", |
|
199
|
|
|
|
|
|
|
); |
|
200
|
|
|
|
|
|
|
# $opts{sl} && print "wanted @{$opts{sl}}\n"; |
|
201
|
0
|
|
|
|
|
|
foreach my $ch (@choices) { |
|
202
|
0
|
|
|
|
|
|
my $g = $res{$ch}; |
|
203
|
0
|
|
|
|
|
|
foreach my $it (keys(%{$g})) { |
|
|
0
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
foreach my $alias ($ch . $it, $mapch{$ch}."_".$mapit{$it}) { |
|
205
|
0
|
0
|
|
|
|
|
$opts{$alias} && |
|
206
|
|
|
|
|
|
|
($opts{"$mapch{$ch} $mapit{$it}"} = $opts{$ch.$it}); |
|
207
|
|
|
|
|
|
|
# print "option $alias: $opts{$alias}\n"; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
0
|
0
|
|
|
|
|
if($opts{"$mapch{$ch} $mapit{$it}"}) { |
|
210
|
|
|
|
|
|
|
# print "$mapch{$ch} $mapit{$it}\n"; |
|
211
|
0
|
|
|
|
|
|
my @list = @{$opts{"$mapch{$ch} $mapit{$it}"}}; |
|
|
0
|
|
|
|
|
|
|
|
212
|
0
|
0
|
|
|
|
|
($it eq "c") && (@list = color_translate(@list)); |
|
213
|
|
|
|
|
|
|
# print "($it) list: @list\n"; |
|
214
|
0
|
|
|
|
|
|
$g->{$it} = {map({$_ => 1} @list)}; |
|
|
0
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
else { |
|
217
|
0
|
|
|
|
|
|
$g->{$it} = undef; |
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
} |
|
221
|
0
|
|
|
|
|
|
return(\%s, \%n); |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
} # end subroutine check_select definition |
|
224
|
|
|
|
|
|
|
######################################################################## |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 checkarcangs |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Performs in-place modification of arc angles in \@angs. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
NOTE: this is not an object method and is exported by default! |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Internal use only. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
checkarcangs(\@angs); |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
|
237
|
|
|
|
|
|
|
sub checkarcangs { |
|
238
|
0
|
|
|
0
|
1
|
|
my($ang) = @_; |
|
239
|
0
|
|
|
|
|
|
foreach my $d (0,1) { |
|
240
|
|
|
|
|
|
|
# print "got $$ang[$d] for an angle\n"; |
|
241
|
0
|
0
|
|
|
|
|
if($$ang[$d] =~ s/d$//) { |
|
242
|
|
|
|
|
|
|
# allow spec of angle in degrees with $angle . "d"; |
|
243
|
0
|
|
|
|
|
|
$$ang[$d] *= $pi / 180; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
0
|
|
|
|
|
|
while($$ang[$d] > $pi) { |
|
246
|
0
|
|
|
|
|
|
$$ang[$d] -= $pi * 2; |
|
247
|
|
|
|
|
|
|
} |
|
248
|
0
|
|
|
|
|
|
while($$ang[$d] <= -$pi) { |
|
249
|
0
|
|
|
|
|
|
$$ang[$d] += $pi * 2; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
} # end subroutine checkarcangs definition |
|
253
|
|
|
|
|
|
|
######################################################################## |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 color_translate |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Translates a list of colors into numbers. Numbers will be passed |
|
258
|
|
|
|
|
|
|
through (as will unrecognized names!) |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
@colors = color_translate(@colors); |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
|
263
|
|
|
|
|
|
|
sub color_translate { |
|
264
|
0
|
|
|
0
|
1
|
|
my(@list) = @_; |
|
265
|
0
|
|
|
|
|
|
foreach my $item (@list) { |
|
266
|
0
|
0
|
|
|
|
|
$linkdebug && print "got color for $item: $color_names{$item}\n"; |
|
267
|
0
|
0
|
|
|
|
|
( defined($color_names{$item}) ) && ($item = $color_names{$item} ); |
|
268
|
0
|
0
|
|
|
|
|
($item == int($item) ) or carp("don't know what to do with color: $item\n"); |
|
269
|
|
|
|
|
|
|
} |
|
270
|
0
|
0
|
|
|
|
|
$#list || return($list[0]); |
|
271
|
0
|
|
|
|
|
|
return(@list); |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
} # end subroutine color_translate definition |
|
274
|
|
|
|
|
|
|
######################################################################## |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head1 Various definitions |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 %color_names |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Useful for humans. Currently, these have to be statically defined here. |
|
281
|
|
|
|
|
|
|
A better system might allow more spellings and user-defined names (maybe |
|
282
|
|
|
|
|
|
|
loadable from a file.) |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
%color_names = ( |
|
287
|
|
|
|
|
|
|
"byblock" => 0, |
|
288
|
|
|
|
|
|
|
"by block" => 0, |
|
289
|
|
|
|
|
|
|
"bylayer" => 256, |
|
290
|
|
|
|
|
|
|
"by layer" => 256, |
|
291
|
|
|
|
|
|
|
"red" => 1, |
|
292
|
|
|
|
|
|
|
"yellow" => 2, |
|
293
|
|
|
|
|
|
|
"green" => 3, |
|
294
|
|
|
|
|
|
|
"cyan" => 4, |
|
295
|
|
|
|
|
|
|
"blue" => 5, |
|
296
|
|
|
|
|
|
|
"magenta" => 6, |
|
297
|
|
|
|
|
|
|
"black" => 7, |
|
298
|
|
|
|
|
|
|
"darkgray" => 8, |
|
299
|
|
|
|
|
|
|
"darkgrey" => 8, |
|
300
|
|
|
|
|
|
|
"lightgray" => 9, |
|
301
|
|
|
|
|
|
|
"lightgrey" => 9, |
|
302
|
|
|
|
|
|
|
"charcoal" => 250, |
|
303
|
|
|
|
|
|
|
"white" => 255, |
|
304
|
|
|
|
|
|
|
); |
|
305
|
|
|
|
|
|
|
######################################################################## |
|
306
|
|
|
|
|
|
|
# call syntax for add functions |
|
307
|
|
|
|
|
|
|
# list only the non-standard options (as keys per the data-structure syntax) |
|
308
|
|
|
|
|
|
|
# FIXME: need to define what is required separately from what is in the hash? |
|
309
|
|
|
|
|
|
|
=head2 %call_syntax |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
used to allow other functions to decide how to handle various entities |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
|
314
|
|
|
|
|
|
|
%call_syntax = ( |
|
315
|
|
|
|
|
|
|
"plines" => [\&CAD::Drawing::addpolygon, "pts"], |
|
316
|
|
|
|
|
|
|
"lines" => [\&CAD::Drawing::addline, "pts"], |
|
317
|
|
|
|
|
|
|
"texts" => [\&CAD::Drawing::addtext, "pt", "string"], |
|
318
|
|
|
|
|
|
|
"points" => [\&CAD::Drawing::addpoint, "pt"], |
|
319
|
|
|
|
|
|
|
"circles" => [\&CAD::Drawing::addcircle, "pt", "rad"], |
|
320
|
|
|
|
|
|
|
"arcs" => [\&CAD::Drawing::addarc, "pt", "rad", "angs"], |
|
321
|
|
|
|
|
|
|
"images" => [\&CAD::Drawing::addimage, "pt"], |
|
322
|
|
|
|
|
|
|
); |
|
323
|
|
|
|
|
|
|
#" |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
%ac_storage_method = ( |
|
326
|
|
|
|
|
|
|
plines => "ocs", |
|
327
|
|
|
|
|
|
|
lines => "wcs", |
|
328
|
|
|
|
|
|
|
texts => "ocs", |
|
329
|
|
|
|
|
|
|
circles => "ocs", |
|
330
|
|
|
|
|
|
|
arcs => "ocs", |
|
331
|
|
|
|
|
|
|
points => "wcs", |
|
332
|
|
|
|
|
|
|
); |
|
333
|
|
|
|
|
|
|
#" |
|
334
|
|
|
|
|
|
|
######################################################################## |
|
335
|
|
|
|
|
|
|
$pi = atan2(1,1) * 4; |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
######################################################################## |
|
338
|
|
|
|
|
|
|
=head1 Big Constant arrays |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=head2 @aci2hex |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
256 value array which contains #RRGGBB photo-style hex codes for each |
|
343
|
|
|
|
|
|
|
aci color. This is mostly hand-mapped. |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=cut |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
@aci2hex = ( |
|
348
|
|
|
|
|
|
|
"#FFFFFF", "#ff0000", "#ffff00", "#00ff00", # 0 - 3 |
|
349
|
|
|
|
|
|
|
"#00ffff", "#0000ff", "#ff00ff", "#ffffff", # 4 - 7 |
|
350
|
|
|
|
|
|
|
"#b2b2b2", "#c0c0c0", "#ff0000", "#ff8080", # 8 - 11 |
|
351
|
|
|
|
|
|
|
"#a60000", "#a65353", "#800000", "#804040", # 12 - 15 |
|
352
|
|
|
|
|
|
|
"#4c0000", "#4c2626", "#260000", "#261313", # 16 - 19 |
|
353
|
|
|
|
|
|
|
"#ff4000", "#ff9f80", "#a62900", "#a66853", # 20 - 23 |
|
354
|
|
|
|
|
|
|
"#802000", "#805040", "#4c1300", "#4c3026", # 24 - 27 |
|
355
|
|
|
|
|
|
|
"#260a00", "#261813", "#ff8000", "#ffbf80", # 28 - 31 |
|
356
|
|
|
|
|
|
|
"#a65300", "#a67c53", "#804000", "#806040", # 32 - 35 |
|
357
|
|
|
|
|
|
|
"#4c2600", "#4c3926", "#261300", "#261d13", # 36 - 39 |
|
358
|
|
|
|
|
|
|
"#ffbf00", "#ffdf80", "#a67c00", "#a69153", # 40 - 43 |
|
359
|
|
|
|
|
|
|
"#806000", "#807040", "#4c3900", "#4c4326", # 44 - 47 |
|
360
|
|
|
|
|
|
|
"#261d00", "#262113", "#ffff00", "#ffff80", # 48 - 51 |
|
361
|
|
|
|
|
|
|
"#a6a600", "#a6a653", "#808000", "#808040", # 52 - 55 |
|
362
|
|
|
|
|
|
|
"#4c4c00", "#4c4c26", "#262600", "#262613", # 56 - 59 |
|
363
|
|
|
|
|
|
|
"#bfff00", "#dfff80", "#7ca600", "#91a653", # 60 - 63 |
|
364
|
|
|
|
|
|
|
"#608000", "#708040", "#394c00", "#434c26", # 64 - 67 |
|
365
|
|
|
|
|
|
|
"#1d2600", "#212613", "#80ff00", "#bfff80", # 68 - 71 |
|
366
|
|
|
|
|
|
|
"#53a600", "#7ca653", "#408000", "#608040", # 72 - 75 |
|
367
|
|
|
|
|
|
|
"#264c00", "#394c26", "#132600", "#1d2613", # 76 - 79 |
|
368
|
|
|
|
|
|
|
"#40ff00", "#9fff80", "#29a600", "#68a653", # 80 - 83 |
|
369
|
|
|
|
|
|
|
"#208000", "#508040", "#134c00", "#304c26", # 84 - 87 |
|
370
|
|
|
|
|
|
|
"#0a2600", "#182613", "#00ff00", "#80ff80", # 88 - 91 |
|
371
|
|
|
|
|
|
|
"#00a600", "#53a653", "#008000", "#408040", # 92 - 95 |
|
372
|
|
|
|
|
|
|
"#004c00", "#264c26", "#002600", "#132613", # 96 - 99 |
|
373
|
|
|
|
|
|
|
"#00ff40", "#80ff9f", "#00a629", "#53a668", # 100 - 103 |
|
374
|
|
|
|
|
|
|
"#008020", "#408050", "#004c13", "#264c30", # 104 - 107 |
|
375
|
|
|
|
|
|
|
"#00260a", "#132618", "#00ff80", "#80ffbf", # 108 - 111 |
|
376
|
|
|
|
|
|
|
"#00a653", "#53a67c", "#008040", "#408060", # 112 - 115 |
|
377
|
|
|
|
|
|
|
"#004c26", "#264c39", "#002613", "#13261d", # 116 - 119 |
|
378
|
|
|
|
|
|
|
"#00ffbf", "#80ffdf", "#00a67c", "#53a691", # 120 - 123 |
|
379
|
|
|
|
|
|
|
"#008060", "#408070", "#004c39", "#264c43", # 124 - 127 |
|
380
|
|
|
|
|
|
|
"#00261d", "#132621", "#00ffff", "#80ffff", # 128 - 131 |
|
381
|
|
|
|
|
|
|
"#00a6a6", "#53a6a6", "#008080", "#408080", # 132 - 135 |
|
382
|
|
|
|
|
|
|
"#004c4c", "#264c4c", "#002626", "#132626", # 136 - 139 |
|
383
|
|
|
|
|
|
|
"#00bfff", "#80dfff", "#007ca6", "#5391a6", # 140 - 143 |
|
384
|
|
|
|
|
|
|
"#006080", "#407080", "#00394c", "#26434c", # 144 - 147 |
|
385
|
|
|
|
|
|
|
"#001d26", "#132126", "#0080ff", "#80bfff", # 148 - 151 |
|
386
|
|
|
|
|
|
|
"#0053a6", "#537ca6", "#004080", "#406080", # 152 - 155 |
|
387
|
|
|
|
|
|
|
"#00264c", "#26394c", "#001326", "#131d26", # 156 - 159 |
|
388
|
|
|
|
|
|
|
"#0040ff", "#809fff", "#0029a6", "#5368a6", # 160 - 163 |
|
389
|
|
|
|
|
|
|
"#002080", "#405080", "#00134c", "#26304c", # 164 - 167 |
|
390
|
|
|
|
|
|
|
"#000a26", "#131826", "#0000ff", "#8080ff", # 168 - 171 |
|
391
|
|
|
|
|
|
|
"#0000a6", "#5353a6", "#000080", "#404080", # 172 - 175 |
|
392
|
|
|
|
|
|
|
"#00004c", "#26264c", "#000026", "#131326", # 176 - 179 |
|
393
|
|
|
|
|
|
|
"#4000ff", "#9f80ff", "#2900a6", "#6853a6", # 180 - 183 |
|
394
|
|
|
|
|
|
|
"#200080", "#504080", "#13004c", "#30264c", # 184 - 187 |
|
395
|
|
|
|
|
|
|
"#0a0026", "#181326", "#8000ff", "#bf80ff", # 188 - 191 |
|
396
|
|
|
|
|
|
|
"#5300a6", "#7c53a6", "#400080", "#604080", # 192 - 195 |
|
397
|
|
|
|
|
|
|
"#26004c", "#39264c", "#130026", "#1d1326", # 196 - 199 |
|
398
|
|
|
|
|
|
|
"#bf00ff", "#df80ff", "#7c00a6", "#9153a6", # 200 - 203 |
|
399
|
|
|
|
|
|
|
"#600080", "#704080", "#39004c", "#43264c", # 204 - 207 |
|
400
|
|
|
|
|
|
|
"#1d0026", "#211326", "#ff00ff", "#ff80ff", # 208 - 211 |
|
401
|
|
|
|
|
|
|
"#a600a6", "#a653a6", "#800080", "#804080", # 212 - 215 |
|
402
|
|
|
|
|
|
|
"#4c004c", "#4c264c", "#260026", "#261326", # 216 - 219 |
|
403
|
|
|
|
|
|
|
"#ff00bf", "#ff80df", "#a6007c", "#a65391", # 220 - 223 |
|
404
|
|
|
|
|
|
|
"#800060", "#804070", "#4c0039", "#4c2643", # 224 - 227 |
|
405
|
|
|
|
|
|
|
"#26001d", "#261321", "#ff0080", "#ff80bf", # 228 - 231 |
|
406
|
|
|
|
|
|
|
"#a60053", "#a6537c", "#800040", "#804060", # 232 - 235 |
|
407
|
|
|
|
|
|
|
"#4c0026", "#4c2639", "#260013", "#26131d", # 236 - 239 |
|
408
|
|
|
|
|
|
|
"#ff0040", "#ff809f", "#a60029", "#a65368", # 240 - 243 |
|
409
|
|
|
|
|
|
|
"#800020", "#804050", "#4c0013", "#4c2630", # 244 - 247 |
|
410
|
|
|
|
|
|
|
"#26000a", "#261318", "#545454", "#767676", # 248 - 251 |
|
411
|
|
|
|
|
|
|
"#989898", "#bbbbbb", "#dddddd", "#000000", # 252 - 255 |
|
412
|
|
|
|
|
|
|
"#000000" # FIXME: By-Layer and By-Block colors have been set as white |
|
413
|
|
|
|
|
|
|
); |
|
414
|
|
|
|
|
|
|
######################################################################## |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=head2 @aci2rgb |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Generated from @aci2hex for use in postscript and other items. The idea |
|
419
|
|
|
|
|
|
|
here is that it is a fairly small set of values and may as well have |
|
420
|
|
|
|
|
|
|
been generated and placed in this file, rather than constantly |
|
421
|
|
|
|
|
|
|
loading-down the tight loop of saving values to postscript. |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=cut |
|
424
|
|
|
|
|
|
|
@aci2rgb = ( |
|
425
|
|
|
|
|
|
|
[255, 255, 255], [255, 0, 0], [255, 255, 0], [ 0, 255, 0], |
|
426
|
|
|
|
|
|
|
[ 0, 255, 255], [ 0, 0, 255], [255, 0, 255], [255, 255, 255], |
|
427
|
|
|
|
|
|
|
[178, 178, 178], [192, 192, 192], [255, 0, 0], [255, 128, 128], |
|
428
|
|
|
|
|
|
|
[166, 0, 0], [166, 83, 83], [128, 0, 0], [128, 64, 64], |
|
429
|
|
|
|
|
|
|
[ 76, 0, 0], [ 76, 38, 38], [ 38, 0, 0], [ 38, 19, 19], |
|
430
|
|
|
|
|
|
|
[255, 64, 0], [255, 159, 128], [166, 41, 0], [166, 104, 83], |
|
431
|
|
|
|
|
|
|
[128, 32, 0], [128, 80, 64], [ 76, 19, 0], [ 76, 48, 38], |
|
432
|
|
|
|
|
|
|
[ 38, 10, 0], [ 38, 24, 19], [255, 128, 0], [255, 191, 128], |
|
433
|
|
|
|
|
|
|
[166, 83, 0], [166, 124, 83], [128, 64, 0], [128, 96, 64], |
|
434
|
|
|
|
|
|
|
[ 76, 38, 0], [ 76, 57, 38], [ 38, 19, 0], [ 38, 29, 19], |
|
435
|
|
|
|
|
|
|
[255, 191, 0], [255, 223, 128], [166, 124, 0], [166, 145, 83], |
|
436
|
|
|
|
|
|
|
[128, 96, 0], [128, 112, 64], [ 76, 57, 0], [ 76, 67, 38], |
|
437
|
|
|
|
|
|
|
[ 38, 29, 0], [ 38, 33, 19], [255, 255, 0], [255, 255, 128], |
|
438
|
|
|
|
|
|
|
[166, 166, 0], [166, 166, 83], [128, 128, 0], [128, 128, 64], |
|
439
|
|
|
|
|
|
|
[ 76, 76, 0], [ 76, 76, 38], [ 38, 38, 0], [ 38, 38, 19], |
|
440
|
|
|
|
|
|
|
[191, 255, 0], [223, 255, 128], [124, 166, 0], [145, 166, 83], |
|
441
|
|
|
|
|
|
|
[ 96, 128, 0], [112, 128, 64], [ 57, 76, 0], [ 67, 76, 38], |
|
442
|
|
|
|
|
|
|
[ 29, 38, 0], [ 33, 38, 19], [128, 255, 0], [191, 255, 128], |
|
443
|
|
|
|
|
|
|
[ 83, 166, 0], [124, 166, 83], [ 64, 128, 0], [ 96, 128, 64], |
|
444
|
|
|
|
|
|
|
[ 38, 76, 0], [ 57, 76, 38], [ 19, 38, 0], [ 29, 38, 19], |
|
445
|
|
|
|
|
|
|
[ 64, 255, 0], [159, 255, 128], [ 41, 166, 0], [104, 166, 83], |
|
446
|
|
|
|
|
|
|
[ 32, 128, 0], [ 80, 128, 64], [ 19, 76, 0], [ 48, 76, 38], |
|
447
|
|
|
|
|
|
|
[ 10, 38, 0], [ 24, 38, 19], [ 0, 255, 0], [128, 255, 128], |
|
448
|
|
|
|
|
|
|
[ 0, 166, 0], [ 83, 166, 83], [ 0, 128, 0], [ 64, 128, 64], |
|
449
|
|
|
|
|
|
|
[ 0, 76, 0], [ 38, 76, 38], [ 0, 38, 0], [ 19, 38, 19], |
|
450
|
|
|
|
|
|
|
[ 0, 255, 64], [128, 255, 159], [ 0, 166, 41], [ 83, 166, 104], |
|
451
|
|
|
|
|
|
|
[ 0, 128, 32], [ 64, 128, 80], [ 0, 76, 19], [ 38, 76, 48], |
|
452
|
|
|
|
|
|
|
[ 0, 38, 10], [ 19, 38, 24], [ 0, 255, 128], [128, 255, 191], |
|
453
|
|
|
|
|
|
|
[ 0, 166, 83], [ 83, 166, 124], [ 0, 128, 64], [ 64, 128, 96], |
|
454
|
|
|
|
|
|
|
[ 0, 76, 38], [ 38, 76, 57], [ 0, 38, 19], [ 19, 38, 29], |
|
455
|
|
|
|
|
|
|
[ 0, 255, 191], [128, 255, 223], [ 0, 166, 124], [ 83, 166, 145], |
|
456
|
|
|
|
|
|
|
[ 0, 128, 96], [ 64, 128, 112], [ 0, 76, 57], [ 38, 76, 67], |
|
457
|
|
|
|
|
|
|
[ 0, 38, 29], [ 19, 38, 33], [ 0, 255, 255], [128, 255, 255], |
|
458
|
|
|
|
|
|
|
[ 0, 166, 166], [ 83, 166, 166], [ 0, 128, 128], [ 64, 128, 128], |
|
459
|
|
|
|
|
|
|
[ 0, 76, 76], [ 38, 76, 76], [ 0, 38, 38], [ 19, 38, 38], |
|
460
|
|
|
|
|
|
|
[ 0, 191, 255], [128, 223, 255], [ 0, 124, 166], [ 83, 145, 166], |
|
461
|
|
|
|
|
|
|
[ 0, 96, 128], [ 64, 112, 128], [ 0, 57, 76], [ 38, 67, 76], |
|
462
|
|
|
|
|
|
|
[ 0, 29, 38], [ 19, 33, 38], [ 0, 128, 255], [128, 191, 255], |
|
463
|
|
|
|
|
|
|
[ 0, 83, 166], [ 83, 124, 166], [ 0, 64, 128], [ 64, 96, 128], |
|
464
|
|
|
|
|
|
|
[ 0, 38, 76], [ 38, 57, 76], [ 0, 19, 38], [ 19, 29, 38], |
|
465
|
|
|
|
|
|
|
[ 0, 64, 255], [128, 159, 255], [ 0, 41, 166], [ 83, 104, 166], |
|
466
|
|
|
|
|
|
|
[ 0, 32, 128], [ 64, 80, 128], [ 0, 19, 76], [ 38, 48, 76], |
|
467
|
|
|
|
|
|
|
[ 0, 10, 38], [ 19, 24, 38], [ 0, 0, 255], [128, 128, 255], |
|
468
|
|
|
|
|
|
|
[ 0, 0, 166], [ 83, 83, 166], [ 0, 0, 128], [ 64, 64, 128], |
|
469
|
|
|
|
|
|
|
[ 0, 0, 76], [ 38, 38, 76], [ 0, 0, 38], [ 19, 19, 38], |
|
470
|
|
|
|
|
|
|
[ 64, 0, 255], [159, 128, 255], [ 41, 0, 166], [104, 83, 166], |
|
471
|
|
|
|
|
|
|
[ 32, 0, 128], [ 80, 64, 128], [ 19, 0, 76], [ 48, 38, 76], |
|
472
|
|
|
|
|
|
|
[ 10, 0, 38], [ 24, 19, 38], [128, 0, 255], [191, 128, 255], |
|
473
|
|
|
|
|
|
|
[ 83, 0, 166], [124, 83, 166], [ 64, 0, 128], [ 96, 64, 128], |
|
474
|
|
|
|
|
|
|
[ 38, 0, 76], [ 57, 38, 76], [ 19, 0, 38], [ 29, 19, 38], |
|
475
|
|
|
|
|
|
|
[191, 0, 255], [223, 128, 255], [124, 0, 166], [145, 83, 166], |
|
476
|
|
|
|
|
|
|
[ 96, 0, 128], [112, 64, 128], [ 57, 0, 76], [ 67, 38, 76], |
|
477
|
|
|
|
|
|
|
[ 29, 0, 38], [ 33, 19, 38], [255, 0, 255], [255, 128, 255], |
|
478
|
|
|
|
|
|
|
[166, 0, 166], [166, 83, 166], [128, 0, 128], [128, 64, 128], |
|
479
|
|
|
|
|
|
|
[ 76, 0, 76], [ 76, 38, 76], [ 38, 0, 38], [ 38, 19, 38], |
|
480
|
|
|
|
|
|
|
[255, 0, 191], [255, 128, 223], [166, 0, 124], [166, 83, 145], |
|
481
|
|
|
|
|
|
|
[128, 0, 96], [128, 64, 112], [ 76, 0, 57], [ 76, 38, 67], |
|
482
|
|
|
|
|
|
|
[ 38, 0, 29], [ 38, 19, 33], [255, 0, 128], [255, 128, 191], |
|
483
|
|
|
|
|
|
|
[166, 0, 83], [166, 83, 124], [128, 0, 64], [128, 64, 96], |
|
484
|
|
|
|
|
|
|
[ 76, 0, 38], [ 76, 38, 57], [ 38, 0, 19], [ 38, 19, 29], |
|
485
|
|
|
|
|
|
|
[255, 0, 64], [255, 128, 159], [166, 0, 41], [166, 83, 104], |
|
486
|
|
|
|
|
|
|
[128, 0, 32], [128, 64, 80], [ 76, 0, 19], [ 76, 38, 48], |
|
487
|
|
|
|
|
|
|
[ 38, 0, 10], [ 38, 19, 24], [ 84, 84, 84], [118, 118, 118], |
|
488
|
|
|
|
|
|
|
[152, 152, 152], [187, 187, 187], [221, 221, 221], [ 0, 0, 0], |
|
489
|
|
|
|
|
|
|
[255, 255, 255], |
|
490
|
|
|
|
|
|
|
); |
|
491
|
|
|
|
|
|
|
######################################################################## |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=head2 regen_aci2rgb |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
Fairly self-explanatory. Saved here only so I don't lose it. |
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
=cut |
|
498
|
|
|
|
|
|
|
# FIXME: really should put this elsewhere (a BEGIN block!) |
|
499
|
|
|
|
|
|
|
sub regen_aci2rgb { |
|
500
|
0
|
|
|
0
|
1
|
|
my $count = 0; |
|
501
|
0
|
|
|
|
|
|
my $per = 4; |
|
502
|
0
|
|
|
|
|
|
my $ts = 1; |
|
503
|
0
|
|
|
|
|
|
print "\@aci2rgb = (\n"; |
|
504
|
0
|
|
|
|
|
|
for(my $i = 0; $i < @aci2hex; $i++) { |
|
505
|
0
|
|
|
|
|
|
my $hex = $aci2hex[$i]; |
|
506
|
0
|
|
|
|
|
|
$hex =~ s/#(..)(..)(..)//; |
|
507
|
0
|
|
|
|
|
|
my ($red, $green, $blue) = ($1, $2, $3); |
|
508
|
0
|
0
|
|
|
|
|
($count % $per) || print "\t"x$ts; |
|
509
|
0
|
|
|
|
|
|
$count++; |
|
510
|
0
|
|
|
|
|
|
print "[" , |
|
511
|
0
|
|
|
|
|
|
join(", ", map( { sprintf("%3d", hex($_)) } |
|
512
|
|
|
|
|
|
|
$red, $green, $blue)), "]"; |
|
513
|
0
|
0
|
|
|
|
|
if($count % $per) { |
|
514
|
0
|
|
|
|
|
|
print ", "; |
|
515
|
|
|
|
|
|
|
} |
|
516
|
|
|
|
|
|
|
else { |
|
517
|
0
|
|
|
|
|
|
print ",\n"; |
|
518
|
|
|
|
|
|
|
} |
|
519
|
|
|
|
|
|
|
} |
|
520
|
0
|
|
|
|
|
|
print "\n", "\t"x$ts, ");\n"; |
|
521
|
|
|
|
|
|
|
} # end subroutine regen_aci2rgb definition |
|
522
|
|
|
|
|
|
|
######################################################################## |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
######################################################################## |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
1; |