## gimpbrushes

gimpbrushes — Functions for manipulating brushes.

## Synopsis

    gboolean    gimp_brushes_refresh            (void);
    gchar**     gimp_brushes_get_list           (const gchar *filter,
                                                 gint *num_brushes);
    gchar*      gimp_brushes_get_brush          (gint *width,
                                                 gint *height,
                                                 gint *spacing);
    gboolean    gimp_brushes_set_brush          (const gchar *name);
    gdouble     gimp_brushes_get_opacity        (void);
    gboolean    gimp_brushes_set_opacity        (gdouble opacity);
    GimpLayerModeEffects gimp_brushes_get_paint_mode
                                                (void);
    gboolean    gimp_brushes_set_paint_mode     (GimpLayerModeEffects paint_mode);
    gint        gimp_brushes_get_spacing        (void);
    gboolean    gimp_brushes_set_spacing        (gint spacing);
    gchar*      gimp_brushes_get_brush_data     (const gchar *name,
                                                 gdouble *opacity,
                                                 gint *spacing,
                                                 GimpLayerModeEffects *paint_mode,
                                                 gint *width,
                                                 gint *height,
                                                 gint *length,
                                                 guint8 **mask_data);

## Description

Functions related to getting and setting brushes.

## Details

### gimp_brushes_refresh ()

    gboolean    gimp_brushes_refresh            (void);

Refresh current brushes.

This procedure retrieves all brushes currently in the user's brush path and updates the brush dialog accordingly.

Returns : | TRUE on success.

### gimp_brushes_get_list ()

    gchar**     gimp_brushes_get_list           (const gchar *filter,
                                                 gint *num_brushes);

Retrieve a complete listing of the available brushes.

This procedure returns a complete listing of available GIMP brushes. Each name returned can be used as input to the 'gimp_brushes_set_brush'.

`filter` : | An optional regular expression used to filter the list.
`num_brushes` : | The number of brushes in the brush list.
Returns : | The list of brush names.

### gimp_brushes_get_brush ()

    gchar*      gimp_brushes_get_brush          (gint *width,
                                                 gint *height,
                                                 gint *spacing);

Retrieve information about the currently active brush mask.

This procedure retrieves information about the currently active brush mask. This includes the brush name, the width and height, and the brush spacing paramter. All paint operations and stroke operations use this mask to control the application of paint to the image.

`width` : | The brush width.
`height` : | The brush height.
`spacing` : | The brush spacing.
Returns : | The brush name.

### gimp_brushes_set_brush ()

    gboolean    gimp_brushes_set_brush          (const gchar *name);

Set the specified brush as the active brush.

This procedure allows the active brush mask to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed brushes. If there is no matching brush found, this procedure will return an error. Otherwise, the specified brush becomes active and will be used in all subsequent paint operations.

`name` : | The brush name.
Returns : | TRUE on success.

### gimp_brushes_get_opacity ()

    gdouble     gimp_brushes_get_opacity        (void);

Get the brush opacity.

This procedure returns the opacity setting for brushes. This value is set globally and will remain the same even if the brush mask is changed. The return value is a floating point number between 0 and 100.

Returns : | The brush opacity.

### gimp_brushes_set_opacity ()

    gboolean    gimp_brushes_set_opacity        (gdouble opacity);

Set the brush opacity.

This procedure modifies the opacity setting for brushes. This value is set globally and will remain the same even if the brush mask is changed. The value should be a floating point number between 0 and 100.

`opacity` : | The brush opacity.
Returns : | TRUE on success.

### gimp_brushes_get_paint_mode ()

    GimpLayerModeEffects gimp_brushes_get_paint_mode
                                                (void);

Get the brush paint mode.

This procedure returns the paint-mode setting for brushes. This value is set globally and will not change if a different brush is selected. The return value is an integer which corresponds to the values listed in the argument description.

Returns : | The paint mode.

### gimp_brushes_set_paint_mode ()

    gboolean    gimp_brushes_set_paint_mode     (GimpLayerModeEffects paint_mode);

Set the brush paint mode.

This procedure modifies the paint_mode setting for the current brush. This value is set globally and will not change if a different brush mask is selected.

`paint_mode` : | The paint mode.
Returns : | TRUE on success.

### gimp_brushes_get_spacing ()

    gint        gimp_brushes_get_spacing        (void);

Get the brush spacing.

This procedure returns the spacing setting for brushes. This value is set per brush and will change if a different brush is selected. The return value is an integer between 0 and 1000 which represents percentage of the maximum of the width and height of the mask.

Returns : | The brush spacing.

### gimp_brushes_set_spacing ()

    gboolean    gimp_brushes_set_spacing        (gint spacing);

Set the brush spacing.

This procedure modifies the spacing setting for the current brush. This value is set on a per-brush basis and will change if a different brush mask is selected. The value should be a integer between 0 and 1000.

`spacing` : | The brush spacing.
Returns : | TRUE on success.

### gimp_brushes_get_brush_data ()

    gchar*      gimp_brushes_get_brush_data     (const gchar *name,
                                                 gdouble *opacity,
                                                 gint *spacing,
                                                 GimpLayerModeEffects *paint_mode,
                                                 gint *width,
                                                 gint *height,
                                                 gint *length,
                                                 guint8 **mask_data);

Retrieve information about the currently active brush (including data).

This procedure retrieves information about the currently active brush. This includes the brush name, and the brush extents (width and height). It also returns the brush data.

`name` : | the brush name (\"\" means current active pattern).
`opacity` : | The brush opacity.
`spacing` : | The brush spacing.
`paint_mode` : | The paint mode.
`width` : | The brush width.
`height` : | The brush height.
`length` : | Length of brush mask data.
`mask_data` : | The brush mask data.
Returns : | The brush name.