mirror of https://github.com/GNOME/gimp.git
app: no more GimpRGB in GimpDashboard and related.
This commit is contained in:
parent
6a2aee1fce
commit
cfd0389c37
|
@ -210,7 +210,7 @@ struct _VariableInfo
|
||||||
const gchar *description;
|
const gchar *description;
|
||||||
VariableType type;
|
VariableType type;
|
||||||
gboolean exclude_from_log;
|
gboolean exclude_from_log;
|
||||||
GimpRGB color;
|
gdouble rgb[4];
|
||||||
VariableFunc sample_func;
|
VariableFunc sample_func;
|
||||||
VariableFunc reset_func;
|
VariableFunc reset_func;
|
||||||
gconstpointer data;
|
gconstpointer data;
|
||||||
|
@ -473,7 +473,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Occupied"),
|
.title = NC_("dashboard-variable", "Occupied"),
|
||||||
.description = N_("Tile cache occupied size"),
|
.description = N_("Tile cache occupied size"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.3, 0.6, 0.3, 1.0},
|
.rgb = {0.3, 0.6, 0.3, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "tile-cache-total"
|
.data = "tile-cache-total"
|
||||||
},
|
},
|
||||||
|
@ -483,7 +483,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Maximum"),
|
.title = NC_("dashboard-variable", "Maximum"),
|
||||||
.description = N_("Maximal tile cache occupied size"),
|
.description = N_("Maximal tile cache occupied size"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.3, 0.7, 0.8, 1.0},
|
.rgb = {0.3, 0.7, 0.8, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "tile-cache-total-max"
|
.data = "tile-cache-total-max"
|
||||||
},
|
},
|
||||||
|
@ -525,7 +525,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Occupied"),
|
.title = NC_("dashboard-variable", "Occupied"),
|
||||||
.description = N_("Swap file occupied size"),
|
.description = N_("Swap file occupied size"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.2, 0.2, 1.0},
|
.rgb = {0.8, 0.2, 0.2, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "swap-total"
|
.data = "swap-total"
|
||||||
},
|
},
|
||||||
|
@ -535,7 +535,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Size"),
|
.title = NC_("dashboard-variable", "Size"),
|
||||||
.description = N_("Swap file size"),
|
.description = N_("Swap file size"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.6, 0.4, 1.0},
|
.rgb = {0.8, 0.6, 0.4, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "swap-file-size"
|
.data = "swap-file-size"
|
||||||
},
|
},
|
||||||
|
@ -553,7 +553,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Queued"),
|
.title = NC_("dashboard-variable", "Queued"),
|
||||||
.description = N_("Size of data queued for writing to the swap"),
|
.description = N_("Size of data queued for writing to the swap"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.8, 0.2, 0.5},
|
.rgb = {0.8, 0.8, 0.2, 0.5},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "swap-queued-total"
|
.data = "swap-queued-total"
|
||||||
},
|
},
|
||||||
|
@ -585,7 +585,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Read"),
|
.title = NC_("dashboard-variable", "Read"),
|
||||||
.description = N_("Total amount of data read from the swap"),
|
.description = N_("Total amount of data read from the swap"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.2, 0.4, 1.0, 0.4},
|
.rgb = {0.2, 0.4, 1.0, 0.4},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "swap-read-total"
|
.data = "swap-read-total"
|
||||||
},
|
},
|
||||||
|
@ -595,7 +595,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Read throughput"),
|
.title = NC_("dashboard-variable", "Read throughput"),
|
||||||
.description = N_("The rate at which data is read from the swap"),
|
.description = N_("The rate at which data is read from the swap"),
|
||||||
.type = VARIABLE_TYPE_RATE_OF_CHANGE,
|
.type = VARIABLE_TYPE_RATE_OF_CHANGE,
|
||||||
.color = {0.2, 0.4, 1.0, 1.0},
|
.rgb = {0.2, 0.4, 1.0, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_variable_rate_of_change,
|
.sample_func = gimp_dashboard_sample_variable_rate_of_change,
|
||||||
.data = GINT_TO_POINTER (VARIABLE_SWAP_READ)
|
.data = GINT_TO_POINTER (VARIABLE_SWAP_READ)
|
||||||
},
|
},
|
||||||
|
@ -608,7 +608,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Written"),
|
.title = NC_("dashboard-variable", "Written"),
|
||||||
.description = N_("Total amount of data written to the swap"),
|
.description = N_("Total amount of data written to the swap"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.3, 0.2, 0.4},
|
.rgb = {0.8, 0.3, 0.2, 0.4},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "swap-write-total"
|
.data = "swap-write-total"
|
||||||
},
|
},
|
||||||
|
@ -618,7 +618,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Write throughput"),
|
.title = NC_("dashboard-variable", "Write throughput"),
|
||||||
.description = N_("The rate at which data is written to the swap"),
|
.description = N_("The rate at which data is written to the swap"),
|
||||||
.type = VARIABLE_TYPE_RATE_OF_CHANGE,
|
.type = VARIABLE_TYPE_RATE_OF_CHANGE,
|
||||||
.color = {0.8, 0.3, 0.2, 1.0},
|
.rgb = {0.8, 0.3, 0.2, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_variable_rate_of_change,
|
.sample_func = gimp_dashboard_sample_variable_rate_of_change,
|
||||||
.data = GINT_TO_POINTER (VARIABLE_SWAP_WRITTEN)
|
.data = GINT_TO_POINTER (VARIABLE_SWAP_WRITTEN)
|
||||||
},
|
},
|
||||||
|
@ -642,7 +642,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Usage"),
|
.title = NC_("dashboard-variable", "Usage"),
|
||||||
.description = N_("Total CPU usage"),
|
.description = N_("Total CPU usage"),
|
||||||
.type = VARIABLE_TYPE_PERCENTAGE,
|
.type = VARIABLE_TYPE_PERCENTAGE,
|
||||||
.color = {0.8, 0.7, 0.2, 1.0},
|
.rgb = {0.8, 0.7, 0.2, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_cpu_usage
|
.sample_func = gimp_dashboard_sample_cpu_usage
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Active"),
|
.title = NC_("dashboard-variable", "Active"),
|
||||||
.description = N_("Whether the CPU is active"),
|
.description = N_("Whether the CPU is active"),
|
||||||
.type = VARIABLE_TYPE_BOOLEAN,
|
.type = VARIABLE_TYPE_BOOLEAN,
|
||||||
.color = {0.9, 0.8, 0.3, 1.0},
|
.rgb = {0.9, 0.8, 0.3, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_cpu_active
|
.sample_func = gimp_dashboard_sample_cpu_active
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Active"),
|
.title = NC_("dashboard-variable", "Active"),
|
||||||
.description = N_("Total amount of time the CPU has been active"),
|
.description = N_("Total amount of time the CPU has been active"),
|
||||||
.type = VARIABLE_TYPE_DURATION,
|
.type = VARIABLE_TYPE_DURATION,
|
||||||
.color = {0.8, 0.7, 0.2, 0.4},
|
.rgb = {0.8, 0.7, 0.2, 0.4},
|
||||||
.sample_func = gimp_dashboard_sample_cpu_active_time
|
.sample_func = gimp_dashboard_sample_cpu_active_time
|
||||||
},
|
},
|
||||||
#endif /* HAVE_CPU_GROUP */
|
#endif /* HAVE_CPU_GROUP */
|
||||||
|
@ -674,7 +674,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Used"),
|
.title = NC_("dashboard-variable", "Used"),
|
||||||
.description = N_("Amount of memory used by the process"),
|
.description = N_("Amount of memory used by the process"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.5, 0.2, 1.0},
|
.rgb = {0.8, 0.5, 0.2, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_memory_used
|
.sample_func = gimp_dashboard_sample_memory_used
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Available"),
|
.title = NC_("dashboard-variable", "Available"),
|
||||||
.description = N_("Amount of available physical memory"),
|
.description = N_("Amount of available physical memory"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.8, 0.5, 0.2, 0.4},
|
.rgb = {0.8, 0.5, 0.2, 0.4},
|
||||||
.sample_func = gimp_dashboard_sample_memory_available
|
.sample_func = gimp_dashboard_sample_memory_available
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ static const VariableInfo variables[] =
|
||||||
.title = NC_("dashboard-variable", "Tile"),
|
.title = NC_("dashboard-variable", "Tile"),
|
||||||
.description = N_("Total size of tile memory"),
|
.description = N_("Total size of tile memory"),
|
||||||
.type = VARIABLE_TYPE_SIZE,
|
.type = VARIABLE_TYPE_SIZE,
|
||||||
.color = {0.3, 0.3, 1.0, 1.0},
|
.rgb = {0.3, 0.3, 1.0, 1.0},
|
||||||
.sample_func = gimp_dashboard_sample_gegl_stats,
|
.sample_func = gimp_dashboard_sample_gegl_stats,
|
||||||
.data = "tile-alloc-total"
|
.data = "tile-alloc-total"
|
||||||
},
|
},
|
||||||
|
@ -1218,7 +1218,9 @@ gimp_dashboard_init (GimpDashboard *dashboard)
|
||||||
/* group meter */
|
/* group meter */
|
||||||
if (group_info->has_meter)
|
if (group_info->has_meter)
|
||||||
{
|
{
|
||||||
meter = gimp_meter_new (group_data->n_meter_values);
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
meter = gimp_meter_new (priv->gimp, group_data->n_meter_values);
|
||||||
group_data->meter = GIMP_METER (meter);
|
group_data->meter = GIMP_METER (meter);
|
||||||
gimp_help_set_help_data (meter,
|
gimp_help_set_help_data (meter,
|
||||||
g_dgettext (NULL, group_info->description),
|
g_dgettext (NULL, group_info->description),
|
||||||
|
@ -1238,9 +1240,11 @@ gimp_dashboard_init (GimpDashboard *dashboard)
|
||||||
{
|
{
|
||||||
const VariableInfo *variable_info = &variables[field_info->variable];
|
const VariableInfo *variable_info = &variables[field_info->variable];
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), variable_info->rgb);
|
||||||
|
|
||||||
gimp_meter_set_value_color (GIMP_METER (meter),
|
gimp_meter_set_value_color (GIMP_METER (meter),
|
||||||
field_info->meter_value - 1,
|
field_info->meter_value - 1,
|
||||||
&variable_info->color);
|
color);
|
||||||
|
|
||||||
if (gimp_dashboard_field_use_meter_underlay (group, field))
|
if (gimp_dashboard_field_use_meter_underlay (group, field))
|
||||||
{
|
{
|
||||||
|
@ -1253,6 +1257,8 @@ gimp_dashboard_init (GimpDashboard *dashboard)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* group grid */
|
/* group grid */
|
||||||
|
@ -2907,7 +2913,7 @@ gimp_dashboard_update_group (GimpDashboard *dashboard,
|
||||||
{
|
{
|
||||||
GeglColor *color = gegl_color_new (NULL);
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &variable_info->color);
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), variable_info->rgb);
|
||||||
color_area = gimp_color_area_new (color, GIMP_COLOR_AREA_FLAT, 0);
|
color_area = gimp_color_area_new (color, GIMP_COLOR_AREA_FLAT, 0);
|
||||||
gimp_help_set_help_data (color_area, description,
|
gimp_help_set_help_data (color_area, description,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -3011,7 +3017,7 @@ gimp_dashboard_update_group_values (GimpDashboard *dashboard,
|
||||||
|
|
||||||
if (group_info->meter_led)
|
if (group_info->meter_led)
|
||||||
{
|
{
|
||||||
GimpRGB color = {0.0, 0.0, 0.0, 1.0};
|
gdouble rgb[3] = {0.0, 0.0, 0.0};
|
||||||
gboolean active = FALSE;
|
gboolean active = FALSE;
|
||||||
const Variable *var;
|
const Variable *var;
|
||||||
|
|
||||||
|
@ -3021,16 +3027,22 @@ gimp_dashboard_update_group_values (GimpDashboard *dashboard,
|
||||||
{
|
{
|
||||||
const VariableInfo *variable_info = &variables[*var];
|
const VariableInfo *variable_info = &variables[*var];
|
||||||
|
|
||||||
color.r = MAX (color.r, variable_info->color.r);
|
rgb[0] = MAX (rgb[0], variable_info->rgb[0]);
|
||||||
color.g = MAX (color.g, variable_info->color.g);
|
rgb[1] = MAX (rgb[1], variable_info->rgb[1]);
|
||||||
color.b = MAX (color.b, variable_info->color.b);
|
rgb[2] = MAX (rgb[2], variable_info->rgb[2]);
|
||||||
|
|
||||||
active = TRUE;
|
active = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
gimp_meter_set_led_color (group_data->meter, &color);
|
{
|
||||||
|
GeglColor *color = gegl_color_new (NULL);
|
||||||
|
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B' double"), rgb);
|
||||||
|
gimp_meter_set_led_color (group_data->meter, color);
|
||||||
|
g_object_unref (color);
|
||||||
|
}
|
||||||
|
|
||||||
gimp_meter_set_led_active (group_data->meter, active);
|
gimp_meter_set_led_active (group_data->meter, active);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
|
|
||||||
#include "widgets-types.h"
|
#include "widgets-types.h"
|
||||||
|
|
||||||
|
#include "config/gimpcoreconfig.h"
|
||||||
|
|
||||||
|
#include "core/gimp.h"
|
||||||
|
|
||||||
#include "gimpmeter.h"
|
#include "gimpmeter.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,12 +72,13 @@ typedef struct
|
||||||
gboolean active;
|
gboolean active;
|
||||||
gboolean show_in_gauge;
|
gboolean show_in_gauge;
|
||||||
gboolean show_in_history;
|
gboolean show_in_history;
|
||||||
GimpRGB color;
|
GeglColor *color;
|
||||||
GimpInterpolationType interpolation;
|
GimpInterpolationType interpolation;
|
||||||
} Value;
|
} Value;
|
||||||
|
|
||||||
struct _GimpMeterPrivate
|
struct _GimpMeterPrivate
|
||||||
{
|
{
|
||||||
|
Gimp *gimp;
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
|
|
||||||
gint size;
|
gint size;
|
||||||
|
@ -86,7 +91,7 @@ struct _GimpMeterPrivate
|
||||||
gdouble history_duration;
|
gdouble history_duration;
|
||||||
gdouble history_resolution;
|
gdouble history_resolution;
|
||||||
gboolean led_active;
|
gboolean led_active;
|
||||||
GimpRGB led_color;
|
GeglColor *led_color;
|
||||||
|
|
||||||
gdouble *samples;
|
gdouble *samples;
|
||||||
gint n_samples;
|
gint n_samples;
|
||||||
|
@ -223,9 +228,9 @@ gimp_meter_class_init (GimpMeterClass *klass)
|
||||||
G_PARAM_CONSTRUCT));
|
G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_LED_COLOR,
|
g_object_class_install_property (object_class, PROP_LED_COLOR,
|
||||||
gimp_param_spec_rgb ("led-color",
|
gegl_param_spec_color_from_string ("led-color",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
TRUE, &(GimpRGB) {},
|
/*TRUE,*/ "red",
|
||||||
GIMP_PARAM_READWRITE |
|
GIMP_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT));
|
G_PARAM_CONSTRUCT));
|
||||||
}
|
}
|
||||||
|
@ -253,6 +258,8 @@ gimp_meter_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GimpMeter *meter = GIMP_METER (object);
|
GimpMeter *meter = GIMP_METER (object);
|
||||||
|
|
||||||
|
for (gint i = 0; i < meter->priv->n_values; i++)
|
||||||
|
g_clear_object (&meter->priv->values[i].color);
|
||||||
g_clear_pointer (&meter->priv->values, g_free);
|
g_clear_pointer (&meter->priv->values, g_free);
|
||||||
g_clear_pointer (&meter->priv->samples, g_free);
|
g_clear_pointer (&meter->priv->samples, g_free);
|
||||||
g_clear_pointer (&meter->priv->uniform_sample, g_free);
|
g_clear_pointer (&meter->priv->uniform_sample, g_free);
|
||||||
|
@ -272,6 +279,7 @@ gimp_meter_finalize (GObject *object)
|
||||||
GimpMeter *meter = GIMP_METER (object);
|
GimpMeter *meter = GIMP_METER (object);
|
||||||
|
|
||||||
g_mutex_clear (&meter->priv->mutex);
|
g_mutex_clear (&meter->priv->mutex);
|
||||||
|
g_clear_object (&meter->priv->led_color);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -327,7 +335,7 @@ gimp_meter_set_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LED_COLOR:
|
case PROP_LED_COLOR:
|
||||||
gimp_meter_set_led_color (meter, g_value_get_boxed (value));
|
gimp_meter_set_led_color (meter, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -383,7 +391,7 @@ gimp_meter_get_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LED_COLOR:
|
case PROP_LED_COLOR:
|
||||||
g_value_set_boxed (value, gimp_meter_get_led_color (meter));
|
g_value_set_object (value, gimp_meter_get_led_color (meter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -483,7 +491,9 @@ gimp_meter_draw (GtkWidget *widget,
|
||||||
0.06 * size,
|
0.06 * size,
|
||||||
0.0 * REV, 1.0 * REV);
|
0.0 * REV, 1.0 * REV);
|
||||||
|
|
||||||
gimp_cairo_set_source_rgba (cr, &meter->priv->led_color);
|
gimp_cairo_set_source_color (cr, meter->priv->led_color,
|
||||||
|
meter->priv->gimp->config->color_management,
|
||||||
|
FALSE, widget);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +526,9 @@ gimp_meter_draw (GtkWidget *widget,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_cairo_set_source_rgba (cr, &meter->priv->values[i].color);
|
gimp_cairo_set_source_color (cr, meter->priv->values[i].color,
|
||||||
|
meter->priv->gimp->config->color_management,
|
||||||
|
FALSE, widget);
|
||||||
cairo_move_to (cr, 0.0, 0.0);
|
cairo_move_to (cr, 0.0, 0.0);
|
||||||
cairo_arc (cr,
|
cairo_arc (cr,
|
||||||
0.0, 0.0,
|
0.0, 0.0,
|
||||||
|
@ -620,7 +632,9 @@ gimp_meter_draw (GtkWidget *widget,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_cairo_set_source_rgba (cr, &meter->priv->values[i].color);
|
gimp_cairo_set_source_color (cr, meter->priv->values[i].color,
|
||||||
|
meter->priv->gimp->config->color_management,
|
||||||
|
FALSE, widget);
|
||||||
cairo_move_to (cr, 0.0, 0.0);
|
cairo_move_to (cr, 0.0, 0.0);
|
||||||
|
|
||||||
switch (meter->priv->values[i].interpolation)
|
switch (meter->priv->values[i].interpolation)
|
||||||
|
@ -865,11 +879,17 @@ gimp_meter_mask_sample (GimpMeter *meter,
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_meter_new (gint n_values)
|
gimp_meter_new (Gimp *gimp,
|
||||||
|
gint n_values)
|
||||||
{
|
{
|
||||||
return g_object_new (GIMP_TYPE_METER,
|
GimpMeter *meter;
|
||||||
|
|
||||||
|
meter = g_object_new (GIMP_TYPE_METER,
|
||||||
"n-values", n_values,
|
"n-values", n_values,
|
||||||
NULL);
|
NULL);
|
||||||
|
meter->priv->gimp = gimp;
|
||||||
|
|
||||||
|
return GTK_WIDGET (meter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -993,6 +1013,9 @@ gimp_meter_set_n_values (GimpMeter *meter,
|
||||||
{
|
{
|
||||||
g_mutex_lock (&meter->priv->mutex);
|
g_mutex_lock (&meter->priv->mutex);
|
||||||
|
|
||||||
|
for (gint i = n_values; i < meter->priv->n_values; i++)
|
||||||
|
g_clear_object (&meter->priv->values[i].color);
|
||||||
|
|
||||||
meter->priv->values = g_renew (Value, meter->priv->values, n_values);
|
meter->priv->values = g_renew (Value, meter->priv->values, n_values);
|
||||||
|
|
||||||
if (n_values > meter->priv->n_values)
|
if (n_values > meter->priv->n_values)
|
||||||
|
@ -1001,6 +1024,7 @@ gimp_meter_set_n_values (GimpMeter *meter,
|
||||||
&(Value) { .active = TRUE,
|
&(Value) { .active = TRUE,
|
||||||
.show_in_gauge = TRUE,
|
.show_in_gauge = TRUE,
|
||||||
.show_in_history = TRUE,
|
.show_in_history = TRUE,
|
||||||
|
.color = NULL,
|
||||||
.interpolation = GIMP_INTERPOLATION_CUBIC},
|
.interpolation = GIMP_INTERPOLATION_CUBIC},
|
||||||
sizeof (Value),
|
sizeof (Value),
|
||||||
n_values - meter->priv->n_values);
|
n_values - meter->priv->n_values);
|
||||||
|
@ -1056,28 +1080,29 @@ gimp_meter_get_value_active (GimpMeter *meter,
|
||||||
void
|
void
|
||||||
gimp_meter_set_value_color (GimpMeter *meter,
|
gimp_meter_set_value_color (GimpMeter *meter,
|
||||||
gint value,
|
gint value,
|
||||||
const GimpRGB *color)
|
GeglColor *color)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_METER (meter));
|
g_return_if_fail (GIMP_IS_METER (meter));
|
||||||
g_return_if_fail (value >= 0 && value < meter->priv->n_values);
|
g_return_if_fail (value >= 0 && value < meter->priv->n_values);
|
||||||
g_return_if_fail (color != NULL);
|
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||||
|
|
||||||
if (memcmp (color, &meter->priv->values[value].color, sizeof (GimpRGB)))
|
if (! gimp_color_is_perceptually_identical (color, meter->priv->values[value].color))
|
||||||
{
|
{
|
||||||
meter->priv->values[value].color = *color;
|
g_clear_object (&meter->priv->values[value].color);
|
||||||
|
meter->priv->values[value].color = gegl_color_duplicate (color);
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (meter));
|
gtk_widget_queue_draw (GTK_WIDGET (meter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GimpRGB *
|
GeglColor *
|
||||||
gimp_meter_get_value_color (GimpMeter *meter,
|
gimp_meter_get_value_color (GimpMeter *meter,
|
||||||
gint value)
|
gint value)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_METER (meter), NULL);
|
g_return_val_if_fail (GIMP_IS_METER (meter), NULL);
|
||||||
g_return_val_if_fail (value >= 0 && value < meter->priv->n_values, NULL);
|
g_return_val_if_fail (value >= 0 && value < meter->priv->n_values, NULL);
|
||||||
|
|
||||||
return &meter->priv->values[value].color;
|
return meter->priv->values[value].color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1297,14 +1322,15 @@ gimp_meter_get_led_active (GimpMeter *meter)
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_meter_set_led_color (GimpMeter *meter,
|
gimp_meter_set_led_color (GimpMeter *meter,
|
||||||
const GimpRGB *color)
|
GeglColor *color)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_METER (meter));
|
g_return_if_fail (GIMP_IS_METER (meter));
|
||||||
g_return_if_fail (color != NULL);
|
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||||
|
|
||||||
if (memcmp (color, &meter->priv->led_color, sizeof (GimpRGB)))
|
if (! gimp_color_is_perceptually_identical (color, meter->priv->led_color))
|
||||||
{
|
{
|
||||||
meter->priv->led_color = *color;
|
g_clear_object (&meter->priv->led_color);
|
||||||
|
meter->priv->led_color = gegl_color_duplicate (color);
|
||||||
|
|
||||||
if (meter->priv->led_active)
|
if (meter->priv->led_active)
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (meter));
|
gtk_widget_queue_draw (GTK_WIDGET (meter));
|
||||||
|
@ -1313,10 +1339,10 @@ gimp_meter_set_led_color (GimpMeter *meter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GimpRGB *
|
GeglColor *
|
||||||
gimp_meter_get_led_color (GimpMeter *meter)
|
gimp_meter_get_led_color (GimpMeter *meter)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_METER (meter), NULL);
|
g_return_val_if_fail (GIMP_IS_METER (meter), NULL);
|
||||||
|
|
||||||
return &meter->priv->led_color;
|
return meter->priv->led_color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ struct _GimpMeterClass
|
||||||
|
|
||||||
GType gimp_meter_get_type (void) G_GNUC_CONST;
|
GType gimp_meter_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkWidget * gimp_meter_new (gint n_values);
|
GtkWidget * gimp_meter_new (Gimp *gimp,
|
||||||
|
gint n_values);
|
||||||
|
|
||||||
void gimp_meter_set_size (GimpMeter *meter,
|
void gimp_meter_set_size (GimpMeter *meter,
|
||||||
gint size);
|
gint size);
|
||||||
|
@ -88,8 +89,8 @@ gboolean gimp_meter_get_value_show_in_history (GimpMeter
|
||||||
|
|
||||||
void gimp_meter_set_value_color (GimpMeter *meter,
|
void gimp_meter_set_value_color (GimpMeter *meter,
|
||||||
gint value,
|
gint value,
|
||||||
const GimpRGB *color);
|
GeglColor *color);
|
||||||
const GimpRGB * gimp_meter_get_value_color (GimpMeter *meter,
|
GeglColor * gimp_meter_get_value_color (GimpMeter *meter,
|
||||||
gint value);
|
gint value);
|
||||||
|
|
||||||
void gimp_meter_set_value_interpolation (GimpMeter *meter,
|
void gimp_meter_set_value_interpolation (GimpMeter *meter,
|
||||||
|
@ -120,8 +121,8 @@ void gimp_meter_set_led_active (GimpMeter
|
||||||
gboolean gimp_meter_get_led_active (GimpMeter *meter);
|
gboolean gimp_meter_get_led_active (GimpMeter *meter);
|
||||||
|
|
||||||
void gimp_meter_set_led_color (GimpMeter *meter,
|
void gimp_meter_set_led_color (GimpMeter *meter,
|
||||||
const GimpRGB *color);
|
GeglColor *color);
|
||||||
const GimpRGB * gimp_meter_get_led_color (GimpMeter *meter);
|
GeglColor * gimp_meter_get_led_color (GimpMeter *meter);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_METER_H__ */
|
#endif /* __GIMP_METER_H__ */
|
||||||
|
|
Loading…
Reference in New Issue