I want to take a screenshot. In Windows, that’s a simple Graphics::CopyFromScreen call.
In Linux, I feel a little confused on how to do this. It seems there is a principal and stark distinction between X11 and Wayland, so I have to include both code paths. For either, it seems there is quite a lot of boilerplate code, often tagged as ‘may break depending on your configuration, good luck’.
Effectively, what I found is recommended most often is to call ffmpeg to let it handle that. I’m sure that works, but I find it rather unpalatable.
I find this strange. Taking a screenshot is, in my mind at least, supposed to be a straightforward part of a standard library. Perhaps it is, and I just completely missed it? If not, is there a good library that works out-of-the-box on most variants of linux?
Update: Thank you all for the input. I eventually went with calling ImageMagick. It is fast, easy to use, well documented, and supports capturing arbitrary displays with little effort.
It seems this function is missing in MAUI on linux yet :/
To be fair, I think there are almost more GUI frameworks specifically for dotnet on Windows, each of which has been “the standard that everyone should follow” for a year or two, than there are DEs for linux. It’s ridiculous how often Microsoft changes their mind.
I’m just glad they still support Windows Forms through all of that. Which is kinda insane through all that. Microsoft holding long term support and maintenance very high.
There’s some connecting matter between the technologies as well. Like the XML representation between WPF and MAUI and whatever else there is. Or Razor between ASP.NET MVC, pages, and Blazor. WinUI and Uno plattform are part of MAUI I think? It ends up very confusing, and yes it’s numerous technologies. But there are some cross-sections at least.
I’m familiar with Windows Forms, WPF, and Blazor. I disliked the XML UI representation. I’ve always wanted to look into/prototype the code-style declaration of UI in code rather than XML.
GUI frameworks are always a hassle. Maybe the number of frameworks and diversity is proof that there is inherent complexity that’s hard to solve well.
Creating MAUI UI’s in C#