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



On 01/03/2019 20:45, Paolo Bacchilega via gthumb-list wrote:
Il 01/03/19 19:11, Phil Ashby ha scritto:
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

Many thanks for the advice Paolo, after a bit more experimenting with how all the various scaling and scrolling co-ordinates work, I now have a better solution using this approach, which fixes my issues with scaling marker text/lines and reloading them all the time. It should also work with all image types :)

Thanks again,
Phil.


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