Show color on hexa / rgb when it's enabled / disabled
No need to wait for cursor position changes to update it.
This commit is contained in:
parent
044184ef17
commit
e9dfef7048
|
@ -82,6 +82,7 @@ struct _Zone {
|
|||
struct {
|
||||
int x, y;
|
||||
} last_mouse;
|
||||
unsigned int color;
|
||||
Eina_Bool last_ruler_used : 1;
|
||||
Eina_Bool keyboard_move : 1;
|
||||
};
|
||||
|
@ -162,6 +163,23 @@ theme_apply(Evas_Object *edje, const char *group)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
set_color(const Zone *zone)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if (hex_colors)
|
||||
snprintf(buf, sizeof(buf), "#%06x", zone->color);
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%d %d %d",
|
||||
(zone->color >> 16) & 0xff,
|
||||
(zone->color >> 8) & 0xff,
|
||||
(zone->color & 0xff));
|
||||
}
|
||||
edje_object_part_text_set(zone->zoom.frame, "color", buf);
|
||||
}
|
||||
|
||||
static void
|
||||
show_hexa_apply(void)
|
||||
{
|
||||
|
@ -171,6 +189,7 @@ show_hexa_apply(void)
|
|||
EINA_LIST_FOREACH(zones, l, zone)
|
||||
{
|
||||
elm_check_state_set(zone->gui.hex_colors, hex_colors);
|
||||
set_color(zone);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,7 +470,7 @@ _event_mouse_tracker(void *data)
|
|||
if (zone->zoom.ready)
|
||||
{
|
||||
int fx, fy, fw, fh, zx, zy, zw, zh, stride, iw, ih;
|
||||
unsigned int *pixels, color;
|
||||
unsigned int *pixels;
|
||||
|
||||
zw = zone->zoom.ideal_size.w < zone->w / 4 ?
|
||||
zone->zoom.ideal_size.w : zone->w / 4;
|
||||
|
@ -487,18 +506,9 @@ _event_mouse_tracker(void *data)
|
|||
EINA_SAFETY_ON_FALSE_GOTO(x < iw, position_invalid);
|
||||
EINA_SAFETY_ON_FALSE_GOTO(y < ih, position_invalid);
|
||||
|
||||
color = pixels[y * (stride / sizeof(unsigned int)) + x];
|
||||
color = color & 0xffffff;
|
||||
if (hex_colors)
|
||||
snprintf(buf, sizeof(buf), "#%06x", color);
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%d %d %d",
|
||||
(color >> 16) & 0xff,
|
||||
(color >> 8) & 0xff,
|
||||
(color & 0xff));
|
||||
}
|
||||
edje_object_part_text_set(zone->zoom.frame, "color", buf);
|
||||
zone->color = pixels[y * (stride / sizeof(unsigned int)) + x];
|
||||
zone->color = zone->color & 0xffffff;
|
||||
set_color(zone);
|
||||
|
||||
position_invalid:
|
||||
evas_object_image_data_set(zone->zoom.image, pixels);
|
||||
|
|
Loading…
Reference in New Issue