Cairo: A Vector Graphics Library: Types

## Types Types — Generic data types |

## Functions

void | (*cairo_destroy_func_t) ()

## Types and Values

typedef | cairo_bool_t
| cairo_user_data_key_t
| cairo_rectangle_int_t

## Object Hierarchy

## Description

This section lists generic data types used in the cairo API.

## Functions

### cairo_destroy_func_t ()

    void
    (*cairo_destroy_func_t) (void *data);

cairo_destroy_func_t the type of function which is called when a data element is destroyed. It is passed the pointer to the data element and should free any memory and resources allocated for it.

#### Parameters

data | The data element being destroyed. |

Since 1.0

## Types and Values

### cairo_bool_t

    typedef int cairo_bool_t;

cairo_bool_t is used for boolean values. Returns of type cairo_bool_t will always be either 0 or 1, but testing against these values explicitly is not encouraged; just use the value as a boolean condition.

     if (cairo_in_stroke (cr, x, y)) {
         /* do something */
     }

Since 1.0

### cairo_user_data_key_t

    typedef struct {
        int unused;
    } cairo_user_data_key_t;

cairo_user_data_key_t is used for attaching user data to cairo data structures. The actual contents of the struct is never used, and there is no need to initialize the object; only the unique address of a cairo_data_key_t object is used. Typically, you would just use the address of a static cairo_data_key_t object.

#### Members

int `unused`; | not used; ignore. |

Since 1.0

### cairo_rectangle_int_t

    typedef struct {
        int x, y;
        int width, height;
    } cairo_rectangle_int_t;

A data structure for holding a rectangle with integer coordinates.

#### Members

int `x`; | X coordinate of the left side of the rectangle |
int `y`; | Y coordinate of the the top side of the rectangle |
int `width`; | width of the rectangle |
int `height`; | height of the rectangle |

Since 1.10