class Clutter::Color - clutter-2.2.5 Documentation

# class Clutter::Color

### Public Class Methods

hls(hue, luminance, saturation, alpha=255) click to toggle source

    # File lib/clutter/color.rb, line 44
    def hls(hue, luminance, saturation, alpha=255)
      hlsa(hue, luminance, saturation, alpha)
    end

hlsa(hue, luminance, saturation, alpha) click to toggle source

    # File lib/clutter/color.rb, line 48
    def hlsa(hue, luminance, saturation, alpha)
      if respond_to?(:from_hls, true)
        color = from_hls(hue, luminance, saturation)
      else
        color = new
        color.from_hls(hue, luminance, saturation)
      end
      color.alpha = alpha
      color
    end

new(*args) click to toggle source
Calls superclass method

    # File lib/clutter/color.rb, line 24
    def new(*args)
      if [Symbol] == args.collect(&:class)
        name = args[0]
        get_static(name)
      else
        if args.empty?
          args = [0, 0, 0, 1] unless private_method_defined?(:initialize_alloc)
        end
        super(*args)
      end
    end

parse(string) click to toggle source

    # File lib/clutter/color.rb, line 69
    def parse(string)
      if respond_to?(:from_string, true)
        succeeded, color = from_string(string)
      else
        color = new
        succeeded = color.from_string(string)
      end
      unless succeeded
        raise ArgumentError, "invalid color string: <#{string}>"
      end
      color
    end

pixel(pixel) click to toggle source

    # File lib/clutter/color.rb, line 59
    def pixel(pixel)
      if respond_to?(:from_pixel, true)
        color = from_pixel(pixel)
      else
        color = new
        color.from_pixel(pixel)
      end
      color
    end

rgb(red, green, blue, alpha=255) click to toggle source

    # File lib/clutter/color.rb, line 36
    def rgb(red, green, blue, alpha=255)
      rgba(red, green, blue, alpha)
    end

rgba(red, green, blue, alpha) click to toggle source

    # File lib/clutter/color.rb, line 40
    def rgba(red, green, blue, alpha)
      new(red, green, blue, alpha)
    end