UltraCanvas:支援 Windows、Linux、macOS 及瀏覽器的 C++20 圖形使用者介面框架
UltraCanvas: a C++20 GUI framework for Windows, Linux, macOS and the browser
UltraCanvas 是採用 C++20、以 CMake 建置並採 MIT 授權的圖形使用者介面框架,以同一套 API 支援 Windows、Linux、macOS,並可編譯為在瀏覽器運行的 WebAssembly 版本。
Every couple of years another C++ GUI framework turns up claiming one API for every desktop platform. Usually it turns out to be a thin wrapper over one native toolkit, and the other platforms are an afterthought.
UltraCanvas is a newer one, and it looks further along than that. I spent the last few weeks running its builds on an ordinary Windows laptop and a Linux install, and this is what I found.
The short version: a C++20 framework, CMake-based and MIT-licensed, with one API for windowing, rendering, input and events across Windows, Linux and macOS, plus a WebAssembly build you can open in a browser tab with nothing to install.
Disclosure
I work with the ULTRA OS team on developer outreach, and UltraCanvas is the graphics layer of that project.
Everything below comes from builds I ran myself, on a Windows laptop and a Linux install, or from facts I asked the maintainer to confirm. Where a number is his measurement rather than mine, I say so.
What it is
UltraCanvas gives you one API for windows, rendering, input and events, and keeps the platform-specific code strictly separate underneath:
- Linux: X11 and Cairo
- Windows: Win32 and Direct2D
- macOS: Cocoa and Core Graphics
- WASM: the same API compiled for the browser
Text rendering runs on FreeType, Pango and HarfBuzz. Image work goes through libvips. The repo structure makes the promise checkable: a public include set, a platform-independent core, and one folder per OS. If the abstraction holds, those folders should be the only code that knows what an operating system is. From what I could see in the tree, that is how it is laid out.
The component count surprised me for a project this young. Around fifty, including split buttons, tree views, tabbed containers, toasts, color and date pickers, segmented controls, and Box/Grid/Flex layouts. There is a chart engine (line, bar, area, scatter, candlesticks, waterfall, Sankey), full Unicode text with styled rendering, and a plugin system for formats and renderers.
Try it in a tab before you build anything
If you read nothing else here, open this:
https://ultraos.eu/wasm/UltraCanvasDemo.html
That is the demo app compiled to WebAssembly. The first load pulls about 50 MB, which is the whole API plus a sample app in one payload rather than a trimmed hello world. For comparison, that is roughly what one Electron app ships just to say hello. On a fast connection it takes a few seconds. On mobile, wait it out once and it caches.
What you get is a component browser where every entry carries a status marker: what works, what is partial, what is planned.
The modules behind it
UltraCanvas is one of ten public repositories that together form a small platform:
- FileLoader: load, save and convert across bitmap, vector, 3D, text, audio and movie formats. An app built on it stops caring what format the user shows up with.
- UltraNet: one surface for HTTP/S, WebSocket, FTP/SFTP, TCP/UDP, TLS and DNS, with plugins for the rest (SMTP, IMAP, MQTT, SSH, LDAP, RTSP, gRPC).
- UltraAI: a single C++ surface for chat, vision, speech, generation and translation, with interchangeable providers: cloud, local models, or in-process mocks.
- PixelFX: bitmap manipulation built on libvips and ImageMagick behind a C++20 API.
- IODeviceManager: scanners, cameras, GPIO and other hardware behind one abstraction layer.
The idea is the same in each case. An app written against these modules stays portable, so the layers underneath can be swapped without app code noticing. That includes a future ULTRA OS running below everything.
What already runs on it
The repositories include a stack of applications built on the framework. I ran most of them. What stood out:
- UltraFiler: the file manager, and the best demonstration of the stack. It previews SVG artwork properly, where Explorer shows a generic icon. Image metadata is shown inline. You can pin favorite folders. It speaks FTP and SFTP, and the format list in its settings is longer than any file manager I have used. The maintainer measures ZIP extraction at roughly four to five times Windows Explorer's speed on his machine, which I could not reproduce on my own hardware.
- Texter: an editor with syntax highlighting and a Markdown preview that kept up with everything I threw at it. Of the lot, this one felt the most finished.
- UltraViewer: opens images, video, audio, PDF, Word and Excel documents, and exports between them. Load an SVG, save it as a JPG at whatever size you set.
- UltraMail: a mail client with some nice touches, including favicons per sender and a copy button for login codes. Planned to stay free as the entry point to the ecosystem.
- CoderBox: an IDE built on the same framework, in testing.
- Also UltraPaint, ArtCreator, ChatCube, UltraAI, UltraCleaner, UltraAuthenticator, UltraNetMonitor, UltraClipboard, and a demo app that previews every ULTRA OS module in one place.
Two details for the C++ crowd.
There is a native DWG decoder in-tree, covering AutoCAD drawings R13 through R2018 and the whole drawing family (.dwg, .dwt, .dws, .bak), with no external CAD engine. Writing DWG files goes through GNU LibreDWG's converter instead.
The plugin system covers CDR via librevenge, XAR, and PDF via poppler, plus PNG, JPG, BMP, GIF, AVIF, WebP and QOI on the bitmap side.
Where things stand
The framework is further along than the apps. That is the layering rather than an excuse, and the project is unusually willing to show it: the component browser marks every component's status, and nothing pretends to be finished before it is.
A few notes from testing:
- Some apps are done (Texter, UltraFiler). Others are early and it shows (UltraPaint and ArtCreator are still in testing).
- UltraMail needs an OAuth client for full Gmail sign-in, though an app password works today. UltraAI's translation and generation features are waiting on provider keys.
- On Windows, the maintainer recommends Windows 11 for now. Some apps still have rough edges on Windows 10.
- There are no published framework-wide benchmarks, and I would distrust any for a project this young.
- Fixes move fast. Favicons and a login-code copy button in UltraMail, and pinned folders in UltraFiler, all landed in new builds within days of my asking.
- Nothing is on sale yet. Product plans exist (a free tier, paid apps, an OS) but are not final, and the payment side is still being set up.
What's next
The maintainer is finishing UltraDesktop, the desktop environment itself, this month. The plan is free on Linux and paid on macOS and Windows. Further out: a Vulkan backend, Wayland support, 3D model loading and smart-home drivers, then the OS in two phases, a Linux-based desktop first and a custom kernel later. It is self-funded.
None of that matters if you just want a GUI toolkit to evaluate. The quickest way to judge UltraCanvas is the browser demo: one tab, about 50 MB, and you are clicking through the same components I was testing on a desktop.
Links
- Demo (WASM): https://ultraos.eu/wasm/UltraCanvasDemo.html
- Source: https://github.com/ULTRA-OS-Project/UltraCanvas
- All repositories: https://github.com/ULTRA-OS-Project
- Project site: https://ultraos.eu
MIT-licensed, early, and still moving. Bug reports are getting acted on within days.
來源:DEV Community · dev.to