After a very prolonged development cycle we finally have a new alpha release of WonderGUI! This time we have a multitude of improvements, so let’s dive straight into them.

Cheers

(Image by Free-Photos from Pixabay)

Major graphics system update

Alpha5 has received a major upgrade to the graphics system. Large parts have been redesigned from scratch and all known outstanding issues have been addressed. This has taken a fair amount of time and effort, but has resulted in the following improvements:

Vastly improved OpenGL performance

GlGfxDevice has been redesigned from scratch and now manages GL states and commands much more efficiently. States are only set when necessary and similar drawing commands are queued and executed together. Although I haven’t done any benchmarking I expect there to be at least a 10x performance increase under normal use cases.

Improved software rendering performance

SoftGfxDevice too has been redesigned from scratch to improve performance and add features. Through some clever use of templates and compiler optimisations we now have hundreds of optimized innerloops for all commmon rendering operations. The whole pipeline has also been streamlined to avoid calculations when not needed.

Pixel-perfect OpenGL/Software match

The output from OpenGL and software rendering has now been tweaked to be identical.

Some really minor color differences may appear in blending due to differences in precision, but these are usually not visible to the naked eye, even in a direct comparison.

Support for more pixel formats

In addition to 24- and 32-bit RGB surfaces, WonderGUI can now copy from 16-bit RGB, 16-bit RGBA, 8-bit alpha and 8-bit indexed surfaces. 16-bit surfaces can also be used as canvas. These formats might seem redundant for modern PCs, but can be very useful when working with small embedded systems or UIs that includes large animated widgets.

Rotation and flipping

In addition to stretch, we can now also rotate and flip graphics blocks. Flips and rotations in 90 degree increments can be done with none or minor performance impact in both OpenGL and software rendering, while stretch and free rotation is heavy for software rendering, but almost free for OpenGL.

Even segments (previously called waves) can now be flipped and rotated in 90 degree increments.

Improved API and subclassing

There have been many improvements to the GfxDevice API, which now is more consistent and lean than before. Even subclassing GfxDevice requires less work than before since fewer methods needs to be implemented. This will make it faster to develop future devices for DirectX, Vulkan and Metal.

Drag-n-Drop

This feature has been long overdue, but WonderGUI finally has solid support for Drag-n-drop, making it way easier to implement in your product.

It was designed with great care to make it both easy to add basic drag-n-drop functionality and accomodate more specific needs. My own initial use makes me believe that I reached a good balance between simplicity and flexibility.

Popups

The popup support has received a major overhaul and should now be fully usable.

WonderGUIs way of handling menus and other popups is quite unique in that there is no need for any special menu widget or menu entry class. Everything is done using whatever widgets you prefer and a few extra calls.

Skins

A new MultiBlockSkin has been added, which allows you to tint and blend several images into one skin.

ColorSkin has been extended to support padding and per-state-colors like BoxSkin. The old, limited ColorSkin is still available as StaticColorSkin.

New create methods utilizing initializer lists have been added for all skins to allow you to define multiple states in one go.

However, the most important update to skins is probably that you no longer need to define every combined state in use. I.e. if a widget enters state SelectedPressedFocused but the appearance for that state isn’t provided by the skin, the closest match will be used according to a specific formula that is better described in a separate post.

Graphics Streaming

In what might seem like a flashback to X-Windows on old UNIX systems, WonderGUI can now pack its drawing commands into a stream that is unpacked and replayed somewhere else with a minimum of bandwidth overhead.

This is where the similarities end though, there has been no compromise to the graphics systems design to facilitate this and there is no cost in overhead (neither CPU nor memory) when not in use. It is all implemented using a special StreamGfxDevice for output and connecting a set of classes dealing with buffering, piping and playing of graphics streams.

Although most of you will have no use of this, it can be very useful in certain scenarios involving embedded devices.

Renaming of items and interfaces for consistency

WonderGUI 3 uses composition of simple, reusable components to create complex widgets. For example is the same Text component shared by TextDisplay and Button.

These components have earlier been called Items, but are now more apropriately referred to as Components.

All Components now start with a capital C and the public interfaces to them (exposed by the widgets) start with a capital I. This allows them to use the most appropriate names without clashing with each other or Widgets. So now we have a TextEditor widget with an embedded CTextEditor component which is exposed through an ITextEditor interface. Don’t worry if it seems complex, it isn’t when you just use the widget :)

New Widgets

Although most widgets have received improvements and bugfixes during the alpha5 development cycle, only one new Widget has been added: Canvas.

The Canvas widget simply provides a bitmap surface on which you can draw using a GfxDevice. Nothing especially fancy, but a very useful widget to have.

General API improvements

There have been many small improvements to the API. Some especially worth mentioning:

  • You no longer need to release a widget from its parent before you can add it to another. It is now automatically released. Also, you can now use the new method releaseFromParent() instead of going through the parent when you do need to release a widget.

  • Multiple widgets can now be added to a continer in one go using the « operator and intializer lists. This can actually make your code much more readable.

  • Most methods of container-widgets now supports ranges when manipulating their children. You can for example hide or remove a whole range of children with one call, which is way more clean and efficient than addressing them one by one.

So what’s next?

Not sure yet. I have many improvements I want to tackle and circumstances will probably decide which I address first.

To make WonderGUI useful to more people I will need to add some missing widgets and vastly improve the documentation. However, I’m keen on making some framework improvements first (HiDPI support being at the top of my list) since they are easier to make the less widgets I have to modify.

Anyway, you can expect a much higher release rate from now on.