You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is this library suitable to create a taskbar? #205
Long answer, pixels can render to whatever implements the RawWindowHandle trait from that crate. You could set that up to be a Wayland surface or the x11 equivalent. However, there are many aspects of pixels that make it a poor choice for this sort of thing. By default, pixels has some stuff to handle pixel-perfect scaling for you, which isn't desirable for a bar. By default, pixels provides practically nothing in the way of useful functionality for a bar. No layout tools, no icon rendering, no text rendering, nothing. Text rendering is especially a big deal - it's 90% of the bar's functionality, and you fundamentally won't get good text rendering with pixels. Pixels works by having you specify a logical window size you want to render to, and then scales that up. With HIDPI screens, or when making any sort of UI, this is a terrible choice. You don't want to render a tiny bar with small text and limited space for widgets and then scale it up - you want to render bigger to begin with to take advantage of smoother corner anti aliasing, smoother text rendering and less need to antialias it, more space to put widgets, etc. So for all these reasons, pixels is a terrible choice for writing a bar. I would look into using smithay's client toolkit (SCTK) for getting a wayland surface to draw to and very basic 2d rendering. For more advanced things like gradients, shadows, text, icons, you're going to need to find a general purpose 2d library like skia, or combine a couple of specialized crates probably.
pixels gives you a texture for direct pixel manipulation, so it's purpose is software rasterization. While it does work with some crates that implement software rasterization, like raqote, this crate is definitely not enough on its own to give you want you need.
Repository owner locked and limited conversation to collaborators on Sep 21, 2021
Activity
JMS55 commentedon Sep 20, 2021
Short answer, not at all.
Long answer, pixels can render to whatever implements the RawWindowHandle trait from that crate. You could set that up to be a Wayland surface or the x11 equivalent. However, there are many aspects of pixels that make it a poor choice for this sort of thing. By default, pixels has some stuff to handle pixel-perfect scaling for you, which isn't desirable for a bar. By default, pixels provides practically nothing in the way of useful functionality for a bar. No layout tools, no icon rendering, no text rendering, nothing. Text rendering is especially a big deal - it's 90% of the bar's functionality, and you fundamentally won't get good text rendering with pixels. Pixels works by having you specify a logical window size you want to render to, and then scales that up. With HIDPI screens, or when making any sort of UI, this is a terrible choice. You don't want to render a tiny bar with small text and limited space for widgets and then scale it up - you want to render bigger to begin with to take advantage of smoother corner anti aliasing, smoother text rendering and less need to antialias it, more space to put widgets, etc. So for all these reasons, pixels is a terrible choice for writing a bar. I would look into using smithay's client toolkit (SCTK) for getting a wayland surface to draw to and very basic 2d rendering. For more advanced things like gradients, shadows, text, icons, you're going to need to find a general purpose 2d library like skia, or combine a couple of specialized crates probably.
Joe23232 commentedon Sep 20, 2021
I see mate thanks :)
parasyte commentedon Sep 20, 2021
pixelsgives you a texture for direct pixel manipulation, so it's purpose is software rasterization. While it does work with some crates that implement software rasterization, likeraqote, this crate is definitely not enough on its own to give you want you need.