mirror of https://github.com/GNOME/gimp.git
Bug 773462 - Color Picker should support range...
...regardless of image color precision Split enum value GIMP_COLOR_FRAME_MODE_RGB into RGB_PERCENT and RGB_U8, which display the current % values, and values in a range of 0..255.
This commit is contained in:
parent
00faf17965
commit
237d83dc7f
|
@ -321,7 +321,7 @@ gimp_cursor_view_init (GimpCursorView *view)
|
|||
|
||||
view->priv->color_frame_2 = gimp_color_frame_new ();
|
||||
gimp_color_frame_set_mode (GIMP_COLOR_FRAME (view->priv->color_frame_2),
|
||||
GIMP_COLOR_FRAME_MODE_RGB);
|
||||
GIMP_COLOR_FRAME_MODE_RGB_PERCENT);
|
||||
gtk_box_pack_start (GTK_BOX (view->priv->color_hbox), view->priv->color_frame_2,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->priv->color_frame_2);
|
||||
|
|
|
@ -376,7 +376,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
|
|||
gimp_color_frame_set_color_config (GIMP_COLOR_FRAME (picker_tool->color_frame2),
|
||||
context->gimp->config->color_management);
|
||||
gimp_color_frame_set_mode (GIMP_COLOR_FRAME (picker_tool->color_frame2),
|
||||
GIMP_COLOR_FRAME_MODE_RGB);
|
||||
GIMP_COLOR_FRAME_MODE_RGB_PERCENT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), picker_tool->color_frame2,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (picker_tool->color_frame2);
|
||||
|
|
|
@ -660,7 +660,8 @@ gimp_color_frame_update (GimpColorFrame *frame)
|
|||
}
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_FRAME_MODE_RGB:
|
||||
case GIMP_COLOR_FRAME_MODE_RGB_PERCENT:
|
||||
case GIMP_COLOR_FRAME_MODE_RGB_U8:
|
||||
names[0] = _("Red:");
|
||||
names[1] = _("Green:");
|
||||
names[2] = _("Blue:");
|
||||
|
@ -668,23 +669,30 @@ gimp_color_frame_update (GimpColorFrame *frame)
|
|||
if (has_alpha)
|
||||
names[3] = _("Alpha:");
|
||||
|
||||
if (frame->sample_valid)
|
||||
{
|
||||
values = g_new0 (gchar *, 6);
|
||||
|
||||
values[0] = g_strdup_printf ("%.01f %%", frame->color.r * 100.0);
|
||||
values[1] = g_strdup_printf ("%.01f %%", frame->color.g * 100.0);
|
||||
values[2] = g_strdup_printf ("%.01f %%", frame->color.b * 100.0);
|
||||
values[3] = g_strdup_printf ("%.01f %%", frame->color.a * 100.0);
|
||||
}
|
||||
|
||||
names[4] = _("Hex:");
|
||||
|
||||
if (frame->sample_valid)
|
||||
{
|
||||
guchar r, g, b;
|
||||
guchar r, g, b, a;
|
||||
|
||||
gimp_rgb_get_uchar (&frame->color, &r, &g, &b);
|
||||
values = g_new0 (gchar *, 6);
|
||||
|
||||
gimp_rgba_get_uchar (&frame->color, &r, &g, &b, &a);
|
||||
|
||||
if (frame->frame_mode == GIMP_COLOR_FRAME_MODE_RGB_PERCENT)
|
||||
{
|
||||
values[0] = g_strdup_printf ("%.01f %%", frame->color.r * 100.0);
|
||||
values[1] = g_strdup_printf ("%.01f %%", frame->color.g * 100.0);
|
||||
values[2] = g_strdup_printf ("%.01f %%", frame->color.b * 100.0);
|
||||
values[3] = g_strdup_printf ("%.01f %%", frame->color.a * 100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
values[0] = g_strdup_printf ("%d", r);
|
||||
values[1] = g_strdup_printf ("%d", g);
|
||||
values[2] = g_strdup_printf ("%d", b);
|
||||
values[3] = g_strdup_printf ("%d", a);
|
||||
}
|
||||
|
||||
values[4] = g_strdup_printf ("%.2x%.2x%.2x", r, g, b);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,8 @@ gimp_color_frame_mode_get_type (void)
|
|||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_COLOR_FRAME_MODE_PIXEL, "GIMP_COLOR_FRAME_MODE_PIXEL", "pixel" },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB, "GIMP_COLOR_FRAME_MODE_RGB", "rgb" },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB_PERCENT, "GIMP_COLOR_FRAME_MODE_RGB_PERCENT", "rgb-percent" },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB_U8, "GIMP_COLOR_FRAME_MODE_RGB_U8", "rgb-u8" },
|
||||
{ GIMP_COLOR_FRAME_MODE_HSV, "GIMP_COLOR_FRAME_MODE_HSV", "hsv" },
|
||||
{ GIMP_COLOR_FRAME_MODE_CMYK, "GIMP_COLOR_FRAME_MODE_CMYK", "cmyk" },
|
||||
{ 0, NULL, NULL }
|
||||
|
@ -112,7 +113,8 @@ gimp_color_frame_mode_get_type (void)
|
|||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_COLOR_FRAME_MODE_PIXEL, NC_("color-frame-mode", "Pixel"), NULL },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB, NC_("color-frame-mode", "RGB"), NULL },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB_PERCENT, NC_("color-frame-mode", "RGB (%)"), NULL },
|
||||
{ GIMP_COLOR_FRAME_MODE_RGB_U8, NC_("color-frame-mode", "RGB (0..255)"), NULL },
|
||||
{ GIMP_COLOR_FRAME_MODE_HSV, NC_("color-frame-mode", "HSV"), NULL },
|
||||
{ GIMP_COLOR_FRAME_MODE_CMYK, NC_("color-frame-mode", "CMYK"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
|
|
|
@ -63,10 +63,11 @@ GType gimp_color_frame_mode_get_type (void) G_GNUC_CONST;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_COLOR_FRAME_MODE_PIXEL, /*< desc="Pixel" >*/
|
||||
GIMP_COLOR_FRAME_MODE_RGB, /*< desc="RGB" >*/
|
||||
GIMP_COLOR_FRAME_MODE_HSV, /*< desc="HSV" >*/
|
||||
GIMP_COLOR_FRAME_MODE_CMYK /*< desc="CMYK" >*/
|
||||
GIMP_COLOR_FRAME_MODE_PIXEL, /*< desc="Pixel" >*/
|
||||
GIMP_COLOR_FRAME_MODE_RGB_PERCENT, /*< desc="RGB (%)" >*/
|
||||
GIMP_COLOR_FRAME_MODE_RGB_U8, /*< desc="RGB (0..255)" >*/
|
||||
GIMP_COLOR_FRAME_MODE_HSV, /*< desc="HSV" >*/
|
||||
GIMP_COLOR_FRAME_MODE_CMYK /*< desc="CMYK" >*/
|
||||
} GimpColorFrameMode;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue