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) #

[View source]
def self.new(data : LibGraphene::Rect, _transfer : GICrystal::Transfer) #

[View source]
def self.new(origin : Graphene::Point | Nil = nil, size : Graphene::Size | Nil = nil) #

[View source]

Class Method Detail

def self.alloc : Graphene::Rect #

[View source]
def self.g_type : UInt64 #

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


[View source]
def self.zero : Graphene::Rect #

[View source]

Instance Method Detail

def ==(other : self) : Bool #

[View source]
def area : Float32 #

[View source]
def bottom_left : Graphene::Point #

[View source]
def bottom_right : Graphene::Point #

[View source]
def center : Graphene::Point #

[View source]
def contains_point(p : Graphene::Point) : Bool #

[View source]
def contains_rect(b : Graphene::Rect) : Bool #

[View source]
def equal(b : Graphene::Rect) : Bool #

[View source]
def expand(p : Graphene::Point) : Graphene::Rect #

[View source]
def free : Nil #

[View source]
def height : Float32 #

[View source]
def init(x : Float32, y : Float32, width : Float32, height : Float32) : Graphene::Rect #

[View source]
def init_from_rect(src : Graphene::Rect) : Graphene::Rect #

[View source]
def inset(d_x : Float32, d_y : Float32) : Graphene::Rect #

[View source]
def inset_r(d_x : Float32, d_y : Float32) : Graphene::Rect #

[View source]
def interpolate(b : Graphene::Rect, factor : Float64) : Graphene::Rect #

[View source]
def intersection(b : Graphene::Rect) : Graphene::Rect #

[View source]
def normalize : Graphene::Rect #

[View source]
def normalize_r : Graphene::Rect #

[View source]
def offset(d_x : Float32, d_y : Float32) : Graphene::Rect #

[View source]
def offset_r(d_x : Float32, d_y : Float32) : Graphene::Rect #

[View source]
def origin(*args, **options) #

[View source]
def origin(*args, **options, &) #

[View source]
def origin=(arg) #

[View source]
def round : Graphene::Rect #

DEPRECATED


[View source]
def round_extents : Graphene::Rect #

[View source]
def round_to_pixel : Graphene::Rect #

DEPRECATED


[View source]
def scale(s_h : Float32, s_v : Float32) : Graphene::Rect #

[View source]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]
def size=(arg) #

[View source]
def top_left : Graphene::Point #

[View source]
def top_right : Graphene::Point #

[View source]
def union(b : Graphene::Rect) : Graphene::Rect #

[View source]
def vertices(vertices : Enumerable(Graphene::Vec2)) : Nil #

[View source]
def vertices(*vertices : Graphene::Vec2) #

[View source]
def width : Float32 #

[View source]
def x : Float32 #

[View source]
def y : Float32 #

[View source]