Jump to content

µGFX Development

  • entries
  • comments
  • views

Contributors to this blog

About this blog

Entries in this blog

Joel Bodenmann

The µGFX project has grown steadily over the past five and a half years. It has become much bigger than what I ever expected back when I started it as a hobby project. Until now, the µGFX project was part of my company named Bodenmann Electronics. Today we made a huge step forward by creating a dedicated company named uGFX GmbH. The German abbreviation GmbH means Limited Liability Company or short: LLC.
Our headquarter is still in Switzerland but we have now a branch office in Australia to further expand and to provide support more efficiently.

Also, our Graphics & User-Interface designer @thoeby will act as a social media engineer. You should expect a lot more content in the future targeted towards extending this awesome community. To get started, here's a way to win either a free STM32F7-Discovery board or an Arduino with an LCD-Shield: Simply like our Facebook page and the corresponding post to participate: https://www.facebook.com/ugfx.io

Joel Bodenmann

Certain configuration parameters that affected the rendering performance & resource usage when rendering images have now been exposed to the configuration file. This allows changing the performance of the image rendering depending on how many resources (mainly memory) the target hardware has to offer. The following configuration options are now available:


The default values have not been changed. Therefore, simply not touching these values will not change the behavior of the system when upgrading.

Joel Bodenmann

Release µGFX v2.7

The µGFX library version 2.7 has been released just a couple of moments ago and is now available for download in the download section.

Let's have a look at the change log:

FEATURE:    Added EXC7200 driver
FEATURE:    Added STM32F439i-EVAL board files
FIX:        Fixed crash when passing NULL to gwinSetStyle()
FIX:        Fixed potential crash when GDISP_NEED_TEXT_WORDWRAP is turned on
FEATURE:    Added SDL driver
FEATURE:    Added ILI9225 driver
FEATURE:    Added ST7735 driver
FEATURE:    Added Linux event input driver
FIX:        Fixed an issue with color formats in Linux-Framebuffer board files
FIX:        Fixed and improving arc rendering functions
FIX:        Preventing possible crash when no valid GWIN default font has been set
FIX:        Updating Windows binaries of the font encoder to improve compatibility
FIX:        Fixed progressbar bounds checking and decrementing
FEATURE:    Added gdispFillDualCircle()
FIX:        Fixed an issue in the filled polygon drawing function which caused irregularities
FEATURE:    Added high-level functions to modify image color palettes
FIX:        Improving gdispDrawThickLine()
FEATURE:    Added gdispAddFont() for adding a dynamic font to the permanent font list
FEATURE:    Added gmiscHittestPoly() for checking whether a point is inside of a polygon
FIX:        Fixed strange multi-thread issues in GEVENT
FEATURE:    Added ILI9488 driver
FEATURE:    Added the ability to display the detected compiler
FIX:        Fixed an illegal instruction in the Cortex M0 task switcher
FEATURE:    Added RAW32 task switching functions which work with ARMCC (the compiler used by Keil) for Cortex M0,M1,M3,M4 and M7
FEATURE:    Added gdispGDrawThickArc()
FIX:        Fixed a memory merging issue with the RAW32 memory allocator
FIX:        Update RAW32 libc threads support for more recent versions of the MinGW compiler

Upgrading & Compatibility
This new version of the µGFX library is fully compatible with any previous 2.x release. Upgrading is quite easy as you just have to replace your current version of the library with the new one.

New drivers & board support
This release contains support for many new drivers and some boards. We have reserved ourselves a chunk of time during the upcoming month of January where we will create a set of easy to use, pre-configured read-to-run projects for different combinations of boards, underlying systems and IDEs. We feel like we have let that slip by in the past. Being able to just download & run appears to be every important to many community members so we'll try to improve that. Of course any help is highly welcomed here.

Various fixes
Various fixes are part of this new release. While some of these only fix cosmetic issues (eg. off-by-one pixel), others are quite vital to prevent crashes and unexpected behavior of the application. Therefore, we strongly recommend everybody to upgrade to this new version.

Closing statement
We'd like to thank the entire community for making this possible. It wouldn't be possible for us to provide this software in this form without your continuous contributions, donations, feedback and more. Having a community like the one we have is something we know to value.
Please don't hesitate to leave your comments below and opening a forum topic if you have any questions regarding the new release.

Joel Bodenmann

The RAW32 port which allows running µGFX on a baremetal platform was known to cause issues when using the ARMCC compiler (the compiler used by Keil µVision). These issues have finally been resolved. The RAW32 port now runs fine & efficient without any further dependencies with ARMCC on Cortext-M0, M1, M3, M4, M4F, M7 and M7F processors.

Joel Bodenmann

A new function has been added to the GDISP module that allows drawing thick arcs: gdispGDrawThickArc().

 * @brief   Draw a thick arc.
 * @pre     GDISP_NEED_ARC must be TRUE in your gfxconf.h
 * @param[in] g             The display to use
 * @param[in] xc,yc         The center point
 * @param[in] startradius   The inner radius of the thick arc
 * @param[in] endradius     The outer radius of the thick arc
 * @param[in] startangle    The start angle (0 to 360)
 * @param[in] endangle      The end angle (0 to 360)
 * @param[in] color         The color of the arc
 * @note        This routine requires trig support. It can either come from your C runtime library
 *              cos() and sin() which requires floating point support (and is slow), or you can define GFX_USE_GMISC
 *              and either GMISC_NEED_FIXEDTRIG or GMISC_NEED_FASTTRIG.
 *              GMISC_NEED_FASTTRIG uses table based floating point trig operations.
 *              GMISC_NEED_FIXEDTRIG uses fixed point integer trig operations.
 *              Note accuracy on both the table based options are more than adequate for the one degree
 *              resolution provided by these arc routines. Both are much faster than your C runtime library.
 * @api
void gdispGDrawThickArc(GDisplay *g, coord_t xc, coord_t yc, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle, color_t color);
#define gdispDrawThickArc(x,y,rs,re,s,e,c)  gdispGDrawThickArc(GDISP,x,y,rs,re,s,e,c)


Joel Bodenmann

A new function has been added to the GMISC module which allows testing whether a certain point is inside of a given polgyon:

 * @brief	Check whether a point is inside or on the edge of a polygon
 * @note	This function works both with convex and concave polygons
 * @param[in] pntarray		The array of points that form the polygon
 * @param[in] cnt		The number of points in the point array @pntarray
 * @param[in] p			The point to test
 * @return	@p TRUE if the point @p p is inside or on the edge of the polygon @p pntarray, @p FALSE otherwise.
 * @api
bool_t gmiscHittestPoly(const point *pntarray, unsigned cnt, const point *p);


Joel Bodenmann

We added a new function named gdispAddFont() to the GDISP module. This new function allows adding new fonts to the internal font list during runtime. This allows loading fonts from external mass storage devices such as external FLASH chips or an SD-Card.

 * @brief   Add a font permanently to the font list.
 * @returns TRUE on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM.
 * @pre     GDISP_NEED_TEXT must be TRUE in your gfxconf.h
 * @param[in] font      The font to add to the font list.
 * @api
bool_t gdispAddFont(font_t font);


Joel Bodenmann

Certain image formats such as GIF, PNG and some of the BMP formats use color palettes. We added new high-level API functions to access and modify those color palettes:

uint16_t   gdispImageGetPaletteSize(gdispImage *img);
color_t    gdispImageGetPalette(gdispImage *img, uint16_t index);
bool_t     gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor);

These new functions allow to modify the color palettes dynamically during run time. This can be very handy, especially for things like icons. Colors can now be exchanged dynamically which allows having an image (icon) only once in memory but displaying it with different colors (eg. for different application themes).
The following screenshot shows how the same image can be drawn multiple times with different colors:


This demo is available as a ready-to-run demo under /demos/modules/gdisp/images_palettes.

Currently we only implemented support for these new high-level functions in the BMP image format. We'll add support for GIF and PNG in the following days/weeks.

Joel Bodenmann

Our new community member @Corentin Barman fixed a bug in the gdispGFillConvexPoly() function. That bug has been around for quite some time and caused issues many times. The symptoms of the bug were "off by one" errors that lead to irregularities in symmetrical shapes and other issues. More information can be found in the corresponding pull request.

The bug has been fixed as part of the bug report from @Aivars Plume


Joel Bodenmann

We added a new rendering function to the GDISP module that's named gdispGFillDualCircle(). That new function allows rendering two filled, concentric circles. The result is the same as rendering a circle with a larger radius in one color and then rendering a circle with a different color and a smaller radius at the same center. However, this new, optimized function only takes one pass to render the entire dual circle and therefore is not only a lot faster but also prevents any flickering due to overwriting a large area with a different color.

The new setting GDISP_NEED_DUALCIRCLE needs to be set to TRUE in order to be able to use this new function.

     * @brief   Draw two filled circles with the same centre.
     * @pre     GDISP_NEED_DUALCIRCLE must be TRUE in your gfxconf.h
     * @param[in] g         The display to use
     * @param[in] x,y       The center of the circle
     * @param[in] radius1   The radius of the larger circle
     * @param[in] color1    The color to use for the larger circle
     * @param[in] radius2   The radius of the smaller circle
     * @param[in] color2    The color to use for the smaller circle
     * @api
    void gdispGFillDualCircle(GDisplay *g, coord_t x, coord_t y, coord_t radius1, color_t color1, coord_t radius2, color_t color2);
    #define gdispFillDualCircle(x,y,r1,c1,r2,c2)              gdispGFillDualCircle(GDISP,x,y,r1,c1,r2,c2)



The uGFX arc filling routine is a complex operation with lots of edge cases. It is (as far as we can tell) the only arc filling algorithm on the internet for which source code is published. This routine is one that we created from scratch specifically for uGFX (wait for an upcoming wiki article on how it works).

The bugs fixed are:
1. Certain small angles would fill the entire circle. For example, a filled arc from 88o to 89o would exhibit this problem.
2. Certain angles would draw a spurious horizontal line. For example, a filled arc from 271o to 275o would exhibit this problem.

Other Improvements:
Integer rounding improvements were made to provide greater accuracy on small displays or with arcs with small radii. These improvements have also been added to the arc drawing routine.

There is also a small change in behaviour to arc filling. If you fill from 30 degrees to 30 degrees it would previously fill the entire circle. It now draws a line at the 30 degree angle.

Joel Bodenmann

µGFX applications can run as native Linux applications through either the bare Linux framebuffer or the SDL drivers. We created a step-by-step tutorial showing how to compile & run a µGFX application on an embedded Linux device. The guide is available here: https://wiki.ugfx.io/index.php/Raspberry_Pi

A complete project for the Raspberry Pi 3 can be downloaded from the downloads section. We used the official Raspberry Pi Foundation 7" touchscreen in our tests but the example project works with any kind of video output device (eg. a regular HDMI monitor).

stand_backside.jpg   thumbnail_web.jpg   minesweeper_web.jpg   gwin_lists_web.jpg   gdisp_basics_web.jpg

Joel Bodenmann

We added a driver to the repository to use touchscreens/mice through the Linux event system (eg. /dev/input/event0). Along with the driver we provide the corresponding new board files named Linux-Framebuffer-Touch to use touchscreens with embedded Linux systems that run µGFX applications through direct framebuffer access. Using these new board files, any embedded Linux system with a working touchscreen or mouse can be used to run full µGFX applications.

At this point we'd like to thank @Smd for contributing this driver a while ago and @lentinj for spending the time testing it before we got to it.

Documentation: https://wiki.ugfx.io/index.php/Linux#Touchscreen_.2F_Mouse
Repository commit: https://git.ugfx.io/uGFX/uGFX/commit/ac5e96cca18884727b165f4245e42887ef0e3a21

Joel Bodenmann

New driver: SDL

Our community member @olegator contributed a new driver that uses the SDL library (huge thanks at this point!).
This new driver is a replacement for the current X driver that allows running µGFX as native applications on Linux and OS X (or rather almost any Unix system). The old X driver had serious performance issues because it only relied on setPixel() to change each pixel. The new SDL driver VASTLY improves performance as the video below demonstrates. Furthermore, the new SDL driver also implements the GINPUT keyboard interface to use your computer keyboard as an input source to the µGFX application.
Other benefits of the new driver are that OS X users don't have to use XQuartz anymore to run µGFX application on their machines.

We updated the documentation for running µGFX on Linux and OS X to reflect these changes.

The following video compares the rendering speed of the old X driver to the new SDL driver. Note that the video has been recorded with only 15 frames per seconds. It's actually even smoother in real life. Also, no vertical synchronization, double buffering or similar techniques have been used to improve the quality (hence the horrible tearing effects at the end).


Joel Bodenmann

Running a project like µGFX requires a lot more than just writing C code and a bit of documentation. We need a proper forum, wiki, git repository, domains, web servers and so on. As the project is growing we had to update our infrastructure. Besides moving to a more powerful server, we also made the following changes:

We registered the domain ugfx.io. All services have been permanently moved from *.ugfx.org to *.ugfx.io. Old links are still working as all requests to the old .org domain are being forwarded to the new .io one.

Git Server
Until now, the official repository was hosted at BitBucket under my private account. However, as the project grows we also have numerous other repositories which are not public but shared between the µGFX developers. In order to move away from the repository being hosted on a private account and in order to simplify repository management inside the µGFX organization we decided to host our own git server. The new server is available at https://git.ugfx.io. The official µGFX repository can be found here: https://git.ugfx.io/ugfx/ugfx.git
The old repository will be closed soon, new pull requests will only be accepted through the new git server. Please ensure that you update your own repositories in case of you are using the µGFX repository as a Git submodule.
We kindly ask the people who have public forks of the old repository hosted at BitBucket to either remove them or make them private.

Almost all web services are now SSL encrypted.

Joel Bodenmann

A fix for the GWIN module has been pushed to the repository that prevents a crash: When the function gwinSetStyle() is called with a null-pointer instead of a pointer to a valid widget style the widget is supposed to fall back to the GWIN default style. However, there was a bug that caused a crash/hardfault instead. This bug has been fixed by this commit: https://git.ugfx.io/uGFX/uGFX/commit/0c695b2471c347847e579aa19ada5612341bfc2d