GimpUi.ColorArea

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GimpUi.ColorArea GimpUi.ColorArea Gtk.Buildable->Gtk.Widget Gtk.DrawingArea Gtk.DrawingArea Gtk.DrawingArea->GimpUi.ColorArea Gtk.Widget->Gtk.DrawingArea

Subclasses:

None

Methods

Inherited:

Gtk.DrawingArea (1), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (color, type, drag_mask)

enable_drag (drag_mask)

get_color ()

has_alpha ()

set_color (color)

set_color_config (config)

set_draw_border (draw_border)

set_out_of_gamut (out_of_gamut)

set_type (type)

Virtual Methods

Inherited:

Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Widget (39)

Name

Type

Flags

Short Description

color

Gegl.Color

r/w/c

The displayed color

drag-mask

Gdk.ModifierType

w

The modifier mask that triggers dragging the color

draw-border

bool

r/w

Whether to draw a thin border in the foreground color around the area

type

GimpUi.ColorAreaType

r/w/c

The type of the color area

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Widget (69), GObject.Object (1)

Name

Short Description

color-changed

Fields

Inherited:

Gtk.Widget (69), GObject.Object (1)

Class Details

class GimpUi.ColorArea(**kwargs)
Bases:

Gtk.DrawingArea

Abstract:

No

Structure:

GimpUi.ColorAreaClass

Displays a [class`Gegl`.Color], optionally with alpha-channel.

classmethod new(color, type, drag_mask)
Parameters:
Returns:

Pointer to the new GimpUi.ColorArea widget.

Return type:

Gtk.Widget

Creates a new GimpUi.ColorArea widget.

This returns a preview area showing the color. It handles color DND. If the color changes, the “color_changed” signal is emitted.

enable_drag(drag_mask)
Parameters:

drag_mask (Gdk.ModifierType) – The bitmask of buttons that can start the drag.

Allows dragging the color displayed with buttons identified by drag_mask. The drag supports targets of type “application/x-color”.

Note that setting a drag_mask of 0 disables the drag ability.

get_color()
Returns:

a copy of the [class`Gegl`.Color] displayed in self.

Return type:

Gegl.Color

Retrieves the current color of the self.

has_alpha()
Returns:

True if self shows transparency information, False otherwise.

Return type:

bool

Checks whether the self shows transparency information. This is determined via the self's GimpUi.ColorAreaType.

set_color(color)
Parameters:

color (Gegl.Color) – Pointer to a [class`Gegl`.Color] that defines the new color.

Sets self to a different color.

set_color_config(config)
Parameters:

config (Gimp.ColorConfig) – a Gimp.ColorConfig object.

Sets the color management configuration to use with this color area.

New in version 2.10.

set_draw_border(draw_border)
Parameters:

draw_border (bool) – whether to draw a border or not

The self can draw a thin border in the foreground color around itself. This function toggles this behavior on and off. The default is not draw a border.

set_out_of_gamut(out_of_gamut)
Parameters:

out_of_gamut (bool) – whether to show an out-of-gamut indicator

Sets the color area to render as an out-of-gamut color, i.e. with a small triangle on a corner using the color management out of gamut color (as per GimpUi.ColorArea.set_color_config()).

By default, self will render as out-of-gamut for any RGB color with a channel out of the [0; 1] range. This function allows to consider more colors out of gamut (for instance non-gray colors on a grayscale image, or colors absent of palettes in indexed images, etc.)

New in version 2.10.10.

set_type(type)
Parameters:

type (GimpUi.ColorAreaType) – A GimpUi.ColorAreaType.

Changes the type of self. The GimpUi.ColorAreaType determines whether the widget shows transparency information and chooses the size of the checkerboard used to do that.

Signal Details

GimpUi.ColorArea.signals.color_changed(color_area)
Signal Name:

color-changed

Flags:

RUN_FIRST

Parameters:

color_area (GimpUi.ColorArea) – The object which received the signal

Property Details

GimpUi.ColorArea.props.color
Name:

color

Type:

Gegl.Color

Default Value:

<Color object at 0x000000000000 (GeglColor at 0x0000000)>

Flags:

READABLE, WRITABLE, CONSTRUCT

The color displayed in the color area.

New in version 2.4.

GimpUi.ColorArea.props.drag_mask
Name:

drag-mask

Type:

Gdk.ModifierType

Default Value:

0

Flags:

WRITABLE

The modifier mask that triggers dragging the color

GimpUi.ColorArea.props.draw_border
Name:

draw-border

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to draw a thin border in the foreground color around the area.

New in version 2.4.

GimpUi.ColorArea.props.type
Name:

type

Type:

GimpUi.ColorAreaType

Default Value:

GimpUi.ColorAreaType.FLAT

Flags:

READABLE, WRITABLE, CONSTRUCT

The type of the color area.

New in version 2.4.