class 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(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 #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


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 : Graphene::Point #

def origin=(value : Graphene::Point) #

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 : Graphene::Size #

def size=(value : Graphene::Size) #

def to_unsafe #

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 #