gimpcontext

## gimpcontext gimpcontext — Functions to manipulate a plug-in's context. |

## Functions

gboolean | gimp_context_push ()
gboolean | gimp_context_pop ()
gboolean | gimp_context_set_defaults ()
gboolean | gimp_context_get_foreground ()
gboolean | gimp_context_set_foreground ()
gboolean | gimp_context_get_background ()
gboolean | gimp_context_set_background ()
gboolean | gimp_context_set_default_colors ()
gboolean | gimp_context_swap_colors ()
gdouble | gimp_context_get_opacity ()
gboolean | gimp_context_set_opacity ()
GimpLayerMode | gimp_context_get_paint_mode ()
gboolean | gimp_context_set_paint_mode ()
gboolean | gimp_context_list_paint_methods ()
gchar * | gimp_context_get_paint_method ()
gboolean | gimp_context_set_paint_method ()
GimpStrokeMethod | gimp_context_get_stroke_method ()
gboolean | gimp_context_set_stroke_method ()
gdouble | gimp_context_get_line_width ()
gboolean | gimp_context_set_line_width ()
GimpUnit | gimp_context_get_line_width_unit ()
gboolean | gimp_context_set_line_width_unit ()
GimpCapStyle | gimp_context_get_line_cap_style ()
gboolean | gimp_context_set_line_cap_style ()
GimpJoinStyle | gimp_context_get_line_join_style ()
gboolean | gimp_context_set_line_join_style ()
gdouble | gimp_context_get_line_miter_limit ()
gboolean | gimp_context_set_line_miter_limit ()
gdouble | gimp_context_get_line_dash_offset ()
gboolean | gimp_context_set_line_dash_offset ()
gboolean | gimp_context_get_line_dash_pattern ()
gboolean | gimp_context_set_line_dash_pattern ()
gchar * | gimp_context_get_brush ()
gboolean | gimp_context_set_brush ()
gdouble | gimp_context_get_brush_size ()
gboolean | gimp_context_set_brush_size ()
gboolean | gimp_context_set_brush_default_size ()
gdouble | gimp_context_get_brush_aspect_ratio ()
gboolean | gimp_context_set_brush_aspect_ratio ()
gdouble | gimp_context_get_brush_angle ()
gboolean | gimp_context_set_brush_angle ()
gdouble | gimp_context_get_brush_spacing ()
gboolean | gimp_context_set_brush_spacing ()
gboolean | gimp_context_set_brush_default_spacing ()
gdouble | gimp_context_get_brush_hardness ()
gboolean | gimp_context_set_brush_hardness ()
gboolean | gimp_context_set_brush_default_hardness ()
gdouble | gimp_context_get_brush_force ()
gboolean | gimp_context_set_brush_force ()
gchar * | gimp_context_get_dynamics ()
gboolean | gimp_context_set_dynamics ()
gchar * | gimp_context_get_mypaint_brush ()
gboolean | gimp_context_set_mypaint_brush ()
gchar * | gimp_context_get_pattern ()
gboolean | gimp_context_set_pattern ()
gchar * | gimp_context_get_gradient ()
gboolean | gimp_context_set_gradient ()
gboolean | gimp_context_set_gradient_fg_bg_hsv_ccw ()
gboolean | gimp_context_set_gradient_fg_bg_hsv_cw ()
gboolean | gimp_context_set_gradient_fg_bg_rgb ()
gboolean | gimp_context_set_gradient_fg_transparent ()
GimpGradientBlendColorSpace | gimp_context_get_gradient_blend_color_space ()
gboolean | gimp_context_set_gradient_blend_color_space ()
GimpRepeatMode | gimp_context_get_gradient_repeat_mode ()
gboolean | gimp_context_set_gradient_repeat_mode ()
gboolean | gimp_context_get_gradient_reverse ()
gboolean | gimp_context_set_gradient_reverse ()
gchar * | gimp_context_get_palette ()
gboolean | gimp_context_set_palette ()
gchar * | gimp_context_get_font ()
gboolean | gimp_context_set_font ()
gboolean | gimp_context_get_antialias ()
gboolean | gimp_context_set_antialias ()
gboolean | gimp_context_get_feather ()
gboolean | gimp_context_set_feather ()
gboolean | gimp_context_get_feather_radius ()
gboolean | gimp_context_set_feather_radius ()
gboolean | gimp_context_get_sample_merged ()
gboolean | gimp_context_set_sample_merged ()
GimpSelectCriterion | gimp_context_get_sample_criterion ()
gboolean | gimp_context_set_sample_criterion ()
gdouble | gimp_context_get_sample_threshold ()
gboolean | gimp_context_set_sample_threshold ()
gint | gimp_context_get_sample_threshold_int ()
gboolean | gimp_context_set_sample_threshold_int ()
gboolean | gimp_context_get_sample_transparent ()
gboolean | gimp_context_set_sample_transparent ()
gboolean | gimp_context_get_diagonal_neighbors ()
gboolean | gimp_context_set_diagonal_neighbors ()
GeglDistanceMetric | gimp_context_get_distance_metric ()
gboolean | gimp_context_set_distance_metric ()
GimpInterpolationType | gimp_context_get_interpolation ()
gboolean | gimp_context_set_interpolation ()
GimpTransformDirection | gimp_context_get_transform_direction ()
gboolean | gimp_context_set_transform_direction ()
GimpTransformResize | gimp_context_get_transform_resize ()
gboolean | gimp_context_set_transform_resize ()
gint | gimp_context_get_transform_recursion ()
gboolean | gimp_context_set_transform_recursion ()
gdouble | gimp_context_get_ink_angle ()
gboolean | gimp_context_set_ink_angle ()
gdouble | gimp_context_get_ink_blob_angle ()
gboolean | gimp_context_set_ink_blob_angle ()
gdouble | gimp_context_get_ink_blob_aspect_ratio ()
gboolean | gimp_context_set_ink_blob_aspect_ratio ()
GimpInkBlobType | gimp_context_get_ink_blob_type ()
gboolean | gimp_context_set_ink_blob_type ()
gdouble | gimp_context_get_ink_size ()
gboolean | gimp_context_set_ink_size ()
gdouble | gimp_context_get_ink_size_sensitivity ()
gboolean | gimp_context_set_ink_size_sensitivity ()
gdouble | gimp_context_get_ink_speed_sensitivity ()
gboolean | gimp_context_set_ink_speed_sensitivity ()
gdouble | gimp_context_get_ink_tilt_sensitivity ()
gboolean | gimp_context_set_ink_tilt_sensitivity ()

## Description

Functions to manipulate a plug-in's context.

## Functions

### gimp_context_push ()

    gboolean
    gimp_context_push (void);

Pushes a context to the top of the plug-in's context stack.

This procedure creates a new context by copying the current context. This copy becomes the new current context for the calling plug-in until it is popped again using `gimp_context_pop()`.

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_pop ()

    gboolean
    gimp_context_pop (void);

Pops the topmost context from the plug-in's context stack.

This procedure removes the topmost context from the plug-in's context stack. The context that was active before the corresponding call to `gimp_context_push()` becomes the new current context of the plug-in.

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_set_defaults ()

    gboolean
    gimp_context_set_defaults (void);

Reset context settings to their default values.

This procedure resets context settings used by various procedures to their default value. This procedure will usually be called after a context push so that a script which calls procedures affected by context settings will not be affected by changes in the global context.

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_foreground ()

    gboolean
    gimp_context_get_foreground (GimpRGB *foreground);

Get the current GIMP foreground color.

This procedure returns the current GIMP foreground color. The foreground color is used in a variety of tools such as paint tools, blending, and bucket fill.

#### Parameters

foreground | The foreground color. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_set_foreground ()

    gboolean
    gimp_context_set_foreground (const GimpRGB *foreground);

Set the current GIMP foreground color.

This procedure sets the current GIMP foreground color. After this is set, operations which use foreground such as paint tools, blending, and bucket fill will use the new value.

#### Parameters

foreground | The foreground color. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_background ()

    gboolean
    gimp_context_get_background (GimpRGB *background);

Get the current GIMP background color.

This procedure returns the current GIMP background color. The background color is used in a variety of tools such as blending, erasing (with non-alpha images), and image filling.

#### Parameters

background | The background color. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_set_background ()

    gboolean
    gimp_context_set_background (const GimpRGB *background);

Set the current GIMP background color.

This procedure sets the current GIMP background color. After this is set, operations which use background such as blending, filling images, clearing, and erasing (in non-alpha images) will use the new value.

#### Parameters

background | The background color. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_set_default_colors ()

    gboolean
    gimp_context_set_default_colors (void);

Set the current GIMP foreground and background colors to black and white.

This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_swap_colors ()

    gboolean
    gimp_context_swap_colors (void);

Swap the current GIMP foreground and background colors.

This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_opacity ()

    gdouble
    gimp_context_get_opacity (void);

Get the opacity.

This procedure returns the opacity setting. The return value is a floating point number between 0 and 100.

#### Returns

The opacity.

Since: 2.2

### gimp_context_set_opacity ()

    gboolean
    gimp_context_set_opacity (gdouble opacity);

Set the opacity.

This procedure modifies the opacity setting. The value should be a floating point number between 0 and 100.

#### Parameters

opacity | The opacity. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_paint_mode ()

    GimpLayerMode
    gimp_context_get_paint_mode (void);

Get the paint mode.

This procedure returns the paint-mode setting. The return value is an integer which corresponds to the values listed in the argument description.

#### Returns

The paint mode.

Since: 2.2

### gimp_context_set_paint_mode ()

    gboolean
    gimp_context_set_paint_mode (GimpLayerMode paint_mode);

Set the paint mode.

This procedure modifies the paint_mode setting.

#### Parameters

paint_mode | The paint mode. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_list_paint_methods ()

    gboolean
    gimp_context_list_paint_methods (gint *num_paint_methods,
                                     gchar ***paint_methods);

Lists the available paint methods.

This procedure lists the names of the available paint methods. Any of the results can be used for `gimp_context_set_paint_method()`.

#### Parameters

num_paint_methods | The number of the available paint methods. |
paint_methods | The names of the available paint methods. |

#### Returns

TRUE on success.

Since: 2.4

### gimp_context_get_paint_method ()

    gchar *
    gimp_context_get_paint_method (void);

Retrieve the currently active paint method.

This procedure returns the name of the currently active paint method.

#### Returns

The name of the active paint method.

Since: 2.4

### gimp_context_set_paint_method ()

    gboolean
    gimp_context_set_paint_method (const gchar *name);

Set the specified paint method as the active paint method.

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

#### Parameters

name | The name of the paint method. |

#### Returns

TRUE on success.

Since: 2.4

### gimp_context_get_stroke_method ()

    GimpStrokeMethod
    gimp_context_get_stroke_method (void);

Retrieve the currently active stroke method.

This procedure returns the currently active stroke method.

#### Returns

The active stroke method.

Since: 2.10

### gimp_context_set_stroke_method ()

    gboolean
    gimp_context_set_stroke_method (GimpStrokeMethod stroke_method);

Set the specified stroke method as the active stroke method.

This procedure set the specified stroke method as the active stroke method. The new method will be used in all subsequent stroke operations.

#### Parameters

stroke_method | The new stroke method. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_width ()

    gdouble
    gimp_context_get_line_width (void);

Get the line width setting.

This procedure returns the line width setting.

#### Returns

The line width setting.

Since: 2.10

### gimp_context_set_line_width ()

    gboolean
    gimp_context_set_line_width (gdouble line_width);

Set the line width setting.

This procedure modifies the line width setting for stroking lines.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

line_width | The line width setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_width_unit ()

    GimpUnit
    gimp_context_get_line_width_unit (void);

Get the line width unit setting.

This procedure returns the line width unit setting.

#### Returns

The line width unit setting.

Since: 2.10

### gimp_context_set_line_width_unit ()

    gboolean
    gimp_context_set_line_width_unit (GimpUnit line_width_unit);

Set the line width unit setting.

This procedure modifies the line width unit setting for stroking lines.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

line_width_unit | The line width setting unit. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_cap_style ()

    GimpCapStyle
    gimp_context_get_line_cap_style (void);

Get the line cap style setting.

This procedure returns the line cap style setting.

#### Returns

The line cap style setting.

Since: 2.10

### gimp_context_set_line_cap_style ()

    gboolean
    gimp_context_set_line_cap_style (GimpCapStyle cap_style);

Set the line cap style setting.

This procedure modifies the line cap style setting for stroking lines.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

cap_style | The line cap style setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_join_style ()

    GimpJoinStyle
    gimp_context_get_line_join_style (void);

Get the line join style setting.

This procedure returns the line join style setting.

#### Returns

The line join style setting.

Since: 2.10

### gimp_context_set_line_join_style ()

    gboolean
    gimp_context_set_line_join_style (GimpJoinStyle join_style);

Set the line join style setting.

This procedure modifies the line join style setting for stroking lines.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

join_style | The line join style setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_miter_limit ()

    gdouble
    gimp_context_get_line_miter_limit (void);

Get the line miter limit setting.

This procedure returns the line miter limit setting.

#### Returns

The line miter limit setting.

Since: 2.10

### gimp_context_set_line_miter_limit ()

    gboolean
    gimp_context_set_line_miter_limit (gdouble miter_limit);

Set the line miter limit setting.

This procedure modifies the line miter limit setting for stroking lines. A mitered join is converted to a bevelled join if the miter would extend to a distance of more than (miter-limit * line-width) from the actual join point.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

miter_limit | The line miter limit setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_dash_offset ()

    gdouble
    gimp_context_get_line_dash_offset (void);

Get the line dash offset setting.

This procedure returns the line dash offset setting.

#### Returns

The line dash offset setting.

Since: 2.10

### gimp_context_set_line_dash_offset ()

    gboolean
    gimp_context_set_line_dash_offset (gdouble dash_offset);

Set the line dash offset setting.

This procedure modifies the line dash offset setting for stroking lines.

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

dash_offset | The line dash offset setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_line_dash_pattern ()

    gboolean
    gimp_context_get_line_dash_pattern (gint *num_dashes,
                                        gdouble **dashes);

Get the line dash pattern setting.

This procedure returns the line dash pattern setting.

#### Parameters

num_dashes | The number of dashes in the dash_pattern array. |
dashes | The line dash pattern setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_line_dash_pattern ()

    gboolean
    gimp_context_set_line_dash_pattern (gint num_dashes,
                                        const gdouble *dashes);

Set the line dash pattern setting.

This procedure modifies the line dash pattern setting for stroking lines.

The unit of the dash pattern segments is the actual line width used for the stroke operation, in other words a segment length of 1.0 results in a square segment shape (or gap shape).

This setting affects the following procedures: `gimp_drawable_edit_stroke_selection_()`, `gimp_drawable_edit_stroke_item()`.

#### Parameters

num_dashes | The number of dashes in the dash_pattern array. |
dashes | The line dash pattern setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_brush ()

    gchar *
    gimp_context_get_brush (void);

Retrieve the currently active brush.

This procedure returns the name of the currently active brush. All paint operations and stroke operations use this brush to control the application of paint to the image.

#### Returns

The name of the active brush.

Since: 2.2

### gimp_context_set_brush ()

    gboolean
    gimp_context_set_brush (const gchar *name);

Set the specified brush as the active brush.

This procedure allows the active brush 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.

#### Parameters

name | The name of the brush. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_brush_size ()

    gdouble
    gimp_context_get_brush_size (void);

Get brush size in pixels.

Get the brush size in pixels for brush based paint tools.

#### Returns

Brush size in pixels.

Since: 2.8

### gimp_context_set_brush_size ()

    gboolean
    gimp_context_set_brush_size (gdouble size);

Set brush size in pixels.

Set the brush size in pixels for brush based paint tools.

#### Parameters

size | Brush size in pixels. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_set_brush_default_size ()

    gboolean
    gimp_context_set_brush_default_size (void);

Set brush size to its default.

Set the brush size to the default (max of width and height) for paintbrush, airbrush, or pencil tools.

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_brush_aspect_ratio ()

    gdouble
    gimp_context_get_brush_aspect_ratio (void);

Get brush aspect ratio.

Set the aspect ratio for brush based paint tools.

#### Returns

Aspect ratio.

Since: 2.8

### gimp_context_set_brush_aspect_ratio ()

    gboolean
    gimp_context_set_brush_aspect_ratio (gdouble aspect);

Set brush aspect ratio.

Set the aspect ratio for brush based paint tools.

#### Parameters

aspect | Aspect ratio. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_brush_angle ()

    gdouble
    gimp_context_get_brush_angle (void);

Get brush angle in degrees.

Set the angle in degrees for brush based paint tools.

#### Returns

Angle in degrees.

Since: 2.8

### gimp_context_set_brush_angle ()

    gboolean
    gimp_context_set_brush_angle (gdouble angle);

Set brush angle in degrees.

Set the angle in degrees for brush based paint tools.

#### Parameters

angle | Angle in degrees. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_brush_spacing ()

    gdouble
    gimp_context_get_brush_spacing (void);

Get brush spacing as percent of size.

Get the brush spacing as percent of size for brush based paint tools.

#### Returns

Brush spacing as fraction of size.

Since: 2.10

### gimp_context_set_brush_spacing ()

    gboolean
    gimp_context_set_brush_spacing (gdouble spacing);

Set brush spacing as percent of size.

Set the brush spacing as percent of size for brush based paint tools.

#### Parameters

spacing | Brush spacing as fraction of size. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_brush_default_spacing ()

    gboolean
    gimp_context_set_brush_default_spacing
                                   (void);

Set brush spacing to its default.

Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_brush_hardness ()

    gdouble
    gimp_context_get_brush_hardness (void);

Get brush hardness in paint options.

Get the brush hardness for brush based paint tools.

#### Returns

Brush hardness.

Since: 2.10

### gimp_context_set_brush_hardness ()

    gboolean
    gimp_context_set_brush_hardness (gdouble hardness);

Set brush hardness.

Set the brush hardness for brush based paint tools.

#### Parameters

hardness | Brush hardness. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_brush_default_hardness ()

    gboolean
    gimp_context_set_brush_default_hardness
                                   (void);

Set brush spacing to its default.

Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_brush_force ()

    gdouble
    gimp_context_get_brush_force (void);

Get brush force in paint options.

Get the brush application force for brush based paint tools.

#### Returns

Brush application force.

Since: 2.10

### gimp_context_set_brush_force ()

    gboolean
    gimp_context_set_brush_force (gdouble force);

Set brush application force.

Set the brush application force for brush based paint tools.

#### Parameters

force | Brush application force. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_dynamics ()

    gchar *
    gimp_context_get_dynamics (void);

Retrieve the currently active paint dynamics.

This procedure returns the name of the currently active paint dynamics. All paint operations and stroke operations use this paint dynamics to control the application of paint to the image.

#### Returns

The name of the active paint dynamics.

Since: 2.8

### gimp_context_set_dynamics ()

    gboolean
    gimp_context_set_dynamics (const gchar *name);

Set the specified paint dynamics as the active paint dynamics.

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

#### Parameters

name | The name of the paint dynamics. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_mypaint_brush ()

    gchar *
    gimp_context_get_mypaint_brush (void);

Retrieve the currently active MyPaint brush.

This procedure returns the name of the currently active MyPaint brush.

#### Returns

The name of the active MyPaint brush.

Since: 2.10

### gimp_context_set_mypaint_brush ()

    gboolean
    gimp_context_set_mypaint_brush (const gchar *name);

Set the specified MyPaint brush as the active MyPaint brush.

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

#### Parameters

name | The name of the MyPaint brush. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_pattern ()

    gchar *
    gimp_context_get_pattern (void);

Retrieve the currently active pattern.

This procedure returns name of the the currently active pattern. All clone and bucket-fill operations with patterns will use this pattern to control the application of paint to the image.

#### Returns

The name of the active pattern.

Since: 2.2

### gimp_context_set_pattern ()

    gboolean
    gimp_context_set_pattern (const gchar *name);

Set the specified pattern as the active pattern.

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

#### Parameters

name | The name of the pattern. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_gradient ()

    gchar *
    gimp_context_get_gradient (void);

Retrieve the currently active gradient.

This procedure returns the name of the currently active gradient.

#### Returns

The name of the active gradient.

Since: 2.2

### gimp_context_set_gradient ()

    gboolean
    gimp_context_set_gradient (const gchar *name);

Sets the specified gradient as the active gradient.

This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.

#### Parameters

name | The name of the gradient. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_set_gradient_fg_bg_hsv_ccw ()

    gboolean
    gimp_context_set_gradient_fg_bg_hsv_ccw
                                   (void);

Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.

This procedure sets the built-in FG-BG HSV (ccw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_gradient_fg_bg_hsv_cw ()

    gboolean
    gimp_context_set_gradient_fg_bg_hsv_cw
                                   (void);

Sets the built-in FG-BG HSV (cw) gradient as the active gradient.

This procedure sets the built-in FG-BG HSV (cw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_gradient_fg_bg_rgb ()

    gboolean
    gimp_context_set_gradient_fg_bg_rgb (void);

Sets the built-in FG-BG RGB gradient as the active gradient.

This procedure sets the built-in FG-BG RGB gradient as the active gradient. The gradient will be used for subsequent gradient operations.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_set_gradient_fg_transparent ()

    gboolean
    gimp_context_set_gradient_fg_transparent
                                   (void);

Sets the built-in FG-Transparent gradient as the active gradient.

This procedure sets the built-in FG-Transparent gradient as the active gradient. The gradient will be used for subsequent gradient operations.

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_gradient_blend_color_space ()

    GimpGradientBlendColorSpace
    gimp_context_get_gradient_blend_color_space
                                   (void);

Get the gradient blend color space.

Get the gradient blend color space for paint tools and the gradient tool.

#### Returns

Color blend space.

Since: 2.10

### gimp_context_set_gradient_blend_color_space ()

    gboolean
    gimp_context_set_gradient_blend_color_space
                                   (GimpGradientBlendColorSpace blend_color_space);

Set the gradient blend color space.

Set the gradient blend color space for paint tools and the gradient tool.

#### Parameters

blend_color_space | Blend color space. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_gradient_repeat_mode ()

    GimpRepeatMode
    gimp_context_get_gradient_repeat_mode (void);

Get the gradient repeat mode.

Get the gradient repeat mode for paint tools and the gradient tool.

#### Returns

Repeat mode.

Since: 2.10

### gimp_context_set_gradient_repeat_mode ()

    gboolean
    gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode);

Set the gradient repeat mode.

Set the gradient repeat mode for paint tools and the gradient tool.

#### Parameters

repeat_mode | Repeat mode. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_gradient_reverse ()

    gboolean
    gimp_context_get_gradient_reverse (void);

Get the gradient reverse setting.

Get the gradient reverse setting for paint tools and the gradient tool.

#### Returns

Reverse.

Since: 2.10

### gimp_context_set_gradient_reverse ()

    gboolean
    gimp_context_set_gradient_reverse (gboolean reverse);

Set the gradient reverse setting.

Set the gradient reverse setting for paint tools and the gradient tool.

#### Parameters

reverse | Reverse. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_palette ()

    gchar *
    gimp_context_get_palette (void);

Retrieve the currently active palette.

This procedure returns the name of the the currently active palette.

#### Returns

The name of the active palette.

Since: 2.2

### gimp_context_set_palette ()

    gboolean
    gimp_context_set_palette (const gchar *name);

Set the specified palette as the active palette.

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

#### Parameters

name | The name of the palette. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_font ()

    gchar *
    gimp_context_get_font (void);

Retrieve the currently active font.

This procedure returns the name of the currently active font.

#### Returns

The name of the active font.

Since: 2.2

### gimp_context_set_font ()

    gboolean
    gimp_context_set_font (const gchar *name);

Set the specified font as the active font.

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

#### Parameters

name | The name of the font. |

#### Returns

TRUE on success.

Since: 2.2

### gimp_context_get_antialias ()

    gboolean
    gimp_context_get_antialias (void);

Get the antialias setting.

This procedure returns the antialias setting.

#### Returns

The antialias setting.

Since: 2.8

### gimp_context_set_antialias ()

    gboolean
    gimp_context_set_antialias (gboolean antialias);

Set the antialias setting.

This procedure modifies the antialias setting. If antialiasing is turned on, the edges of selected region will contain intermediate values which give the appearance of a sharper, less pixelized edge. This should be set as TRUE most of the time unless a binary-only selection is wanted.

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_image_select_round_rectangle()`, `gimp_image_select_ellipse()`, `gimp_image_select_polygon()`, `gimp_image_select_item()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

antialias | The antialias setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_feather ()

    gboolean
    gimp_context_get_feather (void);

Get the feather setting.

This procedure returns the feather setting.

#### Returns

The feather setting.

Since: 2.8

### gimp_context_set_feather ()

    gboolean
    gimp_context_set_feather (gboolean feather);

Set the feather setting.

This procedure modifies the feather setting. If the feather option is enabled, selections will be blurred before combining. The blur is a gaussian blur; its radii can be controlled using `gimp_context_set_feather_radius()`.

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_image_select_rectangle()`, `gimp_image_select_round_rectangle()`, `gimp_image_select_ellipse()`, `gimp_image_select_polygon()`, `gimp_image_select_item()`.

#### Parameters

feather | The feather setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_feather_radius ()

    gboolean
    gimp_context_get_feather_radius (gdouble *feather_radius_x,
                                     gdouble *feather_radius_y);

Get the feather radius setting.

This procedure returns the feather radius setting.

#### Parameters

feather_radius_x | The horizontal feather radius. |
feather_radius_y | The vertical feather radius. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_set_feather_radius ()

    gboolean
    gimp_context_set_feather_radius (gdouble feather_radius_x,
                                     gdouble feather_radius_y);

Set the feather radius setting.

This procedure modifies the feather radius setting.

This setting affects all procedures that are affected by `gimp_context_set_feather()`.

#### Parameters

feather_radius_x | The horizontal feather radius. |
feather_radius_y | The vertical feather radius. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_sample_merged ()

    gboolean
    gimp_context_get_sample_merged (void);

Get the sample merged setting.

This procedure returns the sample merged setting.

#### Returns

The sample merged setting.

Since: 2.8

### gimp_context_set_sample_merged ()

    gboolean
    gimp_context_set_sample_merged (gboolean sample_merged);

Set the sample merged setting.

This procedure modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the specified drawable is used ('sample-merged' is FALSE), or the pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers).

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

sample_merged | The sample merged setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_sample_criterion ()

    GimpSelectCriterion
    gimp_context_get_sample_criterion (void);

Get the sample criterion setting.

This procedure returns the sample criterion setting.

#### Returns

The sample criterion setting.

Since: 2.8

### gimp_context_set_sample_criterion ()

    gboolean
    gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);

Set the sample criterion setting.

This procedure modifies the sample criterion setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls how color similarity is determined. SELECT_CRITERION_COMPOSITE is the default value.

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

sample_criterion | The sample criterion setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_sample_threshold ()

    gdouble
    gimp_context_get_sample_threshold (void);

Get the sample threshold setting.

This procedure returns the sample threshold setting.

#### Returns

The sample threshold setting.

Since: 2.8

### gimp_context_set_sample_threshold ()

    gboolean
    gimp_context_set_sample_threshold (gdouble sample_threshold);

Set the sample threshold setting.

This procedure modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \"sufficiently close\" to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used.

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

sample_threshold | The sample threshold setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_sample_threshold_int ()

    gint
    gimp_context_get_sample_threshold_int (void);

Get the sample threshold setting as an integer value.

This procedure returns the sample threshold setting as an integer value. See `gimp_context_get_sample_threshold()`.

#### Returns

The sample threshold setting.

Since: 2.8

### gimp_context_set_sample_threshold_int ()

    gboolean
    gimp_context_set_sample_threshold_int (gint sample_threshold);

Set the sample threshold setting as an integer value.

This procedure modifies the sample threshold setting as an integer value. See `gimp_context_set_sample_threshold()`.

#### Parameters

sample_threshold | The sample threshold setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_sample_transparent ()

    gboolean
    gimp_context_get_sample_transparent (void);

Get the sample transparent setting.

This procedure returns the sample transparent setting.

#### Returns

The sample transparent setting.

Since: 2.8

### gimp_context_set_sample_transparent ()

    gboolean
    gimp_context_set_sample_transparent (gboolean sample_transparent);

Set the sample transparent setting.

This procedure modifies the sample transparent setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled.

This setting affects the following procedures: `gimp_image_select_color()`, `gimp_image_select_contiguous_color()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

sample_transparent | The sample transparent setting. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_diagonal_neighbors ()

    gboolean
    gimp_context_get_diagonal_neighbors (void);

Get the diagonal neighbors setting.

This procedure returns the diagonal neighbors setting.

#### Returns

The diagonal neighbors setting.

Since: 2.10

### gimp_context_set_diagonal_neighbors ()

    gboolean
    gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors);

Set the diagonal neighbors setting.

This procedure modifies the diagonal neighbors setting. If the affected region of an operation is based on a seed point, like when doing a seed fill, then, when this setting is TRUE, all eight neighbors of each pixel are considered when calculating the affected region; in contrast, when this setting is FALSE, only the four orthogonal neighbors of each pixel are considered.

This setting affects the following procedures: `gimp_image_select_contiguous_color()`, `gimp_drawable_edit_bucket_fill()`.

#### Parameters

diagonal_neighbors | The diagonal neighbors setting. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_distance_metric ()

    GeglDistanceMetric
    gimp_context_get_distance_metric (void);

Get the distance metric used in some computations.

This procedure returns the distance metric in the current context. See `gimp_context_set_distance_metric()` to know more about its usage.

#### Returns

The distance metric.

Since: 2.10

### gimp_context_set_distance_metric ()

    gboolean
    gimp_context_set_distance_metric (GeglDistanceMetric metric);

Set the distance metric used in some computations.

This procedure modifies the distance metric used in some computations, such as `gimp_drawable_edit_gradient_fill()`. In particular, it does not change the metric used in generic distance computation on canvas, as in the Measure tool.

This setting affects the following procedures: `gimp_drawable_edit_gradient_fill()`.

#### Parameters

metric | The distance metric. |

#### Returns

TRUE on success.

Since: 2.10

### gimp_context_get_interpolation ()

    GimpInterpolationType
    gimp_context_get_interpolation (void);

Get the interpolation type.

This procedure returns the interpolation setting. The return value is an integer which corresponds to the values listed in the argument description. If the interpolation has not been set explicitly by `gimp_context_set_interpolation()`, the default interpolation set in gimprc will be used.

#### Returns

The interpolation type.

Since: 2.8

### gimp_context_set_interpolation ()

    gboolean
    gimp_context_set_interpolation (GimpInterpolationType interpolation);

Set the interpolation type.

This procedure modifies the interpolation setting.

This setting affects affects the following procedures: `gimp_item_transform_flip()`, `gimp_item_transform_perspective()`, `gimp_item_transform_rotate()`, `gimp_item_transform_scale()`, `gimp_item_transform_shear()`, `gimp_item_transform_2d()`, `gimp_item_transform_matrix()`, `gimp_image_scale()`, `gimp_layer_scale()`.

#### Parameters

interpolation | The interpolation type. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_transform_direction ()

    GimpTransformDirection
    gimp_context_get_transform_direction (void);

Get the transform direction.

This procedure returns the transform direction. The return value is an integer which corresponds to the values listed in the argument description.

#### Returns

The transform direction.

Since: 2.8

### gimp_context_set_transform_direction ()

    gboolean
    gimp_context_set_transform_direction (GimpTransformDirection transform_direction);

Set the transform direction.

This procedure modifies the transform direction setting.

This setting affects affects the following procedures: `gimp_item_transform_flip()`, `gimp_item_transform_perspective()`, `gimp_item_transform_rotate()`, `gimp_item_transform_scale()`, `gimp_item_transform_shear()`, `gimp_item_transform_2d()`, `gimp_item_transform_matrix()`.

#### Parameters

transform_direction | The transform direction. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_transform_resize ()

    GimpTransformResize
    gimp_context_get_transform_resize (void);

Get the transform resize type.

This procedure returns the transform resize setting. The return value is an integer which corresponds to the values listed in the argument description.

#### Returns

The transform resize type.

Since: 2.8

### gimp_context_set_transform_resize ()

    gboolean
    gimp_context_set_transform_resize (GimpTransformResize transform_resize);

Set the transform resize type.

This procedure modifies the transform resize setting. When transforming pixels, if the result of a transform operation has a different size than the original area, this setting determines how the resulting area is sized.

This setting affects affects the following procedures: `gimp_item_transform_flip()`, `gimp_item_transform_flip_simple()`, `gimp_item_transform_perspective()`, `gimp_item_transform_rotate()`, `gimp_item_transform_rotate_simple()`, `gimp_item_transform_scale()`, `gimp_item_transform_shear()`, `gimp_item_transform_2d()`, `gimp_item_transform_matrix()`.

#### Parameters

transform_resize | The transform resize type. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_transform_recursion ()

    gint
    gimp_context_get_transform_recursion (void);

`gimp_context_get_transform_recursion` is deprecated and should not be used in newly-written code.

There is no replacement for this procedure.

#### Returns

This returns always 3 and is meaningless.

### gimp_context_set_transform_recursion ()

    gboolean
    gimp_context_set_transform_recursion (gint transform_recursion);

`gimp_context_set_transform_recursion` is deprecated and should not be used in newly-written code.

There is no replacement for this procedure.

#### Parameters

transform_recursion | This parameter is ignored. |

#### Returns

TRUE on success.

### gimp_context_get_ink_angle ()

    gdouble
    gimp_context_get_ink_angle (void);

Get ink angle in degrees.

Get the ink angle in degrees for ink tool.

#### Returns

ink angle in degrees.

Since: 2.8

### gimp_context_set_ink_angle ()

    gboolean
    gimp_context_set_ink_angle (gdouble angle);

Set ink angle in degrees.

Set the ink angle in degrees for ink tool.

#### Parameters

angle | ink angle in degrees. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_blob_angle ()

    gdouble
    gimp_context_get_ink_blob_angle (void);

Get ink blob angle in degrees.

Get the ink blob angle in degrees for ink tool.

#### Returns

ink blob angle in degrees.

Since: 2.8

### gimp_context_set_ink_blob_angle ()

    gboolean
    gimp_context_set_ink_blob_angle (gdouble angle);

Set ink blob angle in degrees.

Set the ink blob angle in degrees for ink tool.

#### Parameters

angle | ink blob angle in degrees. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_blob_aspect_ratio ()

    gdouble
    gimp_context_get_ink_blob_aspect_ratio
                                   (void);

Get ink blob aspect ratio.

Get the ink blob aspect ratio for ink tool.

#### Returns

ink blob aspect ratio.

Since: 2.8

### gimp_context_set_ink_blob_aspect_ratio ()

    gboolean
    gimp_context_set_ink_blob_aspect_ratio
                                   (gdouble aspect);

Set ink blob aspect ratio.

Set the ink blob aspect ratio for ink tool.

#### Parameters

aspect | ink blob aspect ratio. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_blob_type ()

    GimpInkBlobType
    gimp_context_get_ink_blob_type (void);

Get ink blob type.

Get the ink blob type for ink tool.

#### Returns

Ink blob type.

Since: 2.8

### gimp_context_set_ink_blob_type ()

    gboolean
    gimp_context_set_ink_blob_type (GimpInkBlobType type);

Set ink blob type.

Set the ink blob type for ink tool.

#### Parameters

type | Ink blob type. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_size ()

    gdouble
    gimp_context_get_ink_size (void);

Get ink blob size in pixels.

Get the ink blob size in pixels for ink tool.

#### Returns

ink blob size in pixels.

Since: 2.8

### gimp_context_set_ink_size ()

    gboolean
    gimp_context_set_ink_size (gdouble size);

Set ink blob size in pixels.

Set the ink blob size in pixels for ink tool.

#### Parameters

size | ink blob size in pixels. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_size_sensitivity ()

    gdouble
    gimp_context_get_ink_size_sensitivity (void);

Get ink size sensitivity.

Get the ink size sensitivity for ink tool.

#### Returns

ink size sensitivity.

Since: 2.8

### gimp_context_set_ink_size_sensitivity ()

    gboolean
    gimp_context_set_ink_size_sensitivity (gdouble size);

Set ink size sensitivity.

Set the ink size sensitivity for ink tool.

#### Parameters

size | ink size sensitivity. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_speed_sensitivity ()

    gdouble
    gimp_context_get_ink_speed_sensitivity
                                   (void);

Get ink speed sensitivity.

Get the ink speed sensitivity for ink tool.

#### Returns

ink speed sensitivity.

Since: 2.8

### gimp_context_set_ink_speed_sensitivity ()

    gboolean
    gimp_context_set_ink_speed_sensitivity
                                   (gdouble speed);

Set ink speed sensitivity.

Set the ink speed sensitivity for ink tool.

#### Parameters

speed | ink speed sensitivity. |

#### Returns

TRUE on success.

Since: 2.8

### gimp_context_get_ink_tilt_sensitivity ()

    gdouble
    gimp_context_get_ink_tilt_sensitivity (void);

Get ink tilt sensitivity.

Get the ink tilt sensitivity for ink tool.

#### Returns

ink tilt sensitivity.

Since: 2.8

### gimp_context_set_ink_tilt_sensitivity ()

    gboolean
    gimp_context_set_ink_tilt_sensitivity (gdouble tilt);

Set ink tilt sensitivity.

Set the ink tilt sensitivity for ink tool.

#### Parameters

tilt | ink tilt sensitivity. |

#### Returns

TRUE on success.

Since: 2.8

## Types and Values