Class: JXL::Headers::ColourEncoding
- Inherits:
-
Data
- Object
- Data
- JXL::Headers::ColourEncoding
- Defined in:
- lib/jxl/headers/colour_encoding.rb,
lib/jxl/headers/colour_encoding.rb
Constant Summary collapse
- DEFAULT =
{ want_icc: false, colour_space: 0, white_point: 1, primaries: 1, transfer_function: 13, gamma: nil, rendering_intent: 1, white_point_xy: nil, primaries_xy: nil }.freeze
- CUSTOM_XY =
[Bit::Field.bits(19), Bit::Field.bits_offset(19, 524_288), Bit::Field.bits_offset(20, 1_048_576), Bit::Field.bits_offset(21, 2_097_152)].freeze
- ENUM =
[Bit::Field.val(0), Bit::Field.val(1), Bit::Field.bits_offset(4, 2), Bit::Field.bits_offset(6, 18)].freeze
Instance Attribute Summary collapse
-
#colour_space ⇒ Object
readonly
Returns the value of attribute colour_space.
-
#gamma ⇒ Object
readonly
Returns the value of attribute gamma.
-
#primaries ⇒ Object
readonly
Returns the value of attribute primaries.
-
#primaries_xy ⇒ Object
readonly
Returns the value of attribute primaries_xy.
-
#rendering_intent ⇒ Object
readonly
Returns the value of attribute rendering_intent.
-
#transfer_function ⇒ Object
readonly
Returns the value of attribute transfer_function.
-
#want_icc ⇒ Object
readonly
Returns the value of attribute want_icc.
-
#white_point ⇒ Object
readonly
Returns the value of attribute white_point.
-
#white_point_xy ⇒ Object
readonly
Returns the value of attribute white_point_xy.
Class Method Summary collapse
Instance Attribute Details
#colour_space ⇒ Object (readonly)
Returns the value of attribute colour_space
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def colour_space @colour_space end |
#gamma ⇒ Object (readonly)
Returns the value of attribute gamma
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def gamma @gamma end |
#primaries ⇒ Object (readonly)
Returns the value of attribute primaries
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def primaries @primaries end |
#primaries_xy ⇒ Object (readonly)
Returns the value of attribute primaries_xy
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def primaries_xy @primaries_xy end |
#rendering_intent ⇒ Object (readonly)
Returns the value of attribute rendering_intent
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def rendering_intent @rendering_intent end |
#transfer_function ⇒ Object (readonly)
Returns the value of attribute transfer_function
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def transfer_function @transfer_function end |
#want_icc ⇒ Object (readonly)
Returns the value of attribute want_icc
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def want_icc @want_icc end |
#white_point ⇒ Object (readonly)
Returns the value of attribute white_point
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def white_point @white_point end |
#white_point_xy ⇒ Object (readonly)
Returns the value of attribute white_point_xy
5 6 7 |
# File 'lib/jxl/headers/colour_encoding.rb', line 5 def white_point_xy @white_point_xy end |
Class Method Details
.read(reader) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jxl/headers/colour_encoding.rb', line 18 def self.read(reader) return new(**DEFAULT) if Bit::Field.read_bool(reader) want_icc = Bit::Field.read_bool(reader) colour_space = read_enum(reader, [0, 1, 2, 3], "colour space") raise CorruptError, "unknown colour space without ICC" if !want_icc && colour_space == 3 values = DEFAULT.merge(want_icc:, colour_space:) unless want_icc values[:white_point], values[:white_point_xy] = read_white_point(reader, colour_space) values[:primaries], values[:primaries_xy] = read_primaries(reader, colour_space) values[:transfer_function], values[:gamma] = read_transfer_function(reader, colour_space) values[:rendering_intent] = read_enum(reader, [0, 1, 2, 3], "rendering intent") end new(**values) end |