Class: Pruim::Palette

Inherits:
Array
  • Object
show all
Defined in:
lib/pruim/palette.rb

Instance Method Summary collapse

Instance Method Details

#new_rgb(r, g, b) ⇒ Object

Adds a new RGB color to this palette. Returns the palette index.



5
6
7
8
# File 'lib/pruim/palette.rb', line 5

def new_rgb(r, g, b)
  self << Pruim::Color.rgb(r, g, b)
  return self.size - 1
end

#new_rgba(r, g, b, a) ⇒ Object

Adds a new RGBA color to this palette. Returns the palette index.



11
12
13
14
# File 'lib/pruim/palette.rb', line 11

def new_rgba(r, g, b, a)
  self << Pruim::Color.rgba(r, g, b, a)
  return self.size - 1
end