struct Graphene::Rect

Overview

The location and size of a rectangle region.

The width and height of a #graphene_::rect_t can be negative; for instance, a #graphene_::rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is equivalent to a #graphene_::rect_t with an origin of [ 10, 10 ] and a size of [ -10, -10 ].

Application code can normalize rectangles using graphene_::rect_normalize(); this function will ensure that the width and height of a rectangle are positive values. All functions taking a #graphene_::rect_t as an argument will internally operate on a normalized copy; all functions returning a #graphene_::rect_t will always return a normalized rectangle.

Defined in:

lib/gi-crystal/src/auto/graphene-1.0/rect.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pointer : Pointer(Void), transfer : GICrystal::Transfer) #

def self.new(data : LibGraphene::Rect, _transfer : GICrystal::Transfer) #

def self.new(origin : Graphene::Point? = nil, size : Graphene::Size? = nil) #

Class Method Detail

def self.alloc : Graphene::Rect #

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


def self.zero : Graphene::Rect #

Instance Method Detail

def ==(other : self) : Bool #

def area : Float32 #

def bottom_left : Graphene::Point #

def bottom_right : Graphene::Point #

def center : Graphene::Point #

def contains_point(p : Graphene::Point) : Bool #

def contains_rect(b : Graphene::Rect) : Bool #

def equal(b : Graphene::Rect) : Bool #

def expand(p : Graphene::Point) : Graphene::Rect #

def free : Nil #

def height : Float32 #

def init(x : Float32, y : Float32, width : Float32, height : Float32) : Graphene::Rect #

def init_from_rect(src : Graphene::Rect) : Graphene::Rect #

def inset(d_x : Float32, d_y : Float32) : Graphene::Rect #

def inset_r(d_x : Float32, d_y : Float32) : Graphene::Rect #

def interpolate(b : Graphene::Rect, factor : Float64) : Graphene::Rect #

def intersection(b : Graphene::Rect) : Graphene::Rect #

def normalize : Graphene::Rect #

def normalize_r : Graphene::Rect #

def offset(d_x : Float32, d_y : Float32) : Graphene::Rect #

def offset_r(d_x : Float32, d_y : Float32) : Graphene::Rect #

def origin(*args, **options) #

def origin(*args, **options, &) #

def origin=(arg) #

def round : Graphene::Rect #

def round_extents : Graphene::Rect #

def round_to_pixel : Graphene::Rect #

def scale(s_h : Float32, s_v : Float32) : Graphene::Rect #

def size(*args, **options) #

def size(*args, **options, &) #

def size=(arg) #

def top_left : Graphene::Point #

def top_right : Graphene::Point #

def union(b : Graphene::Rect) : Graphene::Rect #

def vertices(vertices : Enumerable(Graphene::Vec2)) : Nil #

def vertices(*vertices : Graphene::Vec2) #

def width : Float32 #

def x : Float32 #

def y : Float32 #