class Magick::Image::View

Magick::Image::View class

def [](*args)

def [](*args)
  rows = Rows.new(@view, @width, @height, args)
  rows.add_observer(self)
  rows
end

def initialize(img, x, y, width, height)

def initialize(img, x, y, width, height)
  img.check_destroyed
  if width <= 0 || height <= 0
    Kernel.raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
  end
  if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
    Kernel.raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
  end
  @view = img.get_pixels(x, y, width, height)
  @img = img
  @x = x
  @y = y
  @width = width
  @height = height
  @dirty = false
end

def sync(force=false)

Store changed pixels back to image
def sync(force=false)
  @img.store_pixels(x, y, width, height, @view) if @dirty || force
  @dirty || force
end

def update(rows)

true, don't change it back to false!
Get update from Rows - if @dirty ever becomes
def update(rows)
  @dirty = true
  rows.delete_observer(self)      # No need to tell us again.
  nil
end