Sha256: e16794632a8f6f994c4a9680ec67a82a92ee36cf6768a2ac97c4bbb9e72c8b27

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

# -*- coding: utf-8 -*-


require 'rays/ext'


module Rays


  class Bitmap

    include Enumerable

    def initialize (width, height, colorspace = RGBA)
      colorspace = case colorspace
      when :GRAY then GRAY
      when :RGB  then RGB
      when :RGBA then RGBA
      else colorspace
      end
      setup width, height, colorspace
    end

    def each ()
      height.times do |y|
        width.times do |x|
          yield x, y, at(x, y)
        end
      end
    end

    def size ()
      [width, height]
    end

  end# Bitmap


end# Rays

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rays-0.1.6 lib/rays/bitmap.rb
rays-0.1.5 lib/rays/bitmap.rb
rays-0.1.4 lib/rays/bitmap.rb