Method: Magick::Image#view

Defined in:
lib/rmagick_internal.rb

#view(x, y, width, height) ⇒ Object

Construct a view. If a block is present, yield and pass the view object, otherwise return the view object.



1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
# File 'lib/rmagick_internal.rb', line 1018

def view(x, y, width, height)
  view = View.new(self, x, y, width, height)

  return view unless block_given?

  begin
    yield(view)
  ensure
    view.sync
  end
  nil
end