Mercurial > repos > cpt > cpt_psm_recombine
annotate lib/CPT/Plot/Colours.pm @ 1:97ef96676b48 draft
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
| author | cpt | 
|---|---|
| date | Mon, 05 Jun 2023 02:51:26 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 
1
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
1 package CPT::Plot::Colours; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
2 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
3 # ABSTRACT: Color transformation library. | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
4 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
5 our %artemis_colours = ( | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
6 0 => 'rgb(255,255,255)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
7 1 => 'rgb(100,100,100)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
8 2 => 'rgb(255,0,0)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
9 3 => 'rgb(0,255,0)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
10 4 => 'rgb(0,0,255)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
11 5 => 'rgb(0,255,255)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
12 6 => 'rgb(255,0,255)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
13 7 => 'rgb(255,255,0)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
14 8 => 'rgb(152,251,152)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
15 9 => 'rgb(135,206,250)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
16 10 => 'rgb(255,165,0)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
17 11 => 'rgb(200,150,100)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
18 12 => 'rgb(255,200,200)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
19 13 => 'rgb(170,170,170)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
20 14 => 'rgb(0,0,0)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
21 15 => 'rgb(255,63,63)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
22 16 => 'rgb(255,127,127)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
23 17 => 'rgb(255,191,191)', | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
24 ); | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
25 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
26 sub new { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
27 my $class = shift; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
28 my $self = {@_}; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
29 bless $self, $class; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
30 return $self; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
31 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
32 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
33 sub getColour { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
34 my ( $self, $string ) = @_; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
35 if ($string) { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
36 my $colour_result; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
37 if ( $string =~ qr/^\s*(\d+)\s*$/ ) { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
38 $colour_result = $artemis_colours{$1}; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
39 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
40 elsif ( $string =~ qr/^\s*(\d+)\s+(\d+)\s+(\d+)\s*$/ ) { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
41 $colour_result = "rgb($1,$2,$3)"; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
42 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
43 else { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
44 warn "Bad Colour Specfication"; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
45 return undef; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
46 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
47 return $colour_result; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
48 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
49 else { | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
50 return undef; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
51 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
52 } | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
53 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
54 1; | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
55 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
56 __END__ | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
57 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
58 =pod | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
59 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
60 =encoding UTF-8 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
61 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
62 =head1 NAME | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
63 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
64 CPT::Plot::Colours - Color transformation library. | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
65 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
66 =head1 VERSION | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
67 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
68 version 1.96 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
69 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
70 =head1 AUTHOR | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
71 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
72 Eric Rasche <rasche.eric@yandex.ru> | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
73 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
74 =head1 COPYRIGHT AND LICENSE | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
75 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
76 This software is Copyright (c) 2014 by Eric Rasche. | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
77 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
78 This is free software, licensed under: | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
79 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
80 The GNU General Public License, Version 3, June 2007 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
81 | 
| 
 
97ef96676b48
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
82 =cut | 
