/usr/lib/x86_64-linux-gnu/perl5/5.24/Imager/Color/Float.pm is in libimager-perl 1.005+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | package Imager::Color::Float;
use Imager;
use strict;
use vars qw($VERSION);
$VERSION = "1.005";
# It's just a front end to the XS creation functions.
# Parse color spec into an a set of 4 colors
sub _pspec {
return (@_,1) if @_ == 3;
return (@_ ) if @_ == 4;
if ($_[0] =~
/^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
return (hex($1)/255,hex($2)/255,hex($3)/255,hex($4)/255);
}
if ($_[0] =~ /^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
return (hex($1)/255,hex($2)/255,hex($3)/255,1);
}
return ();
}
sub new {
shift; # get rid of class name.
my @arg = _pspec(@_);
return @arg ? new_internal($arg[0],$arg[1],$arg[2],$arg[3]) : ();
}
sub set {
my $self = shift;
my @arg = _pspec(@_);
return @arg ? set_internal($self, $arg[0],$arg[1],$arg[2],$arg[3]) : ();
}
sub CLONE_SKIP { 1 }
1;
__END__
=head1 NAME
Imager::Color::Float - Rough floating point sample color handling
=head1 SYNOPSIS
$color = Imager::Color->new($red, $green, $blue);
$color = Imager::Color->new($red, $green, $blue, $alpha);
$color = Imager::Color->new("#C0C0FF"); # html color specification
$color->set($red, $green, $blue);
$color->set($red, $green, $blue, $alpha);
$color->set("#C0C0FF"); # html color specification
($red, $green, $blue, $alpha) = $color->rgba();
@hsv = $color->hsv(); # not implemented but proposed
$color->info();
=head1 DESCRIPTION
This module handles creating color objects used by Imager. The idea
is that in the future this module will be able to handle color space
calculations as well.
A floating point Imager color consists of up to four components, each
in the range 0.0 to 1.0. Unfortunately the meaning of the components
can change depending on the type of image you're dealing with:
=over
=item *
for 3 or 4 channel images the color components are red, green, blue,
alpha.
=item *
for 1 or 2 channel images the color components are gray, alpha, with
the other two components ignored.
=back
An alpha value of zero is fully transparent, an alpha value of 1.0 is
fully opaque.
=head1 METHODS
=over 4
=item new
This creates a color object to pass to functions that need a color argument.
=item set
This changes an already defined color. Note that this does not affect any places
where the color has been used previously.
=item rgba()
This returns the red, green, blue and alpha channels of the color the
object contains.
=item info
Calling info merely dumps the relevant color to the log.
=back
=head1 AUTHOR
Arnar M. Hrafnkelsson, addi@umich.edu
And a great deal of help from others - see the C<README> for a complete
list.
=head1 SEE ALSO
Imager(3), Imager::Color.
http://imager.perl.org/
=cut
|