"Fossies" - the Fresh Open Source Software Archive

Member "otrs-5.0.40/Kernel/cpan-lib/PDF/API2/Resource/ColorSpace/Indexed/ACTFile.pm" (12 Dec 2019, 1569 Bytes) of package /linux/www/otrs-5.0.40.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ACTFile.pm" see the Fossies "Dox" file reference documentation.

    1 package PDF::API2::Resource::ColorSpace::Indexed::ACTFile;
    2 
    3 our $VERSION = '2.025'; # VERSION
    4 
    5 use base 'PDF::API2::Resource::ColorSpace::Indexed';
    6 
    7 use PDF::API2::Basic::PDF::Utils;
    8 use PDF::API2::Util;
    9 
   10 no warnings qw[ deprecated recursion uninitialized ];
   11 
   12 =head1 NAME
   13 
   14 PDF::API2::Resource::ColorSpace::Indexed::ACTFile - Adobe Color Table support
   15 
   16 =head1 METHODS
   17 
   18 =over
   19 
   20 =item $cs = PDF::API2::Resource::ColorSpace::Indexed::ACTFile->new $pdf, $actfile
   21 
   22 Returns a new colorspace object created from an adobe color table file (ACT/8BCT).
   23 See
   24 Adobe Photoshop(R) 6.0 --
   25 File Formats Specification Version 6.0 Release 2,
   26 November 2000
   27 for details.
   28 
   29 =cut
   30 
   31 sub new {
   32     my ($class,$pdf,$file)=@_;
   33     die "could not find act-file '$file'." unless(-f $file);
   34     $class = ref $class if ref $class;
   35     $self=$class->SUPER::new($pdf,pdfkey());
   36     $pdf->new_obj($self) unless($self->is_obj($pdf));
   37     $self->{' apipdf'}=$pdf;
   38     my $csd=PDFDict();
   39     $pdf->new_obj($csd);
   40     $csd->{Filter}=PDFArray(PDFName('FlateDecode'));
   41 
   42     $csd->{WhitePoint}=PDFArray(map {PDFNum($_)} (0.95049, 1, 1.08897));
   43     $csd->{BlackPoint}=PDFArray(map {PDFNum($_)} (0, 0, 0));
   44     $csd->{Gamma}=PDFArray(map {PDFNum($_)} (2.22218, 2.22218, 2.22218));
   45 
   46     my $fh;
   47     open($fh,$file);
   48     binmode($fh,':raw');
   49     read($fh,$csd->{' stream'},768);
   50     close($fh);
   51 
   52     $csd->{' stream'}.="\x00" x 768;
   53     $csd->{' stream'}=substr($csd->{' stream'},0,768);
   54 
   55     $self->add_elements(PDFName('DeviceRGB'),PDFNum(255),$csd);
   56     $self->{' csd'}=$csd;
   57 
   58     return($self);
   59 }
   60 
   61 =back
   62 
   63 =cut
   64 
   65 1;