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