Hi, this is the first topic I write here, and also I am a beginner in programming with rust. my question is:
How to draw on a winit window with 2D graphics library like skia-rust , tiny skia, cairo-rs or raqote?
I need a simple example in which a simple shape is drawn by one of the graphics libraries in the winit window without adding any other dependencies in order for the example to be easy to understand
winit knows nothing about drawing or bitmaps and skia knows about window handles. Something (another dependency) needs to bridge the two, and that bridge has to handle major platform differences.
So far the ones I've seen either provide their own gui or provide a full 3D API. It's possible to use either type to just blit an image onscreen and build your own gui on top.
What I'm trying to do is write a gui, for that I need to draw the gui components like a button using a 2D graphics library, then handle the events as mouse events using winit. One of the most important features that I am trying to achieve is the ability for the component in the GUI to have more than one shape like a button, for example (rectangular, rounded corners...etc), color options (solid, linear gradient, circular gradient...etc) and anti-aliasing, so I mentioned these libraries . I don't mind other libraries as long as they can achieve the same purpose
You apparently can pass a raw window handle to safe-skia from winit, but for the life of me I can't find the API. It should be through an API in gpu::surfaces, though.