Package: graphene

CStruct graphene:rect-t

Declaration

(cffi:defcstruct rect-t
  (origin (:struct point-t))
  (size (:struct size-t)))  

Values

origin
The graphene:point-t instance for the coordinates for the origin of the rectangle.
size
The graphene:size-t instance for the size of the rectangle.

Details

The location and size of a rectangle region. The width and height of a graphene:rect-t instance can be negative. For instance, a graphene:rect-t instance with an origin of (0,0) and a size of (10,10) is equivalent to a graphene:rect-t instance with an origin of (10,10) and a size of (-10,-10).

Application code can normalize rectangles using the graphene:rect-normalize function. This function will ensure that the width and height of a rectangle are positive values. All functions taking a graphene:rect-t instance as an argument will internally operate on a normalized copy. All functions returning a graphene:rect-t instance will always return a normalized rectangle.

Examples

A rectangle with a negative size is normalized internally:
(graphene:with-rect (rect 10 10 -10 -10)
  (list (graphene:rect-x rect)
        (graphene:rect-y rect)
        (graphene:rect-width rect)
        (graphene:rect-height rect)))
=> (0.0 0.0 10.0 10.0)    
 

Slot Access Functions

See also

2025-3-8