Image.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 60 CC 4 SCAR 23.0
CC
4
Cov
0%
make_image
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 10.0
1 ################################################################################
2 # This is CodeManager
3 # Copyright 2009-2013 by Waldemar Biernacki
4 # http://codemanager.sao.pl\n" .
5 #
6 # License statement:
7 #
8 # This program/library is free software; you can redistribute it
9 # and/or modify it under the same terms as Perl itself.
10 #
11 # Last modified (DMYhms): 13-01-2013 09:42:01.
12 ################################################################################
13  
14 package Prima::CodeManager::Image;
15  
16 use strict;
17 use warnings;
18  
19 use POSIX;
20  
21 ################################################################################
22  
23 our %IType;
24 our %Image;
25 our %Dim_X;
26 our %Dim_Y;
27 our %Obraz;
28  
29 ################################################################################
30  
31 sub make_image {
32 my ( $name ) = @_;
33  
34 return undef unless $Image{$name};
35  
36 my $data = '';
37  
38 my $string = $Image{$name};
39 $string =~ s/\n//g;
40 $string =~ s/\s//g;
41  
42 {
43 use bytes;
44 for ( my $x = 0; $x < length $string; $x += 2 ) {
45 $data .= chr( hex( substr( $string, $x, 2 )));
46 }
47 no bytes;
48 }
49 $IType{$name} = 'image' unless $IType{$name};
50  
51 my $obraz;
52  
53 if ( $IType{$name} =~ /icon/i ) {
54 $obraz = Prima::Icon->new(
55 width => $Dim_X{$name},
56 height => $Dim_Y{$name},
57 type => 24,
58 data => $data,
59 autoMasking => 1,
60 );
61 } else {
62 $obraz = Prima::Image->new(
63 width => $Dim_X{$name},
64 height => $Dim_Y{$name},
65 type => 24,
66 data => $data,
67 autoMasking => 1,
68 );
69 }
70  
71 return $obraz;
72 }
73  
74 ################################################################################
75  
76 $IType{'plus.png'} = 'image';
77 $Dim_X{'plus.png'} = 11;
78 $Dim_Y{'plus.png'} = 11;
79 $Image{'plus.png'} = q(
80 808080808080808080808080808080808080808080808080808080808080808080000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080ffffffffff
81 ffffffffffffff000000ffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffff000000ffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffff00
82 0000ffffffffffffffffffffffff808080000000808080ffffff000000000000000000000000000000000000000000ffffff808080000000808080ffffffffffffffffffffffff000000ffffffffffff
83 ffffffffffff808080000000808080ffffffffffffffffffffffff000000ffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffff000000ffffffffffffffffffffffff8080
84 80000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080808080808080808080808080808080808080808080808080808080808080000000
85 );
86  
87 $IType{'minus.png'} = 'image';
88 $Dim_X{'minus.png'} = 11;
89 $Dim_Y{'minus.png'} = 11;
90 $Image{'minus.png'} = q(
91 808080808080808080808080808080808080808080808080808080808080808080000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080ffffffffff
92 ffffffffffffffffffffffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffffff
93 ffffffffffffffffffffffffffff808080000000808080ffffff000000000000000000000000000000000000000000ffffff808080000000808080ffffffffffffffffffffffffffffffffffffffffff
94 ffffffffffff808080000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff8080
95 80000000808080ffffffffffffffffffffffffffffffffffffffffffffffffffffff808080000000808080808080808080808080808080808080808080808080808080808080808080000000
96 );
97 ################################################################################
98  
99 1;
100  
101 __END__