## GOPattern

GOPattern

## Synopsis

                        GOPattern;
    enum                GOPatternType;
    GOPatternType       go_pattern_from_str                 (char const *name);
    charconst	*         go_pattern_as_str                   (GOPatternType pattern);
    gboolean            go_pattern_is_solid                 (GOPattern const *pat,
                                                             GOColor *color);
    void                go_pattern_set_solid                (GOPattern *pat,
                                                             GOColor fore);
    guint8const 	*      go_pattern_get_pattern              (GOPattern const *pat);
    xmlChar*            go_pattern_get_svg_path             (GOPattern const *pattern,
                                                             double *width,
                                                             double *height);
    cairo_pattern_t*    go_pattern_create_cairo_pattern     (GOPattern const *pattern,
                                                             cairo_t *cr);
    GtkWidget*          go_pattern_selector_new             (GOPatternType initial_type,
                                                             GOPatternType default_type);
    void                go_pattern_selector_set_colors      (GOSelector *selector,
                                                             GOColor foreground,
                                                             GOColor background);

## Description

## Details

### GOPattern

    typedef struct {
    	GOColor	 fore, back;
    	unsigned pattern;
    } GOPattern;

### enum GOPatternType

    typedef enum {
    	GO_PATTERN_SOLID,
    	GO_PATTERN_GREY75,
    	GO_PATTERN_GREY50,
    	GO_PATTERN_GREY25,
    	GO_PATTERN_GREY125,
    	GO_PATTERN_GREY625,
    	GO_PATTERN_HORIZ,
    	GO_PATTERN_VERT,
    	GO_PATTERN_REV_DIAG,
    	GO_PATTERN_DIAG,
    	GO_PATTERN_DIAG_CROSS,
    	GO_PATTERN_THICK_DIAG_CROSS,
    	GO_PATTERN_THIN_HORIZ,
    	GO_PATTERN_THIN_VERT,
    	GO_PATTERN_THIN_REV_DIAG,
    	GO_PATTERN_THIN_DIAG,
    	GO_PATTERN_THIN_HORIZ_CROSS,
    	GO_PATTERN_THIN_DIAG_CROSS,
    	GO_PATTERN_FOREGROUND_SOLID,
    	GO_PATTERN_SMALL_CIRCLES,
    	GO_PATTERN_SEMI_CIRCLES,
    	GO_PATTERN_THATCH,
    	GO_PATTERN_LARGE_CIRCLES,
    	GO_PATTERN_BRICKS,
    	GO_PATTERN_MAX
    } GOPatternType;

### go_pattern_from_str ()

    GOPatternType       go_pattern_from_str                 (char const *name);

`name` : |
Returns : |

### go_pattern_as_str ()

    charconst	*         go_pattern_as_str                   (GOPatternType pattern);

`pattern` : |
Returns : |

### go_pattern_is_solid ()

    gboolean            go_pattern_is_solid                 (GOPattern const *pat,
                                                             GOColor *color);

`pat` : | GOPattern
`color` : | GOColor
Returns : | if `pat` is solid, and stores the color in `color`. If `pat` is not solid `color` is not touched.

### go_pattern_set_solid ()

    void                go_pattern_set_solid                (GOPattern *pat,
                                                             GOColor fore);

Makes `pat` a solid pattern with colour `fore`.

`pat` : | a GOPattern
`fore` : | a GOColor

### go_pattern_get_pattern ()

    guint8const 	*      go_pattern_get_pattern              (GOPattern const *pat);

`pat` : |
Returns : |

### go_pattern_get_svg_path ()

    xmlChar*            go_pattern_get_svg_path             (GOPattern const *pattern,
                                                             double *width,
                                                             double *height);

Retrieves an SVG path as string, which represents pattern shape. Caller is responsible for freeing the resulting string.

If width != NULL, returns pattern width. If height != NULL, returns pattern height.

`pattern` : | a GOPattern
`width` : | pattern width
`height` : | pattern height
Returns : | a xmlChar buffer (free using xmlFree).

### go_pattern_create_cairo_pattern ()

    cairo_pattern_t*    go_pattern_create_cairo_pattern     (GOPattern const *pattern,
                                                             cairo_t *cr);

`pattern` : | a GOPattern
`cr` : | a cairo context
Returns : | a cairo pattern object corresponding to `pattern` parameters. The returned surface must be freed after use, using cairo_pattern_destroy.

### go_pattern_selector_new ()

    GtkWidget*          go_pattern_selector_new             (GOPatternType initial_type,
                                                             GOPatternType default_type);

Creates a new pattern selector.

`initial_type` : | pattern type initially selected
`default_type` : | automatic pattern type
Returns : | a new GtkWidget.

### go_pattern_selector_set_colors ()

    void                go_pattern_selector_set_colors      (GOSelector *selector,
                                                             GOColor foreground,
                                                             GOColor background);

Updates swatch colors of `selector`.

`selector` : | a pattern GOSelector
`foreground` : | foreground color
`background` : | background color