class Vips::Region
A region on an image. Create one, then use ‘fetch` to quickly get a region of pixels.
For example:
```ruby region = Vips::Region.new(image) pixels = region.fetch(10, 10, 100, 100) ```
Public Class Methods
Source
# File lib/vips/region.rb, line 46 def initialize(name) ptr = Vips::vips_region_new name raise Vips::Error if ptr.null? super ptr end
Calls superclass method
GObject::GObject::new
Public Instance Methods
Source
# File lib/vips/region.rb, line 62 def fetch(left, top, width, height) len = Vips::SizeStruct.new ptr = Vips::vips_region_fetch self, left, top, width, height, len raise Vips::Error if ptr.null? # wrap up as an autopointer ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE) ptr.get_bytes 0, len[:value] end
Fetch a region filled with pixel data.