class Color::QTR

Constants

Channels

QTR channel map (in calibration mode):

R: inverse bitmask for channels

  7: K     = 127 (01111111)
  6: C     = 191 (10111111)
  5: M     = 223 (11011111)
  4: Y     = 239 (11101111)
  3: LC    = 247 (11110111)
  2: LM    = 251 (11111011)
  1: LK    = 253 (11111101)
  0: LLK = 254 (11111110)

G: value (0-255)

B: unused -- should always be 255

For background, use R=127 / G=255 / B=255

Public Class Methods

cgats_fields() click to toggle source
# File lib/quadtone/color/qtr.rb, line 35
def self.cgats_fields
  %w{QTR_CHANNEL QTR_VALUE}
end
component_names() click to toggle source
# File lib/quadtone/color/qtr.rb, line 31
def self.component_names
  [:channel, :value]
end

Public Instance Methods

channel() click to toggle source
# File lib/quadtone/color/qtr.rb, line 39
def channel
  @components[0]
end
channel_num() click to toggle source
# File lib/quadtone/color/qtr.rb, line 43
def channel_num
  Channels.index(channel)
end
to_cgats() click to toggle source
# File lib/quadtone/color/qtr.rb, line 62
def to_cgats
  {
    'QTR_CHANNEL' => channel,
    'QTR_VALUE' => value,
  }
end
to_gray() click to toggle source
# File lib/quadtone/color/qtr.rb, line 58
def to_gray
  Color::Gray.new(k: value)
end
to_rgb() click to toggle source
# File lib/quadtone/color/qtr.rb, line 51
def to_rgb
  Color::RGB.new(
    r: (255 - (1 << channel_num)) / 255.0,
    g: (1 - value) / 100,
    b: 1)
end
value() click to toggle source
# File lib/quadtone/color/qtr.rb, line 47
def value
  @components[1]
end