| Class | Magick::Image::View |
| In: |
lib/RMagick.rb
|
| Parent: | Object |
Magick::Image::View class
| dirty | [RW] | |
| height | [R] | |
| width | [R] | |
| x | [R] | |
| y | [R] |
# File lib/RMagick.rb, line 828
828: def initialize(img, x, y, width, height)
829: if width <= 0 || height <= 0
830: raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
831: end
832: if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
833: raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
834: end
835: @view = img.get_pixels(x, y, width, height)
836: @img = img
837: @x = x
838: @y = y
839: @width = width
840: @height = height
841: @dirty = false
842: end
# File lib/RMagick.rb, line 844
844: def [](*args)
845: rows = Rows.new(@view, @width, @height, args)
846: rows.add_observer(self)
847: return rows
848: end
Store changed pixels back to image
# File lib/RMagick.rb, line 851
851: def sync(force=false)
852: @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
853: return (@dirty || force)
854: end