Class: Pdfrb::Color::CalGray

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:, black_point: nil, gamma: nil) ⇒ CalGray

Returns a new instance of CalGray.



90
91
92
93
94
# File 'lib/pdfrb/color/color_space.rb', line 90

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

Instance Attribute Details

#black_pointObject (readonly)

Returns the value of attribute black_point.



88
89
90
# File 'lib/pdfrb/color/color_space.rb', line 88

def black_point
  @black_point
end

#gammaObject (readonly)

Returns the value of attribute gamma.



88
89
90
# File 'lib/pdfrb/color/color_space.rb', line 88

def gamma
  @gamma
end

#white_pointObject (readonly)

Returns the value of attribute white_point.



88
89
90
# File 'lib/pdfrb/color/color_space.rb', line 88

def white_point
  @white_point
end

Class Method Details

.pdf_nameObject



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

def pdf_name; :CalGray; end

Instance Method Details

#parameters_arrayObject



100
101
102
103
104
105
# File 'lib/pdfrb/color/color_space.rb', line 100

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