Re: [gthumb-list] Writing an extension - how to overlay metadata on images?



Il 01/03/19 19:11, Phil Ashby ha scritto:
Hi gThumb list,


Hello,


My question for the list:

How /should/ I go about overlaying metadata on loaded images? Where and how should I intercept the rendering process (it feels like there should be hooks registered but I cannot find any)?


A possible way is to use the gth-browser-activate-viewer-page hook, inside the hook function you have to check if the current viewer page is of type GTH_IMAGE_VIEWER_PAGE, as an example see the function ir__gth_browser_activate_viewer_page_cb in extensions/image_rotation/callbacks.c.

If it's a GTH_IMAGE_VIEWER_PAGE, you can use gth_image_viewer_page_get_image_viewer to get the image viewer widget and then use gth_image_viewer_add_painter to add a function that will used to paint something over the image, as an example see the paint_comment_over_image_func in extensions/image_viewer/gth-image-viewer-page.c.

A painter function gets a cairo context, so from there you can just use cairo to paint over the image.

- Paolo


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]