Sha256: aa9d0dea4dad104d9cc8a63224af445ede17af51bbb5ffdf23f501dc65cb22d5

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

module Jpeg
  class Image
    def at(x, y)
      raise 'invalid position' unless inside? x, y
      dot = raw_data[y][x]
      color? ? Color.new(*dot) : Color.new(dot, dot, dot)
    end

    def rgb?
      color_info == :rgb
    end
    alias color? rgb?

    def gray?
      color_info == :gray
    end

    private

    def inside?(x, y)
      x < width && x >= 0 && y < height && y >= 0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jpeg-0.7.1 lib/jpeg/image.rb