In Files

Parent

Class Index [+]

Quicksearch

Magick::Image::View

Magick::Image::View class

Attributes

x[R]
y[R]
width[R]
height[R]
dirty[RW]

Public Class Methods

new(img, x, y, width, height) click to toggle source
      # File lib/RMagick.rb, line 1061
1061:         def initialize(img, x, y, width, height)
1062:             img.check_destroyed
1063:             if width <= 0 || height <= 0
1064:                 Kernel.raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
1065:             end
1066:             if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
1067:                 Kernel.raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
1068:             end
1069:             @view = img.get_pixels(x, y, width, height)
1070:             @img = img
1071:             @x = x
1072:             @y = y
1073:             @width = width
1074:             @height = height
1075:             @dirty = false
1076:         end

Public Instance Methods

[](*args) click to toggle source
      # File lib/RMagick.rb, line 1078
1078:         def [](*args)
1079:             rows = Rows.new(@view, @width, @height, args)
1080:             rows.add_observer(self)
1081:             return rows
1082:         end
sync(force=false) click to toggle source

Store changed pixels back to image

      # File lib/RMagick.rb, line 1085
1085:         def sync(force=false)
1086:             @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
1087:             return (@dirty || force)
1088:         end
update(rows) click to toggle source

Get update from Rows - if @dirty ever becomes true, don’t change it back to false!

      # File lib/RMagick.rb, line 1092
1092:         def update(rows)
1093:             @dirty = true
1094:             rows.delete_observer(self)      # No need to tell us again.
1095:             nil
1096:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.