| 1 | # -*- perl -*- | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # Copyright (C) 2015 Slaven Rezic. All rights reserved. | ||||||||||||||||||||
| 4 | # This package is free software; you can redistribute it and/or | ||||||||||||||||||||
| 5 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | package Imager::Image::Xpm; | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | $VERSION = '0.01'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | use base 'Imager::Image::Base'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | ▶ | use Image::Xpm; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 18 | 4 | my($class, %opts) = @_; | |||||||||||||||||||
| 19 | 4 | my $file = delete $opts{file}; | |||||||||||||||||||
| 20 | 4 | ▶ | die 'file option is mandatory' if !defined $file; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 3 | ▶ | die 'Unhandled options: ' . join(' ', %opts) if %opts; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 22 | 2 | my $xpm = Image::Xpm->new(-file => $file); | |||||||||||||||||||
| 23 | 2 | Imager::Image::Xpm->convert($xpm); | |||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 2 | ▶ | sub _has_transparency { | ||||||||||||||||||
|
Subroutine
_has_transparency: called CC=5 SCAR=16.8
| |||||||||||||||||||||
| 27 | 2 | my(undef, $image_base) = @_; | |||||||||||||||||||
| 28 | 2 | my $palette = $image_base->get('-palette'); | |||||||||||||||||||
| 29 | 2 | ▶ | if ($palette) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 2 | for my $color_spec (values %$palette) { | |||||||||||||||||||
| 31 | 4 | ▶ | return 1 if ($color_spec->{'c'}||'') =~m{^none$}i; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$color_spec->{'c'} || ''
MC/DC0%0/1
$color_spec->{'c'} || ''
$color_spec->{'c'}
Truth table50%1/2
A
A= $color_spec->{'c'}
| |||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | 0 | 0; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 1 | 1; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||