Synopsis

#include <cpml-1/cpml.h>

struct              CpmlExtents;
void                cpml_extents_copy                   (CpmlExtents *extents,
                                                         const CpmlExtents *src);
void                cpml_extents_from_cairo_text        (CpmlExtents *extents,
                                                         const cairo_text_extents_t *cairo_extents);
int                 cpml_extents_equal                  (const CpmlExtents *extents,
                                                         const CpmlExtents *src);
void                cpml_extents_add                    (CpmlExtents *extents,
                                                         const CpmlExtents *src);
void                cpml_extents_pair_add               (CpmlExtents *extents,
                                                         const CpmlPair *src);
int                 cpml_extents_is_inside              (const CpmlExtents *extents,
                                                         const CpmlExtents *src);
int                 cpml_extents_pair_is_inside         (const CpmlExtents *extents,
                                                         const CpmlPair *src);
void                cpml_extents_transform              (CpmlExtents *extents,
                                                         const cairo_matrix_t *matrix);

Description

The CpmlExtents struct groups two pairs representing the rectangular area of a bounding box.

Details

struct CpmlExtents

struct CpmlExtents {
    int          is_defined;
    CpmlPair     org;
    CpmlVector   size;
};

A structure defining a bounding box area. These APIs expect the size of the extents to be always positives, so be careful while directly accessing the size field.

int is_defined;

set to 0 when these extents are undefined

CpmlPair org;

the lowest x,y coordinates

CpmlVector size;

the width (x) and height (y) of the extents

Since 1.0


cpml_extents_copy ()

void                cpml_extents_copy                   (CpmlExtents *extents,
                                                         const CpmlExtents *src);

Copies src in extents.

extents :

the destination CpmlExtents. [out]

src :

the source CpmlExtents. [in]

Since 1.0


cpml_extents_from_cairo_text ()

void                cpml_extents_from_cairo_text        (CpmlExtents *extents,
                                                         const cairo_text_extents_t *cairo_extents);

Converts cairo_extents in a CpmlExtents format and stores the result in extents.

extents :

the destination CpmlExtents. [out]

cairo_extents :

the source cairo_text_extents_t. [in][type gpointer]

Since 1.0


cpml_extents_equal ()

int                 cpml_extents_equal                  (const CpmlExtents *extents,
                                                         const CpmlExtents *src);

Compares extents to src and returns 1 if the extents are equals. Two NULL or two undefined extents are considered equal, athough NULL extents are not equal to undefined extents.

extents :

the first extents to compare

src :

the second extents to compare

Returns :

1 if extents is equal to src, 0 otherwise. [type gboolean]

Since 1.0


cpml_extents_add ()

void                cpml_extents_add                    (CpmlExtents *extents,
                                                         const CpmlExtents *src);

Merges extents and src and store the result in extents.

extents :

the destination CpmlExtents. [inout]

src :

the extents to add. [in]

Since 1.0


cpml_extents_pair_add ()

void                cpml_extents_pair_add               (CpmlExtents *extents,
                                                         const CpmlPair *src);

Extends extents, if required, to include src. If extents is undefined, the origin of extents is set to src and its size will be (0,0).

extents :

the source and destination CpmlExtents. [inout]

src :

the CpmlPair to add. [in]

Since 1.0


cpml_extents_is_inside ()

int                 cpml_extents_is_inside              (const CpmlExtents *extents,
                                                         const CpmlExtents *src);

Checks wheter src is enterely contained by extents. If extents is undefined, 0 will be returned. If src is undefined, 1 will be returned. The border of extents is considered inside.

extents :

the container CpmlExtents

src :

the subject CpmlExtents

Returns :

1 if src is totally inside extents, 0 otherwise. [type gboolean]

Since 1.0


cpml_extents_pair_is_inside ()

int                 cpml_extents_pair_is_inside         (const CpmlExtents *extents,
                                                         const CpmlPair *src);

Checks wheter src is inside extents. If extents is undefined, 0 will be returned. The border of extents is considered inside.

extents :

the container CpmlExtents

src :

the subject CpmlPair

Returns :

1 if src is inside extents, 0 otherwise. [type gboolean]

Since 1.0


cpml_extents_transform ()

void                cpml_extents_transform              (CpmlExtents *extents,
                                                         const cairo_matrix_t *matrix);

Transforms the four corners of extents with matrix and recomputes extents. This will logically equivalent to transform an extents box and gets the extents of the resulting shape.

extents :

the container CpmlExtents. [inout]

matrix :

the transformation matrix. [in]

Since 1.0