| 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 1040
1040: def initialize(img, x, y, width, height)
1041: img.check_destroyed
1042: if width <= 0 || height <= 0
1043: Kernel.raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
1044: end
1045: if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
1046: Kernel.raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
1047: end
1048: @view = img.get_pixels(x, y, width, height)
1049: @img = img
1050: @x = x
1051: @y = y
1052: @width = width
1053: @height = height
1054: @dirty = false
1055: end
# File lib/RMagick.rb, line 1057
1057: def [](*args)
1058: rows = Rows.new(@view, @width, @height, args)
1059: rows.add_observer(self)
1060: return rows
1061: end
Store changed pixels back to image
# File lib/RMagick.rb, line 1064
1064: def sync(force=false)
1065: @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
1066: return (@dirty || force)
1067: end