class Vips::Region
“‘
pixels = region.fetch(10, 10, 100, 100)
region = Vips::Region.new(image)
“`ruby
For example:
of pixels.
A region on an image. Create one, then use `fetch` to quickly get a region
def fetch(left, top, width, height)
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
def height
def height Vips.vips_region_height self end
def initialize(name)
def initialize(name) pointer = Vips.vips_region_new name raise Vips::Error if pointer.null? super(pointer) end
def width
def width Vips.vips_region_width self end