class SDL::Palette
Public Instance Methods
at( index )
click to toggle source
Returns the color at the given index in the palette, as an SDL::Color instance.
# File lib/ruby-sdl-ffi/sdl/video.rb, line 68 def at( index ) index = (0...ncolors).to_a.at(index) if index SDL::Color.new( self[:colors] + index * SDL::Color.size ) end end
each() { |at(i)| ... }
click to toggle source
Yields an SDL::Color for each color in the palette.
# File lib/ruby-sdl-ffi/sdl/video.rb, line 76 def each ncolors.times{ |i| yield at(i) } end