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 965 965: def initialize(img, x, y, width, height) 966: if width <= 0 || height <= 0 967: Kernel.raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})" 968: end 969: if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows 970: Kernel.raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary" 971: end 972: @view = img.get_pixels(x, y, width, height) 973: @img = img 974: @x = x 975: @y = y 976: @width = width 977: @height = height 978: @dirty = false 979: end
# File lib/RMagick.rb, line 981 981: def [](*args) 982: rows = Rows.new(@view, @width, @height, args) 983: rows.add_observer(self) 984: return rows 985: end
Store changed pixels back to image
# File lib/RMagick.rb, line 988 988: def sync(force=false) 989: @img.store_pixels(x, y, width, height, @view) if (@dirty || force) 990: return (@dirty || force) 991: end