Sha256: 77f2d4e2940760d077320c2140cf85c6c273f32cc60a4a9ee6c5b6553b46c29c

Contents?: true

Size: 459 Bytes

Versions: 5

Compression:

Stored size: 459 Bytes

Contents

require 'rays/ext'


module Rays


  class Bitmap

    include Enumerable

    def each()
      height.times do |y|
        width.times do |x|
          yield self[x, y], x, y
        end
      end
    end

    def pixels()
      case o = pixels!
      when Array  then o
      when String then o.unpack 'L*'
      end
    end

    def bounds()
      Bounds.new 0, 0, width, height
    end

    def to_a()
      map {|o| o}
    end

  end# Bitmap


end# Rays

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rays-0.3.4 lib/rays/bitmap.rb
rays-0.3.3 lib/rays/bitmap.rb
rays-0.3.2 lib/rays/bitmap.rb
rays-0.3.1 lib/rays/bitmap.rb
rays-0.3 lib/rays/bitmap.rb