File: ColorSpace.pm

package info (click to toggle)
libpdf-builder-perl 3.028-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,188 kB
  • sloc: perl: 109,309; makefile: 10
file content (108 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download
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
package PDF::Builder::Resource::ColorSpace;

use base 'PDF::Builder::Basic::PDF::Array';

use strict;
use warnings;

our $VERSION = '3.028'; # VERSION
our $LAST_UPDATE = '3.027'; # manually update whenever code is changed

use PDF::Builder::Basic::PDF::Utils;
use PDF::Builder::Util;
use Scalar::Util qw(weaken);

=head1 NAME

PDF::Builder::Resource::ColorSpace - Base class for PDF color spaces

Inherits from L<PDF::Builder::Basic::PDF::Array>

=head1 METHODS

=head2 new

    $cs = PDF::Builder::Resource::ColorSpace->new($pdf, $key, %opts)

=over

Returns a new colorspace object, base class for all colorspaces.

=back

=cut

sub new {
    my ($class, $pdf, $key, %opts) = @_;

    $class = ref($class) if ref($class);
    my $self = $class->SUPER::new();
    $pdf->new_obj($self) unless $self->is_obj($pdf);
    $self->name($key || pdfkey());
    $self->{' apipdf'} = $pdf;
    weaken $self->{' apipdf'};

    return $self;
}

=head2 name

    $name = $res->name($name) # Set

    $name = $res->name() # Get

=over

Returns or sets the Name of the resource.

=back

=cut

sub name {
    my ($self, $name) = @_;

    if (defined $name) {
        $self->{' name'} = $name;
    }
    return $self->{' name'};
}

sub type {
    my ($self, $type) = @_;

    if (defined $type) {
        $self->{' type'} = $type;
    }
    return $self->{' type'};
}

=head2 param

    @param = $cs->param(@param)

=over

Returns properly formatted color-parameters based on the colorspace.

=back

=cut

sub param {
    my $self = shift;

    return @_;
}

#sub outobjdeep {
#    my ($self, @opts) = @_;
#
#    foreach my $k (qw/ api apipdf /) {
#        $self->{" $k"} = undef;
#        delete($self->{" $k"});
#    }
#    return $self->SUPER::outobjdeep(@opts);
#}

1;