struct CrImage::Region

Overview

Represents a rectangular area on an Image from its upper left corner #x and #y coordinates, and a #width and #height.

See Operation::Crop#crop and Operation::Draw#draw_square for examples using it.

Defined in:

cr-image/region.cr

Constructors

Instance Method Summary

Constructor Detail

def self.center(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region #

[View source]
def self.new(x : UInt16, y : UInt16, width : UInt16, height : UInt16) #

[View source]

Instance Method Detail

def center : Tuple(Int32, Int32) #

Return the {x, y} tuple of the center coordinates of this Region


[View source]
def clone #

[View source]
def copy_with(x _x = @x, y _y = @y, width _width = @width, height _height = @height) #

[View source]
def crop(image : Image) : Image #

Crop a provided Image with this region, using Operation::Crop#crop


[View source]
def height : UInt16 #

def to_tuple : Tuple(Int32, Int32, Int32, Int32) #

Return this Region as a #x, #y, #width, and #height tuple


[View source]
def width : UInt16 #

def x : UInt16 #

def y : UInt16 #