This is the actual µGFX library - the real deal!
The µGFX library is completely free, without any restrictions, for home, hobby & educational use. Please note that you have to purchase license in order to use µGFX in a commercial project or product. Note that these licenses are very affordable and can be purchased directly through our web store. You can find more information about commercial licenses and the available pricing options here: http://ugfx.org/pricing
You can also access the official Git repository if you like to use Git or make contributions via pull requests: https://git.ugfx.io/ugfx/ugfx
This is a minimal example implementation of a custom dial widget. The download contains a ready-to-run example project.
Please note that this implementation is far from perfect. This widget has not been designed to be perfect but to demonstrate how custom widgets can be created. Do not use this widget in a productive environment. This list mentions the most important limitations & optimization possibilities:
The widget expects that the supplied dial face image (last parameter of the dialCreate() function) has the same dimensions as the widget itself. The widget doesn't implement handlers for mouse, keyboard, toggle or dial input events. That means that it's currently a passive widget. Therefore, it could be implemented as a window rather than a widget to save a few more bytes of memory. The needle polygon gets "recalculated" each time the widget is being re-rendered. That is not necessary. This can be optimized so that the polygon is only calculated when creating the widget. The entire image is redrawn when the angle of the needle changes. This operation could be optimized by just clearing the area the old needle covered. However, that depends on the dial face graphic. In our example it would be possible to just draw the minimum rectangle that contains the old needle using the background color. That wouldn't be possible if the dial face image also has "content" below the needle. Hence this optimization is somewhat application specific. The example program uses a PNG encoded image for the dial face. That is anything but efficient on a low-power embedded platform. The current version of µGFX doesn't provide anti-aliasing for arbitrary shapes. Therefore, the needle will look quite "zaggy" in some positions. This effect can be minimized by making the widget and the needle larger. Theoretically it would be possible to use the existing slider or progressbar widget and implement the dial as a custom rendering routine. However, that would impose certain limitations when implementing handling of touch events. Fixed instead of floating matrix operations can be used in the drawing function to transform & rotate the needle polygon to improve resource requirements. Along with that, GMISC_NEED_FASTTRIG can be used to use lookup tables for the calculation of the rotation angle rather than using the clib implementations. For more information, please see here:
This download contains an example implementation of a statusbar. The statusbar has the following features:
File to display the system time Icon to show that a USB connection is present. Can be clicked if it's shown. Icon to show that an SD-Card is present. Can be clicked if it's shown. Icon to show a settings dialog. Note that this widget is very application specific. It should be modified as needed to fit the target application.
The download also contains a ready-to-run example project.
The project has not been optimized to use as little resources as possible. Please adjust the configuration to fit your needs!