class Rnes::Image
Attributes
height[R]
@return [Integer]
width[R]
@return [Integer]
Public Class Methods
new(height:, width:)
click to toggle source
@param [Integer] height @param [Integer] width
# File lib/rnes/image.rb, line 11 def initialize(height:, width:) @bytes = Array.new(height * width) do [0, 0, 0] end @height = height @width = width end
Public Instance Methods
read(x:, y:)
click to toggle source
@param [Integer] x @param [Integer] y
# File lib/rnes/image.rb, line 21 def read(x:, y:) @bytes[@width * y + x] end
write(value:, x:, y:)
click to toggle source
@param [Array<Integer>] rgb @param [Integer] x @param [Integer] y
# File lib/rnes/image.rb, line 28 def write(value:, x:, y:) @bytes[@width * y + x] = value end