Sha256: 255da21abb5d8e0f8ea49843adbb14985c84276e3867974f350b7f555f753e7f

Contents?: true

Size: 628 Bytes

Versions: 6

Compression:

Stored size: 628 Bytes

Contents

# -*- coding: utf-8 -*-


require 'rays/ext'


module Rays


  class ColorSpace

    def initialize (type = :RGBA, premultiplied = true)
      setup self.class.get_type(type), premultiplied
    end

    def self.get_type (obj)
      case obj
      when Integer        then obj
      when String, Symbol then const_get obj
      else raise ArgumentError, "can not convert '#{obj}' to ColorSpace type."
      end
    rescue NameError
      raise "ColoeSpace::#{obj} is not found."
    end

    def self.get_color_space (obj)
      (ColorSpace === obj) ? obj : (ColorSpace.new get_type(obj))
    end

  end# ColorSpace


end# Rays

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rays-0.1.12 lib/rays/color_space.rb
rays-0.1.11 lib/rays/color_space.rb
rays-0.1.10 lib/rays/color_space.rb
rays-0.1.9 lib/rays/color_space.rb
rays-0.1.8 lib/rays/color_space.rb
rays-0.1.7 lib/rays/color_space.rb