| 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 1014
1014: def initialize(img, x, y, width, height)
1015: img.check_destroyed
1016: if width <= 0 || height <= 0
1017: Kernel.raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
1018: end
1019: if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
1020: Kernel.raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
1021: end
1022: @view = img.get_pixels(x, y, width, height)
1023: @img = img
1024: @x = x
1025: @y = y
1026: @width = width
1027: @height = height
1028: @dirty = false
1029: end
# File lib/RMagick.rb, line 1031
1031: def [](*args)
1032: rows = Rows.new(@view, @width, @height, args)
1033: rows.add_observer(self)
1034: return rows
1035: end
Store changed pixels back to image
# File lib/RMagick.rb, line 1038
1038: def sync(force=false)
1039: @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
1040: return (@dirty || force)
1041: end