FigAnim/Color.pm

filter: Statementstmt 31.8% 7 / 22 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 2 / 5 Podpod n/a totaltotal 28.1% 9 / 32 CC 3 SCAR 13.9
CC
3
Cov
28%
new
6.0
clone
6.0
output
2.0
CRAP 4.0
« FigAnim/Arc.pm ↑ Summary FigAnim/Point.pm »
1 package Color;
2  
3 =head1 NAME
4  
5 Color - A XFig file animator class - Color object
6  
7 =head1 DESCRIPTION
8  
9 Color pseudo-object (user defined colors) - object code in FIG format: 0.
10 This is used to define arbitrary colors beyond the 32 standard colors.
11 Here are all the attributes of this class:
12  
13 B<color_bumber, rgb>
14  
15 =head1 FIG ATTRIBUTES
16  
17 =over
18  
19 =item color_bumber
20  
21 color number, from 32-543 (512 total)
22  
23 The two color fields (pen and fill; pen only, for texts) are
24 defined as follows:
25  
26 -1: Default;
27 0: Black;
28 1: Blue;
29 2: Green;
30 3: Cyan;
31 4: Red;
32 5: Magenta;
33 6: Yellow;
34 7: White;
35 8..11: four shades of blue (dark to lighter);
36 12..14: three shades of green (dark to lighter);
37 15..17: three shades of cyan (dark to lighter);
38 18..20: three shades of red (dark to lighter);
39 21..23: three shades of magenta (dark to lighter);
40 24..26: three shades of brown (dark to lighter);
41 27..30: four shades of pink (dark to lighter);
42 31: Gold;
43 32..543 (512 total): user colors defined in color pseudo-objects (type 0).
44  
45 For White color, the area fill field is defined as follows:
46  
47 -1: not filled;
48 0: black;
49 1..19: shades of grey, from darker to lighter;
50 20: white;
51 21..40: not used;
52 41..56: see patterns for colors, below.
53  
54 For Black or Default color, the area fill field is defined as follows:
55  
56 -1: not filled;
57 0: white;
58 1..19: shades of grey, from lighter to darker;
59 20: black;
60 21..40: not used;
61 41..56: see patterns for colors, below.
62  
63 For all other colors, the area fill field is defined as follows:
64  
65 -1: not filled;
66 0: black;
67 1..19: "shades" of the color, from darker to lighter,
68 a shade is defined as the color mixed with black;
69 20: full saturation of the color;
70 21..39: "tints" of the color from the color to white,
71 a tint is defined as the color mixed with white;
72 40: white;
73 41: 30 degree left diagonal pattern;
74 42: 30 degree right diagonal pattern;
75 43: 30 degree crosshatch;
76 44: 45 degree left diagonal pattern;
77 45: 45 degree right diagonal pattern;
78 46: 45 degree crosshatch;
79 47: bricks;
80 48: circles;
81 49: horizontal lines;
82 50: vertical lines;
83 51: crosshatch;
84 52: fish scales;
85 53: small fish scales;
86 54: octagons;
87 55: horizontal "tire treads";
88 56: vertical "tire treads".
89  
90 =item rgb
91  
92 hex string rgb values:
93 hexadecimal string describing red, green and blue values (e.g. #330099)
94  
95 =back
96  
97 =cut
98  
99 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
100 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 # constructor
103 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
104 0 my $proto = shift;
105 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
106 0 my $self = {};
107
108 #$self->{object_code} = 0;
109 0 $self->{color_number} = shift;
110 0 $self->{rgb} = shift;
111
112 0 bless ($self, $class);
113 0 return $self;
114 }
115  
116  
117 # methods
118 0 ▶sub clone {
Subroutine clone: not called CC=2 SCAR=17.9
119 0 my $self = shift;
120 0 my $obj = new Color;
121 0 $obj->{$_} = $self->{$_} foreach (keys %{$self});
122 0 return $obj;
123 }
124  
125 0 ▶sub output {
Subroutine output: not called CC=1 SCAR=6.9
126 0 my $self = shift;
127 0 my $fh = shift;
128
129 0 printf $fh "0 %d %s\n", @$self{'color_number','rgb'};
130 }
131  
132 1 1;
« FigAnim/Arc.pm ↑ Summary FigAnim/Point.pm »