Object
Represents color in the RGB (Red, Green, Blue) color space.
Create a new instance from an Array or an existing color (of any type). If the alpha (opacity) component is omitted from the array, full opacity will be used.
All color components range from 0.0 to 1.0.
# File lib/rubygame/color/models/rgb.rb, line 42 def initialize( color ) if color.kind_of?(Array) @r, @g, @b, @a = color.collect { |i| i.to_f } @a = 1.0 unless @a elsif color.respond_to?(:to_rgba_ary) @r, @g, @b, @a = color.to_rgba_ary end end
# File lib/rubygame/color/models/rgb.rb, line 57 def to_rgba_ary return [@r, @g, @b, @a] end
# File lib/rubygame/color/models/rgb.rb, line 61 def to_s "#<#{self.class} [#{@r}, #{@g}, #{@b}, #{@a}]>" end
Generated with the Darkfish Rdoc Generator 2.