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 Array Geometry HatchFill Draw lib/RMagick.rb lib/rvg/rvg.rb Magick Module: Magick

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 828
828:         def initialize(img, x, y, width, height)
829:             if width <= 0 || height <= 0
830:                 raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
831:             end
832:             if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
833:                 raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
834:             end
835:             @view = img.get_pixels(x, y, width, height)
836:             @img = img
837:             @x = x
838:             @y = y
839:             @width = width
840:             @height = height
841:             @dirty = false
842:         end

Public Instance methods

[Source]

     # File lib/RMagick.rb, line 844
844:         def [](*args)
845:             rows = Rows.new(@view, @width, @height, args)
846:             rows.add_observer(self)
847:             return rows
848:         end

Store changed pixels back to image

[Source]

     # File lib/RMagick.rb, line 851
851:         def sync(force=false)
852:             @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
853:             return (@dirty || force)
854:         end

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

[Source]

     # File lib/RMagick.rb, line 858
858:         def update(rows)
859:             @dirty = true
860:             rows.delete_observer(self)      # No need to tell us again.
861:             nil
862:         end

[Validate]