Class Magick::Image::View
In: lib/RMagick.rb
Parent: Object
Enum GeometryValue Stylable RVG\n[lib/rvg/clippath.rb\nlib/rvg/container.rb\nlib/rvg/deep_equal.rb\nlib/rvg/describable.rb\nlib/rvg/embellishable.rb\nlib/rvg/misc.rb\nlib/rvg/paint.rb\nlib/rvg/pathdata.rb\nlib/rvg/rvg.rb\nlib/rvg/stretchable.rb\nlib/rvg/stylable.rb\nlib/rvg/text.rb\nlib/rvg/transformable.rb\nlib/rvg/units.rb] Transformable Stretchable Embellishable Describable Duplicatable Comparable Image ImageList Enumerable Geometry OptionalMethodArguments HatchFill Draw lib/RMagick.rb lib/rvg/misc.rb ObjectData Application Pre_ObjectData_Descriptor Envelope Post_ObjectData_Descriptor IPTC Magick dot/m_14_0.png

Methods

[]   new   sync   update  

Classes and Modules

Class Magick::Image::View::Pixels
Class Magick::Image::View::Rows

Attributes

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

Public Class methods

[Source]

      # 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

Public Instance methods

[Source]

      # 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

[Source]

      # 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

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

[Source]

      # File lib/RMagick.rb, line 1078
1078:         def update(rows)
1079:             @dirty = true
1080:             rows.delete_observer(self)      # No need to tell us again.
1081:             nil
1082:         end

[Validate]