## cairo_pattern_t

cairo_pattern_t —

## Synopsis

    typedef     cairo_pattern_t;
    cairo_pattern_t* cairo_pattern_create_for_surface
                                                (cairo_surface_t *surface);
    cairo_pattern_t* cairo_pattern_create_linear
                                                (double x0,
                                                 double y0,
                                                 double x1,
                                                 double y1);
    cairo_pattern_t* cairo_pattern_create_radial
                                                (double cx0,
                                                 double cy0,
                                                 double radius0,
                                                 double cx1,
                                                 double cy1,
                                                 double radius1);
    void        cairo_pattern_reference         (cairo_pattern_t *pattern);
    void        cairo_pattern_destroy           (cairo_pattern_t *pattern);
    cairo_status_t cairo_pattern_status         (cairo_pattern_t *pattern);
    void        cairo_pattern_add_color_stop_rgb
                                                (cairo_pattern_t *pattern,
                                                 double offset,
                                                 double red,
                                                 double green,
                                                 double blue);
    void        cairo_pattern_add_color_stop_rgba
                                                (cairo_pattern_t *pattern,
                                                 double offset,
                                                 double red,
                                                 double green,
                                                 double blue,
                                                 double alpha);
    void        cairo_pattern_set_matrix        (cairo_pattern_t *pattern,
                                                 const cairo_matrix_t *matrix);
    void        cairo_pattern_get_matrix        (cairo_pattern_t *pattern,
                                                 cairo_matrix_t *matrix);
    enum        cairo_extend_t;
    void        cairo_pattern_set_extend        (cairo_pattern_t *pattern,
                                                 cairo_extend_t extend);
    cairo_extend_t cairo_pattern_get_extend     (cairo_pattern_t *pattern);
    void        cairo_pattern_set_filter        (cairo_pattern_t *pattern,
                                                 cairo_filter_t filter);
    cairo_filter_t cairo_pattern_get_filter     (cairo_pattern_t *pattern);

## Description

## Details

### cairo_pattern_t

    typedef struct _cairo_pattern cairo_pattern_t;

### cairo_pattern_create_for_surface ()

    cairo_pattern_t* cairo_pattern_create_for_surface
                                                (cairo_surface_t *surface);

Create a new cairo_pattern_t for the given surface.

`surface` : | the surface
Returns : | the newly created cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call `cairo_pattern_destroy()` when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use `cairo_pattern_status()`.

### cairo_pattern_create_linear ()

    cairo_pattern_t* cairo_pattern_create_linear
                                                (double x0,
                                                 double y0,
                                                 double x1,
                                                 double y1);

Create a new linear gradient cairo_pattern_t along the line defined by (x0, y0) and (x1, y1). Before using the gradient pattern, a number of color stops should be defined using `cairo_pattern_add_color_stop_rgb()` or `cairo_pattern_add_color_stop_rgba()`.

`x0` : | x coordinate of the start point
`y0` : | y coordinate of the start point
`x1` : | x coordinate of the end point
`y1` : | y coordinate of the end point
Returns : | the newly created cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call `cairo_pattern_destroy()` when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use `cairo_pattern_status()`.

### cairo_pattern_create_radial ()

    cairo_pattern_t* cairo_pattern_create_radial
                                                (double cx0,
                                                 double cy0,
                                                 double radius0,
                                                 double cx1,
                                                 double cy1,
                                                 double radius1);

Create a new radial gradient cairo_pattern_t between the two circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the gradient pattern, a number of color stops should be defined using `cairo_pattern_add_color_stop_rgb()` or `cairo_pattern_add_color_stop_rgba()`.

`cx0` : | x coordinate for the center of the start circle
`cy0` : | y coordinate for the center of the start circle
`radius0` : | radius of the start cirle
`cx1` : | x coordinate for the center of the end circle
`cy1` : | y coordinate for the center of the end circle
`radius1` : | radius of the end cirle
Returns : | the newly created cairo_pattern_t if succesful, or an error pattern in case of no memory. The caller owns the returned object and should call `cairo_pattern_destroy()` when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use `cairo_pattern_status()`.

### cairo_pattern_reference ()

    void        cairo_pattern_reference         (cairo_pattern_t *pattern);

Increases the reference count on `pattern` by one. This prevents `pattern` from being destroyed until a matching call to `cairo_pattern_destroy()` is made.

`pattern` : | a cairo_pattern_t

### cairo_pattern_destroy ()

    void        cairo_pattern_destroy           (cairo_pattern_t *pattern);

Decreases the reference count on `pattern` by one. If the result is zero, then `pattern` and all associated resources are freed. See `cairo_pattern_reference()`.

`pattern` : | a cairo_pattern_t

### cairo_pattern_status ()

    cairo_status_t cairo_pattern_status         (cairo_pattern_t *pattern);

Checks whether an error has previously occurred for this pattern.

`pattern` : | a cairo_pattern_t
Returns : | `CAIRO_STATUS_SUCCESS` or `CAIRO_STATUS_NO_MEMORY`

### cairo_pattern_add_color_stop_rgb ()

    void        cairo_pattern_add_color_stop_rgb
                                                (cairo_pattern_t *pattern,
                                                 double offset,
                                                 double red,
                                                 double green,
                                                 double blue);

`pattern` : |
`offset` : |
`red` : |
`green` : |
`blue` : |

### cairo_pattern_add_color_stop_rgba ()

    void        cairo_pattern_add_color_stop_rgba
                                                (cairo_pattern_t *pattern,
                                                 double offset,
                                                 double red,
                                                 double green,
                                                 double blue,
                                                 double alpha);

`pattern` : |
`offset` : |
`red` : |
`green` : |
`blue` : |
`alpha` : |

### cairo_pattern_set_matrix ()

    void        cairo_pattern_set_matrix        (cairo_pattern_t *pattern,
                                                 const cairo_matrix_t *matrix);

`pattern` : |
`matrix` : |

### cairo_pattern_get_matrix ()

    void        cairo_pattern_get_matrix        (cairo_pattern_t *pattern,
                                                 cairo_matrix_t *matrix);

`pattern` : |
`matrix` : |

### enum cairo_extend_t

    typedef enum _cairo_extend {
        CAIRO_EXTEND_NONE,
        CAIRO_EXTEND_REPEAT,
        CAIRO_EXTEND_REFLECT
    } cairo_extend_t;

### cairo_pattern_set_extend ()

    void        cairo_pattern_set_extend        (cairo_pattern_t *pattern,
                                                 cairo_extend_t extend);

`pattern` : |
`extend` : |

### cairo_pattern_get_extend ()

    cairo_extend_t cairo_pattern_get_extend     (cairo_pattern_t *pattern);

`pattern` : |
Returns : |

### cairo_pattern_set_filter ()

    void        cairo_pattern_set_filter        (cairo_pattern_t *pattern,
                                                 cairo_filter_t filter);

`pattern` : |
`filter` : |

### cairo_pattern_get_filter ()

    cairo_filter_t cairo_pattern_get_filter     (cairo_pattern_t *pattern);

`pattern` : |
Returns : |