2 * Copyright (C) 2006 John Ellis
3 * Copyright (C) 2008 - 2016 The Geeqie Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "image-overlay.h"
26 #include "histogram.h"
31 #include "pixbuf-renderer.h"
32 #include "pixbuf_util.h"
33 #include "ui_fileops.h"
34 #include "image-load.h"
37 *----------------------------------------------------------------------------
39 *----------------------------------------------------------------------------
43 typedef struct _OverlayStateData OverlayStateData;
44 struct _OverlayStateData {
46 ImageState changed_states;
52 OverlayRendererFlags origin;
59 gint icon_time[IMAGE_OSD_COUNT];
60 gint icon_id[IMAGE_OSD_COUNT];
62 guint idle_id; /* event source id */
63 guint timer_id; /* event source id */
68 typedef struct _OSDIcon OSDIcon;
70 gboolean reset; /* reset on new image */
71 gint x; /* x, y offset */
73 gchar *key; /* inline pixbuf */
76 static OSDIcon osd_icons[] = {
77 { TRUE, 0, 0, NULL }, /* none */
78 { TRUE, -10, -10, NULL }, /* auto rotated */
79 { TRUE, -10, -10, NULL }, /* user rotated */
80 { TRUE, -40, -10, NULL }, /* color embedded */
81 { TRUE, -70, -10, NULL }, /* first image */
82 { TRUE, -70, -10, NULL }, /* last image */
83 { FALSE, -70, -10, NULL }, /* osd enabled */
87 #define OSD_DATA "overlay-data"
89 #define IMAGE_OSD_DEFAULT_DURATION 30
91 #define HISTOGRAM_HEIGHT 140
92 #define HISTOGRAM_WIDTH 256
94 static void image_osd_timer_schedule(OverlayStateData *osd);
96 void set_image_overlay_template_string(gchar **template_string, const gchar *value)
98 g_assert(template_string);
100 g_free(*template_string);
101 *template_string = g_strdup(value);
105 void set_default_image_overlay_template_string(gchar **template_string)
107 set_image_overlay_template_string(template_string, DEFAULT_OVERLAY_INFO);
110 void set_image_overlay_font_string(gchar **font_string, const gchar *value)
112 g_assert(font_string);
114 g_free(*font_string);
115 *font_string = g_strdup(value);
118 static OverlayStateData *image_get_osd_data(ImageWindow *imd)
120 OverlayStateData *osd;
122 if (!imd) return NULL;
126 osd = g_object_get_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA");
130 static void image_set_osd_data(ImageWindow *imd, OverlayStateData *osd)
134 g_object_set_data(G_OBJECT(imd->pr), "IMAGE_OVERLAY_DATA", osd);
138 *----------------------------------------------------------------------------
140 *----------------------------------------------------------------------------
144 void image_osd_histogram_toggle_channel(ImageWindow *imd)
146 OverlayStateData *osd = image_get_osd_data(imd);
148 if (!osd || !osd->histogram) return;
150 histogram_toggle_channel(osd->histogram);
151 image_osd_update(imd);
154 void image_osd_histogram_toggle_mode(ImageWindow *imd)
156 OverlayStateData *osd = image_get_osd_data(imd);
158 if (!osd || !osd->histogram) return;
160 histogram_toggle_mode(osd->histogram);
161 image_osd_update(imd);
164 void image_osd_histogram_set_channel(ImageWindow *imd, gint chan)
166 OverlayStateData *osd = image_get_osd_data(imd);
168 if (!osd || !osd->histogram) return;
170 histogram_set_channel(osd->histogram, chan);
171 image_osd_update(imd);
174 void image_osd_histogram_set_mode(ImageWindow *imd, gint mode)
176 OverlayStateData *osd = image_get_osd_data(imd);
178 if (!osd || !osd->histogram) return;
180 histogram_set_mode(osd->histogram, mode);
181 image_osd_update(imd);
184 gint image_osd_histogram_get_channel(ImageWindow *imd)
186 OverlayStateData *osd = image_get_osd_data(imd);
188 if (!osd || !osd->histogram) return HCHAN_DEFAULT;
190 return histogram_get_channel(osd->histogram);
193 gint image_osd_histogram_get_mode(ImageWindow *imd)
195 OverlayStateData *osd = image_get_osd_data(imd);
197 if (!osd || !osd->histogram) return 0;
199 return histogram_get_mode(osd->histogram);
202 void image_osd_toggle(ImageWindow *imd)
207 show = image_osd_get(imd);
208 if (show == OSD_SHOW_NOTHING)
210 image_osd_set(imd, OSD_SHOW_INFO | OSD_SHOW_STATUS);
215 if (show & OSD_SHOW_GUIDELINES)
217 image_osd_set(imd, OSD_SHOW_NOTHING);
219 else if (show & OSD_SHOW_HISTOGRAM)
221 image_osd_set(imd, OSD_SHOW_GUIDELINES);
222 image_osd_set(imd, show | ~OSD_SHOW_HISTOGRAM);
226 image_osd_set(imd, show | OSD_SHOW_HISTOGRAM);
231 static GdkPixbuf *image_osd_info_render(OverlayStateData *osd)
233 GdkPixbuf *pixbuf = NULL;
239 const HistMap *histmap = NULL;
240 ImageWindow *imd = osd->imd;
241 FileData *fd = image_get_fd(imd);
242 PangoFontDescription *font_desc;
244 if (!fd) return NULL;
246 name = image_get_name(imd);
254 vars = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
256 cd = image_get_collection(imd, &info);
259 t = g_list_length(cd->list);
260 n = g_list_index(cd->list, info) + 1;
263 if (file_extension_match(cd->name, GQ_COLLECTION_EXT))
264 osd_template_insert(vars, "collection", remove_extension_from_path(cd->name), OSDT_FREE);
266 osd_template_insert(vars, "collection", cd->name, OSDT_NONE);
270 osd_template_insert(vars, "collection", _("Untitled"), OSDT_NONE);
275 LayoutWindow *lw = layout_find_by_image(imd);
280 n = g_list_length(lw->slideshow->list_done);
281 t = n + g_list_length(lw->slideshow->list);
286 t = layout_list_count(lw, NULL);
287 n = layout_list_get_index(lw, image_get_fd(lw->image)) + 1;
290 else if (view_window_find_image(imd, &n, &t))
303 osd_template_insert(vars, "collection", NULL, OSDT_NONE);
306 osd_template_insert(vars, "number", g_strdup_printf("%d", n), OSDT_NO_DUP);
307 osd_template_insert(vars, "total", g_strdup_printf("%d", t), OSDT_NO_DUP);
308 osd_template_insert(vars, "name", (gchar *) name, OSDT_NONE);
309 osd_template_insert(vars, "path", (gchar *) image_get_path(imd), OSDT_NONE);
310 osd_template_insert(vars, "date", imd->image_fd ? ((gchar *) text_from_time(imd->image_fd->date)) : "", OSDT_NONE);
311 osd_template_insert(vars, "size", imd->image_fd ? (text_from_size_abrev(imd->image_fd->size)) : g_strdup(""), OSDT_FREE);
312 osd_template_insert(vars, "zoom", image_zoom_get_as_text(imd), OSDT_FREE);
317 GdkPixbuf *load_pixbuf = image_loader_get_pixbuf(imd->il);
319 if (imd->delay_flip &&
320 imd->il && load_pixbuf &&
321 image_get_pixbuf(imd) != load_pixbuf)
323 w = gdk_pixbuf_get_width(load_pixbuf);
324 h = gdk_pixbuf_get_height(load_pixbuf);
328 image_get_image_size(imd, &w, &h);
332 osd_template_insert(vars, "width", g_strdup_printf("%d", w), OSDT_NO_DUP);
333 osd_template_insert(vars, "height", g_strdup_printf("%d", h), OSDT_NO_DUP);
334 osd_template_insert(vars, "res", g_strdup_printf("%d × %d", w, h), OSDT_FREE);
338 osd_template_insert(vars, "width", NULL, OSDT_NONE);
339 osd_template_insert(vars, "height", NULL, OSDT_NONE);
340 osd_template_insert(vars, "res", NULL, OSDT_NONE);
343 text = image_osd_mkinfo(options->image_overlay.template_string, imd->image_fd, vars);
344 g_hash_table_destroy(vars);
347 /* When does this occur ?? */
348 text = g_markup_escape_text(_("Untitled"), -1);
351 with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram);
354 histmap = histmap_get(imd->image_fd);
357 histmap_start_idle(imd->image_fd);
364 gint active_marks = 0;
368 for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
370 active_marks += file_data_get_mark(fd, mark);
373 if (active_marks > 0)
375 GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
377 for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
379 g_string_append_printf(buf, file_data_get_mark(fd, mark) ? " <span background='#FF00FF'>%c</span>" : " %c", '1' + (mark < 9 ? mark : -1) );
383 text2 = g_strdup_printf("%s\n%s", text, buf->str);
385 text2 = g_strdup(buf->str);
386 g_string_free(buf, TRUE);
393 gchar *escaped_histogram_label = g_markup_escape_text(histogram_label(osd->histogram), -1);
395 text2 = g_strdup_printf("%s\n%s", text, escaped_histogram_label);
397 text2 = g_strdup(escaped_histogram_label);
398 g_free(escaped_histogram_label);
404 font_desc = pango_font_description_from_string(options->image_overlay.font);
405 layout = gtk_widget_create_pango_layout(imd->pr, NULL);
406 pango_layout_set_font_description(layout, font_desc);
408 pango_layout_set_markup(layout, text, -1);
411 pango_layout_get_pixel_size(layout, &width, &height);
412 /* with empty text width is set to 0, but not height) */
415 else if (height == 0)
417 if (width > 0) width += 10;
418 if (height > 0) height += 10;
422 if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10;
423 height += HISTOGRAM_HEIGHT + 5;
426 if (width > 0 && height > 0)
428 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
429 pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, options->image_overlay.background_red, options->image_overlay.background_green,
430 options->image_overlay.background_blue, options->image_overlay.background_alpha);
431 pixbuf_set_rect(pixbuf, 0, 0, width, height, 240, 240, 240, 80, 1, 1, 1, 1);
432 pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 240, 240, 240, 130, 1, 1, 1, 1);
433 pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 240, 240, 240, 180, 1, 1, 1, 1);
434 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0);
435 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0);
436 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0);
437 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
442 gint y = height - HISTOGRAM_HEIGHT - 5;
445 pixbuf_set_rect_fill(pixbuf, x, y, w, HISTOGRAM_HEIGHT, 220, 220, 220, 210);
446 histogram_draw(osd->histogram, histmap, pixbuf, x, y, w, HISTOGRAM_HEIGHT);
448 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, options->image_overlay.text_red, options->image_overlay.text_green,
449 options->image_overlay.text_blue, options->image_overlay.text_alpha);
452 g_object_unref(G_OBJECT(layout));
457 static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag)
459 static GdkPixbuf **icons = NULL;
460 GdkPixbuf *icon = NULL;
462 if (!icons) icons = g_new0(GdkPixbuf *, IMAGE_OSD_COUNT);
463 if (icons[flag]) return icons[flag];
465 if (osd_icons[flag].key)
467 icon = pixbuf_inline(osd_icons[flag].key);
472 icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 24, 24);
473 pixbuf_set_rect_fill(icon, 1, 1, 22, 22, 255, 255, 255, 200);
474 pixbuf_set_rect(icon, 0, 0, 24, 24, 0, 0, 0, 128, 1, 1, 1, 1);
477 case IMAGE_OSD_ROTATE_AUTO:
478 pixbuf_set_rect(icon, 3, 8, 11, 12,
481 pixbuf_draw_triangle(icon, 14, 3, 6, 12,
482 20, 9, 14, 15, 14, 3,
485 case IMAGE_OSD_ROTATE_USER:
487 case IMAGE_OSD_COLOR:
488 pixbuf_set_rect_fill(icon, 3, 3, 18, 6, 200, 0, 0, 255);
489 pixbuf_set_rect_fill(icon, 3, 9, 18, 6, 0, 200, 0, 255);
490 pixbuf_set_rect_fill(icon, 3, 15, 18, 6, 0, 0, 200, 255);
492 case IMAGE_OSD_FIRST:
493 pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 3, 0);
494 pixbuf_draw_triangle(icon, 6, 5, 12, 6,
495 12, 5, 18, 11, 6, 11,
499 pixbuf_set_rect(icon, 3, 3, 18, 18, 0, 0, 0, 200, 3, 3, 0, 3);
500 pixbuf_draw_triangle(icon, 6, 12, 12, 6,
501 12, 18, 6, 12, 18, 12,
505 pixbuf_set_rect_fill(icon, 11, 3, 3, 12, 0, 0, 0, 255);
506 pixbuf_set_rect_fill(icon, 11, 17, 3, 3, 0, 0, 0, 255);
518 static GdkPixbuf *image_osd_guidelines_render(OverlayStateData *osd)
521 GdkPixbuf *rectangles;
522 ImageWindow *imd = osd->imd;
524 /** @FIXME guidelines does not work with revised draw signal handling
526 //~ pixbuf_renderer_get_scaled_size((PixbufRenderer *)imd->pr, &width, &height);
528 //~ if (width && height)
530 //~ rectangles = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
533 //~ pixbuf_set_rect_fill(rectangles, 0, 0, width, height, 255, 255, 255, 0);
534 //~ pixbuf_set_rect(rectangles, 0, 0 + (height / 3), width, height / 3,
537 //~ pixbuf_set_rect(rectangles, 0, 0 + (height / 3 + 1), width, height / 3 - 2,
538 //~ 255, 255, 255, 255,
541 //~ pixbuf_set_rect(rectangles, 0 + width / 3, 0 , width / 3, height,
544 //~ pixbuf_set_rect(rectangles, 0 + width / 3 + 1, 0, width / 3 - 2, height,
545 //~ 255, 255, 255, 255,
547 //~ return rectangles;
554 static gint image_overlay_add(ImageWindow *imd, GdkPixbuf *pixbuf, gint x, gint y,
555 OverlayRendererFlags flags)
557 return pixbuf_renderer_overlay_add((PixbufRenderer *)imd->pr, pixbuf, x, y, flags);
560 static void image_overlay_set(ImageWindow *imd, gint id, GdkPixbuf *pixbuf, gint x, gint y)
562 pixbuf_renderer_overlay_set((PixbufRenderer *)imd->pr, id, pixbuf, x, y);
565 static void image_overlay_remove(ImageWindow *imd, gint id)
567 pixbuf_renderer_overlay_remove((PixbufRenderer *)imd->pr, id);
570 static void image_osd_icon_show(OverlayStateData *osd, ImageOSDFlag flag)
574 if (osd->icon_id[flag]) return;
576 pixbuf = image_osd_icon_pixbuf(flag);
579 osd->icon_id[flag] = image_overlay_add(osd->imd, pixbuf,
580 osd_icons[flag].x, osd_icons[flag].y,
584 static void image_osd_icon_hide(OverlayStateData *osd, ImageOSDFlag flag)
586 if (osd->icon_id[flag])
588 image_overlay_remove(osd->imd, osd->icon_id[flag]);
589 osd->icon_id[flag] = 0;
593 static void image_osd_icons_reset_time(OverlayStateData *osd)
597 for (i = 0; i < IMAGE_OSD_COUNT; i++)
599 if (osd_icons[i].reset)
601 osd->icon_time[i] = 0;
606 static void image_osd_icons_update(OverlayStateData *osd)
610 for (i = 0; i < IMAGE_OSD_COUNT; i++)
612 if (osd->icon_time[i] > 0)
614 image_osd_icon_show(osd, i);
618 image_osd_icon_hide(osd, i);
623 static void image_osd_icons_hide(OverlayStateData *osd)
627 for (i = 0; i < IMAGE_OSD_COUNT; i++)
629 image_osd_icon_hide(osd, i);
633 static void image_osd_info_show(OverlayStateData *osd, GdkPixbuf *pixbuf)
635 if (osd->ovl_info == 0)
637 osd->ovl_info = image_overlay_add(osd->imd, pixbuf, osd->x, osd->y, osd->origin);
641 image_overlay_set(osd->imd, osd->ovl_info, pixbuf, osd->x, osd->y);
645 static void image_osd_info_hide(OverlayStateData *osd)
647 if (osd->ovl_info == 0) return;
649 image_overlay_remove(osd->imd, osd->ovl_info);
653 static gboolean image_osd_update_cb(gpointer data)
655 OverlayStateData *osd = data;
657 if (osd->show & OSD_SHOW_INFO)
659 /* redraw when the image was changed,
660 with histogram we have to redraw also when loading is finished */
661 if (osd->changed_states & IMAGE_STATE_IMAGE ||
662 (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_HISTOGRAM) ||
663 (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_GUIDELINES) ||
664 osd->notify & NOTIFY_HISTMAP)
668 if (osd->show & OSD_SHOW_GUIDELINES)
670 ImageWindow *imd = osd->imd;
671 osd->x = ((PixbufRenderer *)imd->pr)->x_offset;
672 osd->y = ((PixbufRenderer *)imd->pr)->y_offset;
673 osd->origin = OVL_NORMAL;
675 pixbuf = image_osd_guidelines_render(osd);
678 image_osd_info_show(osd, pixbuf);
679 g_object_unref(pixbuf);
682 osd->x = options->image_overlay.x;
683 osd->y = options->image_overlay.y;
684 osd->origin = OVL_RELATIVE;
688 pixbuf = image_osd_info_render(osd);
691 image_osd_info_show(osd, pixbuf);
692 g_object_unref(pixbuf);
696 image_osd_info_hide(osd);
703 image_osd_info_hide(osd);
706 if (osd->show & OSD_SHOW_STATUS)
708 if (osd->changed_states & IMAGE_STATE_IMAGE)
709 image_osd_icons_reset_time(osd);
711 if (osd->changed_states & IMAGE_STATE_COLOR_ADJ)
713 osd->icon_time[IMAGE_OSD_COLOR] = IMAGE_OSD_DEFAULT_DURATION + 1;
714 image_osd_timer_schedule(osd);
717 if (osd->changed_states & IMAGE_STATE_ROTATE_AUTO)
721 if (osd->imd->state & IMAGE_STATE_ROTATE_AUTO)
724 if (!osd->imd->cm) n += IMAGE_OSD_DEFAULT_DURATION;
727 osd->icon_time[IMAGE_OSD_ROTATE_AUTO] = n;
728 image_osd_timer_schedule(osd);
731 image_osd_icons_update(osd);
735 image_osd_icons_hide(osd);
738 osd->changed_states = IMAGE_STATE_NONE;
744 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force)
746 if (force) osd->changed_states |= IMAGE_STATE_IMAGE;
750 osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL);
754 void image_osd_update(ImageWindow *imd)
756 OverlayStateData *osd = image_get_osd_data(imd);
760 image_osd_update_schedule(osd, TRUE);
763 static gboolean image_osd_timer_cb(gpointer data)
765 OverlayStateData *osd = data;
766 gboolean done = TRUE;
767 gboolean changed = FALSE;
770 for (i = 0; i < IMAGE_OSD_COUNT; i++)
772 if (osd->icon_time[i] > 1)
775 if (osd->icon_time[i] < 2)
777 osd->icon_time[i] = 0;
787 if (changed) image_osd_update_schedule(osd, FALSE);
798 static void image_osd_timer_schedule(OverlayStateData *osd)
802 osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd);
806 static void image_osd_state_cb(ImageWindow *imd, ImageState state, gpointer data)
808 OverlayStateData *osd = data;
810 osd->changed_states |= state;
811 image_osd_update_schedule(osd, FALSE);
814 static void image_osd_notify_cb(FileData *fd, NotifyType type, gpointer data)
816 OverlayStateData *osd = data;
818 if ((type & (NOTIFY_HISTMAP)) && osd->imd && fd == osd->imd->image_fd)
820 DEBUG_1("Notify osd: %s %04x", fd->path, type);
822 image_osd_update_schedule(osd, FALSE);
827 static void image_osd_free(OverlayStateData *osd)
831 if (osd->idle_id) g_source_remove(osd->idle_id);
832 if (osd->timer_id) g_source_remove(osd->timer_id);
834 file_data_unregister_notify_func(image_osd_notify_cb, osd);
838 image_set_osd_data(osd->imd, NULL);
839 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id);
841 image_set_state_func(osd->imd, NULL, NULL);
843 image_osd_info_hide(osd);
844 image_osd_icons_hide(osd);
847 if (osd->histogram) histogram_free(osd->histogram);
852 static void image_osd_destroy_cb(GtkWidget *widget, gpointer data)
854 OverlayStateData *osd = data;
860 static void image_osd_enable(ImageWindow *imd, OsdShowFlags show)
862 OverlayStateData *osd = image_get_osd_data(imd);
866 osd = g_new0(OverlayStateData, 1);
868 osd->show = OSD_SHOW_NOTHING;
869 osd->x = options->image_overlay.x;
870 osd->y = options->image_overlay.y;
871 osd->origin = OVL_RELATIVE;
873 osd->histogram = histogram_new();
875 osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy",
876 G_CALLBACK(image_osd_destroy_cb), osd);
877 image_set_osd_data(imd, osd);
879 image_set_state_func(osd->imd, image_osd_state_cb, osd);
880 file_data_register_notify_func(image_osd_notify_cb, osd, NOTIFY_PRIORITY_LOW);
883 if (show & OSD_SHOW_STATUS)
884 image_osd_icon(imd, IMAGE_OSD_ICON, -1);
886 if (show != osd->show)
887 image_osd_update_schedule(osd, TRUE);
892 void image_osd_set(ImageWindow *imd, OsdShowFlags show)
896 image_osd_enable(imd, show);
899 OsdShowFlags image_osd_get(ImageWindow *imd)
901 OverlayStateData *osd = image_get_osd_data(imd);
903 return osd ? osd->show : OSD_SHOW_NOTHING;
906 Histogram *image_osd_get_histogram(ImageWindow *imd)
908 OverlayStateData *osd = image_get_osd_data(imd);
910 return osd ? osd->histogram : NULL;
913 void image_osd_copy_status(ImageWindow *src, ImageWindow *dest)
915 Histogram *h_src, *h_dest;
916 image_osd_set(dest, image_osd_get(src));
918 h_src = image_osd_get_histogram(src);
919 h_dest = image_osd_get_histogram(dest);
921 h_dest->histogram_mode = h_src->histogram_mode;
922 h_dest->histogram_channel = h_src->histogram_channel;
929 2+ = show for duration tenths of a second
930 -1 = use default duration
932 void image_osd_icon(ImageWindow *imd, ImageOSDFlag flag, gint duration)
934 OverlayStateData *osd = image_get_osd_data(imd);
938 if (flag >= IMAGE_OSD_COUNT) return;
939 if (duration < 0) duration = IMAGE_OSD_DEFAULT_DURATION;
940 if (duration > 1) duration += 1;
942 osd->icon_time[flag] = duration;
944 image_osd_update_schedule(osd, FALSE);
945 image_osd_timer_schedule(osd);
947 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */