Mapping the mouse position to a pixel in a gtk4::Picture

Hello,

I’m trying to get which color of a gtk4::Picture is under the mouse. I do have the raw image so once I know over which pixel the mouse is, getting the is trivial. The problem is, knowing said pixel position has proven imposible to me. I have tried using the EventControllerMotion, but that only returns mouse position relative to the Picture widget, but the Picture widget is not the same size as the image it shows, and the size difference varies with the window size, so mapping the position given by the EventControllerMotion to an image pixel it’s not straight forward.

Any help is appreciated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.