Drawing Graphics Objects

Last modified by Microchip on 2023/11/10 11:03

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

The function GFX_GOL_ObjectListDraw draws graphics objects to the frame buffer. The function 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 in 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.

Back to top

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.

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.

Back to top

Example: Applying the Style Scheme Using the State Bits

Blank Buttons

Button Style Scheme

Unpressed Buttons

Buttons Pressed

Disabled Buttons

Hidden Buttons

Back to top

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" page.

Learn More

Back to top