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/units.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 781
781:         def initialize(img, x, y, width, height)
782:             if width <= 0 || height <= 0
783:                 raise ArgumentError, "invalid geometry (#{width}x#{height}+#{x}+#{y})"
784:             end
785:             if x < 0 || y < 0 || (x+width) > img.columns || (y+height) > img.rows
786:                 raise RangeError, "geometry (#{width}x#{height}+#{x}+#{y}) exceeds image boundary"
787:             end
788:             @view = img.get_pixels(x, y, width, height)
789:             @img = img
790:             @x = x
791:             @y = y
792:             @width = width
793:             @height = height
794:             @dirty = false
795:         end

Public Instance methods

[Source]

     # File lib/RMagick.rb, line 797
797:         def [](*args)
798:             rows = Rows.new(@view, @width, @height, args)
799:             rows.add_observer(self)
800:             return rows
801:         end

Store changed pixels back to image

[Source]

     # File lib/RMagick.rb, line 804
804:         def sync(force=false)
805:             @img.store_pixels(x, y, width, height, @view) if (@dirty || force)
806:             return (@dirty || force)
807:         end

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

[Source]

     # File lib/RMagick.rb, line 811
811:         def update(rows)
812:             @dirty = true
813:             rows.delete_observer(self)      # No need to tell us again.
814:             nil
815:         end

[Validate]