Class: Pdfrb::Color::CalRGB

Inherits:
CIEBasedColorSpace show all
Defined in:
lib/pdfrb/color/color_space.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CIEBasedColorSpace

#to_pdf

Methods inherited from ColorSpace

[], names, register, register_as, registry

Constructor Details

#initialize(white_point:, gamma: nil, matrix: nil, black_point: nil) ⇒ CalRGB

Returns a new instance of CalRGB.



112
113
114
115
116
117
# File 'lib/pdfrb/color/color_space.rb', line 112

def initialize(white_point:, gamma: nil, matrix: nil, black_point: nil)
  @white_point = white_point
  @gamma = gamma
  @matrix = matrix
  @black_point = black_point
end

Instance Attribute Details

#black_pointObject (readonly)

Returns the value of attribute black_point.



110
111
112
# File 'lib/pdfrb/color/color_space.rb', line 110

def black_point
  @black_point
end

#gammaObject (readonly)

Returns the value of attribute gamma.



110
111
112
# File 'lib/pdfrb/color/color_space.rb', line 110

def gamma
  @gamma
end

#matrixObject (readonly)

Returns the value of attribute matrix.



110
111
112
# File 'lib/pdfrb/color/color_space.rb', line 110

def matrix
  @matrix
end

#white_pointObject (readonly)

Returns the value of attribute white_point.



110
111
112
# File 'lib/pdfrb/color/color_space.rb', line 110

def white_point
  @white_point
end

Class Method Details

.pdf_nameObject



120
# File 'lib/pdfrb/color/color_space.rb', line 120

def pdf_name; :CalRGB; end

Instance Method Details

#parameters_arrayObject



123
124
125
126
127
128
129
# File 'lib/pdfrb/color/color_space.rb', line 123

def parameters_array
  dict = { WhitePoint: Pdfrb::Model::PdfArray.new(@white_point) }
  dict[:Gamma] = Pdfrb::Model::PdfArray.new(@gamma) if @gamma
  dict[:Matrix] = Pdfrb::Model::PdfArray.new(@matrix) if @matrix
  dict[:BlackPoint] = Pdfrb::Model::PdfArray.new(@black_point) if @black_point
  dict
end