Class: Magick::Image::View
- Inherits:
-
Object
- Object
- Magick::Image::View
- Defined in:
- lib/RMagick.rb
Overview
Magick::Image::View class
Defined Under Namespace
Instance Attribute Summary collapse
-
#dirty ⇒ Object
Returns the value of attribute dirty.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #[](*args) ⇒ Object
-
#initialize(img, x, y, width, height) ⇒ View
constructor
A new instance of View.
-
#sync(force = false) ⇒ Object
Store changed pixels back to image.
-
#update(rows) ⇒ Object
Get update from Rows - if @dirty ever becomes true, don’t change it back to false!.
Constructor Details
#initialize(img, x, y, width, height) ⇒ View
Returns a new instance of View.
744 745 746 747 748 749 750 751 752 |
# File 'lib/RMagick.rb', line 744 def initialize(img, x, y, width, height) @view = img.get_pixels(x, y, width, height) @img = img @x = x @y = y @width = width @height = height @dirty = false end |
Instance Attribute Details
#dirty ⇒ Object
Returns the value of attribute dirty.
742 743 744 |
# File 'lib/RMagick.rb', line 742 def dirty @dirty end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
741 742 743 |
# File 'lib/RMagick.rb', line 741 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
741 742 743 |
# File 'lib/RMagick.rb', line 741 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
741 742 743 |
# File 'lib/RMagick.rb', line 741 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
741 742 743 |
# File 'lib/RMagick.rb', line 741 def y @y end |
Instance Method Details
#[](*args) ⇒ Object
754 755 756 757 758 |
# File 'lib/RMagick.rb', line 754 def [](*args) rows = Rows.new(@view, @width, @height, args) rows.add_observer(self) return rows end |
#sync(force = false) ⇒ Object
Store changed pixels back to image
761 762 763 764 |
# File 'lib/RMagick.rb', line 761 def sync(force=false) @img.store_pixels(x, y, width, height, @view) if (@dirty || force) return (@dirty || force) end |
#update(rows) ⇒ Object
Get update from Rows - if @dirty ever becomes true, don’t change it back to false!
768 769 770 771 772 |
# File 'lib/RMagick.rb', line 768 def update(rows) @dirty = true rows.delete_observer(self) # No need to tell us again. nil end |