Quad: Graphene Reference Manual

## Quad Quad — Four-vertex quadrilateral |

## Functions

graphene_quad_t * | graphene_quad_alloc ()
void | graphene_quad_free ()
graphene_quad_t * | graphene_quad_init ()
graphene_quad_t * | graphene_quad_init_from_rect ()
graphene_quad_t * | graphene_quad_init_from_points ()
bool | graphene_quad_contains ()
void | graphene_quad_bounds ()
const graphene_point_t * | graphene_quad_get_point ()

## Types and Values

| graphene_quad_t

## Description

A graphene_quad_t represents a coplanar, four vertex quadrilateral shape.

## Functions

### graphene_quad_alloc ()

    graphene_quad_t *
    graphene_quad_alloc (void);

Allocates a new graphene_quad_t instance.

The contents of the returned instance are undefined.

[constructor]

#### Returns

the newly created graphene_quad_t instance.

[transfer full]

Since: 1.0

### graphene_quad_free ()

    void
    graphene_quad_free (graphene_quad_t *q);

Frees the resources allocated by `graphene_quad_alloc()`

#### Parameters

q | a graphene_quad_t |

Since: 1.0

### graphene_quad_init ()

    graphene_quad_t *
    graphene_quad_init (graphene_quad_t *q,
                        const graphene_point_t *p1,
                        const graphene_point_t *p2,
                        const graphene_point_t *p3,
                        const graphene_point_t *p4);

Initializes a graphene_quad_t with the given points.

#### Parameters

q | the graphene_quad_t to initialize |
p1 | the first point of the quadrilateral |
p2 | the second point of the quadrilateral |
p3 | the third point of the quadrilateral |
p4 | the fourth point of the quadrilateral |

#### Returns

the initialized graphene_quad_t.

[transfer none]

Since: 1.0

### graphene_quad_init_from_rect ()

    graphene_quad_t *
    graphene_quad_init_from_rect (graphene_quad_t *q,
                                  const graphene_rect_t *r);

Initializes a graphene_quad_t using the four corners of the given graphene_rect_t.

#### Parameters

q | the graphene_quad_t to initialize |
r | a graphene_rect_t |

#### Returns

the initialized graphene_quad_t.

[transfer none]

Since: 1.0

### graphene_quad_init_from_points ()

    graphene_quad_t *
    graphene_quad_init_from_points (graphene_quad_t *q,
                                    const graphene_point_t points[]);

Initializes a graphene_quad_t using an array of points.

#### Parameters

q | the graphene_quad_t to initialize |
points | an array of 4 graphene_point_t. | [array fixed-size=4]

#### Returns

the initialized graphene_quad_t.

[transfer none]

Since: 1.2

### graphene_quad_contains ()

    bool
    graphene_quad_contains (const graphene_quad_t *q,
                            const graphene_point_t *p);

Checks if the given graphene_quad_t contains the given graphene_point_t.

#### Parameters

q | a graphene_quad_t |
p | a graphene_point_t |

#### Returns

`true` if the point is inside the graphene_quad_t

Since: 1.0

### graphene_quad_bounds ()

    void
    graphene_quad_bounds (const graphene_quad_t *q,
                          graphene_rect_t *r);

Computes the bounding rectangle of `q` and places it into `r` .

#### Parameters

q | a graphene_quad_t |
r | return location for a graphene_rect_t. | [out caller-allocates]

Since: 1.0

### graphene_quad_get_point ()

    const graphene_point_t *
    graphene_quad_get_point (const graphene_quad_t *q,
                             unsigned int index_);

Retrieves the point of a graphene_quad_t at the given index.

#### Parameters

q | a graphene_quad_t |
index_ | the index of the point to retrieve |

#### Returns

a graphene_point_t.

[transfer none]

Since: 1.0

## Types and Values

### graphene_quad_t

    typedef struct {
    } graphene_quad_t;

A 4 vertex quadrilateral, as represented by four graphene_point_t.

The contents of a graphene_quad_t are private and should never be accessed directly.

Since: 1.0