Class: Carbuncle::Color

Inherits:
Object show all
Extended by:
Vectorizable::ClassMethods
Includes:
Vectorizable
Defined in:
gems/carbuncle-graphics/mrblib/color.rb

Constant Summary

Constants included from Vectorizable

Vectorizable::CLASS

Constants included from Enumerable

Enumerable::NONE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Vectorizable::ClassMethods

vectorize_properties

Methods included from Vectorizable

#%, #*, #**, #+, #-, #-@, #/, #<<, #>>, #[], #[]=, #each, #length, #to_s

Methods included from Enumerable

__update_hash, #all?, #any?, #chain, #collect, #count, #cycle, #detect, #drop, #drop_while, #each_cons, #each_slice, #each_with_index, #each_with_object, #entries, #filter_map, #find_all, #find_index, #first, #flat_map, #grep, #group_by, #hash, #include?, #inject, #lazy, #max, #max_by, #min, #min_by, #minmax, #minmax_by, #none?, #one?, #partition, #reject, #reverse_each, #sort, #sort_by, #sum, #take, #take_while, #tally, #to_h, #uniq, #zip

Class Method Details

.randomObject



8
9
10
# File 'gems/carbuncle-graphics/mrblib/color.rb', line 8

def random
  new(rand(255), rand(255), rand(255))
end

Instance Method Details

#inspectObject



13
14
15
# File 'gems/carbuncle-graphics/mrblib/color.rb', line 13

def inspect
  "Color(#{r}, #{g}, #{b}, #{a})"
end

#sizeObject



17
18
19
# File 'gems/carbuncle-graphics/mrblib/color.rb', line 17

def size
  4
end

#to_aObject



21
22
23
# File 'gems/carbuncle-graphics/mrblib/color.rb', line 21

def to_a
  [r, g, b, a]
end