Open fatteneder opened 2 years ago
Regarding #5: Can cached images be arbitrarily scaled to achieve this?
Can cached images be arbitrarily scaled to achieve this?
Kind of? You'd have to keep aspect ratios the same.
Another thing you can do is insert a Box(..., visible = false)
as a spacer between the title and the rest of the slide.
Perhaps the title is misleading. I want to keep all proportionalities of all slide elements constant when resizing a window. E.g. if you save your presentation as a PDF and then open it in an external viewer, then the layout of the slides also remains constant when resizing the viewer window. This behavior I want to have for the presenter mode. I wonder if there is a term for this behavior, but I cannot find one right now ...
Another thing you can do is insert a Box(..., visible = false) as a spacer between the title and the rest of the slide.
Not sure if that could help with this, since you will have to scale font sizes and etc separately then.
Perhaps images is the simplest way to do it in a consistent manner, especially if the only thing to do is:
You'd have to keep aspect ratios the same.
I think what you want here is something like CairoMakie's [px/pt]_per_unit
, i.e., device scaling. My understanding is that this does not exist in GLMakie, since it is tightly integrated with the device's pixel space (as opposed to CairoMakie which has more abstraction).
As such, your best bet at this stage is probably to just do images (perhaps using CairoMakie to upscale) and rendering using colorbuffer
or similar if you want to upscale.
There is technically another alternative if you are OK with using only CairoMakie, but it would require some Gtk knowledge. CairoMakie can render to a Gtk window, but there is no configuration for updates or other things. If you can get a "renderloop" going to a Gtk window, and perhaps hook up interactivity, then it would not be hard to get this kind of arbitrary resizing done. Basically, I think you would need to find some way of getting mouse position as an Observable, and hooking up updates/resizing/other things.
I think I will give the image approach a try first. Although, I get the idea I am not so sure how to render a slide to image and then display it with CairoMakie efficiently. E.g. I know how to save and load images, but this does not seem right.
@ffreyer also said something about rendering to Matrix{RGBAf}
which sounds more promising. Could you please provide a MWE or point me to some resources (I couldn't find much in the Makie Docs)?
Regarding Gtk: I don't know much about it but I would be interested in learning it. I did find Gtk.jl
and GtkObservables.jl
and they seem to provide already lots of tools. I also found a MWE to connect mouse events with Observables
in the GtkObservables.jl
docs: https://juliagizmos.github.io/GtkObservables.jl/stable/drawing/. Perhaps that is already all we need?
It appears that the Gtk solution could be its own package, something like GtkPresenter.jl
, that could read in and display the buffered slides from MakieSlides
?
EDIT: Add link.
My thought was using GLMakie.colorbuffer
which is an internal function afaik, so there probably isn't any documentation. https://github.com/JuliaPlots/Makie.jl/blob/66cd4eee6d4cd22297e92ed92ee4b77dfde066fb/GLMakie/src/screen.jl#L215
Should work with GLMakie.colorbuffer(fig.scene.current_screens[1])
Colorbuffer is a Makie function, so should work with whichever screen you send it - Cairo, GL or even WGL.
It's technically part of the backend spec and returns a Matrix of RGB (can also be RGBA in CairoMakie).
The goal is to decouple the slide's appearance from the window size.
Current behavior
small window
big window