Drawing Graphics Objects

This page contains information for the Graphics Library found in Microchip Libraries for Applications (MLA). It is not relevant for the MPLAB® Harmony Graphics Library.

The function GFX_GOL_ObjectListDraw is the function which draws graphics objects to the frame buffer. GFX_GOL_ObjectListDraw goes through the active display list looking for a true condition in either the "Draw" or "Update" state bit. If an object is designated to be drawn (or re-drawn) GFX_GOL_ObjectListDraw applies the appropriate elements from the style scheme to the object as it is being written to the frame buffer.

When an object has been rendered to the frame-buffer the DRAW (and UPDATE) state bit will be reset to FALSE. This ensures the MCU will only update the frame buffer one time as directed by the application.

Calling the Drawing Function

GFX_GOL_ObjectListDraw is typically called within the main loop of a program.


GFX_GOL_ObjectListDraw is written to share the CPU resources with the user application. As a result of this cooperative multitasking implementation GFX_GOL_ObjectListDraw may need to be called several times before all the elements in the display list are processed. When GFX_GOL_ObjectListDraw completes processing the display list a TRUE condition is returned. If GFX_GOL_ObjectListDraw has not finished processing the display list a FALSE condition is returned.

The Safe Zone

Updating the display list while it is being processed by GFX_GOL_ObjectListDraw can cause some anomalies in the image being displayed. To avoid these display problems it is highly recommended the application only modify the display list when GFX_GOL_ObjectListDraw is not in the middle of processing the list. The only time during the application loop when you can be sure the list is not being processed is when GFX_GOL_ObjectListDraw returns with a TRUE condition.

When executing within the safe zone the application may alter the state bit(s) of any object. Altering the 'Draw' state bit will cause GFX_GOL_ObjectListDraw to redraw the object to the frame buffer. When the program decides an event has occurred, such as a button being touched or a slider being moved, the state-bit associated with that condition should also be altered. Setting only the DRAW or UPDATE state bit will not change the object being displayed on the screen.

— AND —

When an object's state is being altered in order to have the change be drawn to the screen the DRAW or UPDATE state bit must also be set. Without the DRAW or UPDATE bit being set, no changes will be made to the display.

Example: Applying the Style Scheme using the State bits







A description of the functions used to identify and modify the object state bits can be found on the Changing the State of Graphics Objects section of the Developer's Help.

© 2017 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.