class Cairo::Color::CMYK - cairo-1.14.1 Documentation

# class Cairo::Color::CMYK

### Attributes

c[RW]
c=[RW]
cyan[RW]
k[RW]
k=[RW]
key_plate[RW]
m[RW]
m=[RW]
magenta[RW]
y[RW]
y=[RW]
yellow[RW]

### Public Class Methods

new(c, m, y, k, a=1.0) click to toggle source
Calls superclass method Cairo::Color::Base.new

    # File lib/cairo/color.rb, line 168
    def initialize(c, m, y, k, a=1.0)
      super(a)
      assert_in_range(c, "cyan")
      assert_in_range(m, "magenta")
      assert_in_range(y, "yellow")
      assert_in_range(k, "key plate")
      @cyan = c
      @magenta = m
      @yellow = y
      @key_plate = k
    end

### Public Instance Methods

to_a() click to toggle source

    # File lib/cairo/color.rb, line 180
    def to_a
      [@cyan, @magenta, @yellow, @key_plate, @alpha]
    end

Also aliased as: to_ary
to_ary()
Alias for: to_a
to_cmyk() click to toggle source

    # File lib/cairo/color.rb, line 196
    def to_cmyk
      clone
    end

to_hsv() click to toggle source

    # File lib/cairo/color.rb, line 200
    def to_hsv
      to_rgb.to_hsv
    end

to_rgb() click to toggle source

    # File lib/cairo/color.rb, line 185
    def to_rgb
      one_k = 1.0 - @key_plate
      rgba = [
              (1.0 - @cyan) * one_k,
              (1.0 - @magenta) * one_k,
              (1.0 - @yellow) * one_k,
              @alpha,
             ]
      RGB.new(*rgba)
    end