jazzfool / reclutch

Rust UI Core
Other
157 stars 4 forks source link

Add alternative graphics implementations #11

Closed jazzfool closed 4 years ago

jazzfool commented 4 years ago

Currently an optional OpenGL-based Skia implementation of GraphicsDisplay is provided, but Skia presents a non-Rust build dependency.

In interest of a 100% Rust project, some alternative implementations should be provided.

jazzfool commented 4 years ago

Progress tracking at #14

jazzfool commented 4 years ago

Putting this in the backlog, although Skia is a non-Rust dependencies, the skia-safe developers have already implemented functionality to gracefully use pre-built binaries, making building it very painless.

Variety in rendering back-ends is preferable, but Skia works very well already, but I'll leave this issue open in case a Rust-based 2D graphics library shows up (perhaps Piet, but lack of backdrop filters and selective anti-aliasing is holding it back).

ctrlcctrlv commented 4 years ago

I don't know that this is really valuable to do.

I found it pretty annoying that Skia internals aren't pub in this library, so much so I tore it apart to make this:

https://github.com/ctrlcctrlv/imgui-skia-example

Thank you very much for the example code, but I'd ask you to just give us pub access to Skia.

jazzfool commented 4 years ago

So you want to use the reclutch::skia module to initialize a Skia surface? I could expose a &skia::Canvas closure as a specialized display command if that works? With that you could do something like this;

let mut display: SkiaGraphicsDisplay = /* ... */;
display.push_draw_closure(|canvas: &mut skia::Canvas| {
    canvas.draw_rect(/* ... */);
    // etc
}, ZOrder::default(), None, None);
ctrlcctrlv commented 4 years ago

Yes that works for me and it would make it so that I could use the real Reclutch :-)

I love your library don't get me wrong but I just had to do it this way because I need direct access to Skia for what I want to do here because my glyph editor uses lots of Skia APIs.

ctrlcctrlv commented 4 years ago

Your code that initializes the textures and the surfaces is really good, I was having a lot of trouble doing it myself so I decided why reinvent the wheel, your code is MIT so I can just borrow it. However I would like to actually use you as a dependency and not vendorized :-)

ctrlcctrlv commented 4 years ago

This has been fixed and Qglif is now using your awesome library and not my hack vendorized version 🙌

jazzfool commented 4 years ago

Closing: Skia is holding up well.