Object Rendering

Microchip Graphics Library

Microchip Graphics Library
Object Rendering

The library can render objects in a Blocking or a Non-Blocking manner. The Non-Blocking configuration is implemented by the use of drawing state machine. Each drawing functions groups the rendering steps into states. Every time a rendering step is executed, the drawing state is updated. Before each step is executed, the display device is checked if it is still busy with the previous rendering operation. If it is busy it returns a non-zero value. This indicates that the draw function must be called again to complete the rendering. The drawing function can be called several times until rendering is completed.

 

State Machine Controlled Rendering

For Blocking configuration linear flow of rendering is executed. Display device always return a non-busy status. 

The GOL level uses the active object linked list for drawing of objects. Each object’s state in the list is parsed to determine if the object needs to be redrawn or not. The drawing order is from the head to the tail of the list. This sequence is executed by GOLDraw() function. The figure below explains the rendering loop of the GOLDraw() function. 

 

 

GOL Object Rendering Loop

The loop shows two exit points in the sequence. First is when the end of the list is reached and the second is when an OBJDraw() returns a NOT DONE status. Reaching the end of the list is a normal exit. This means that all the state machines of the draw functions of each object have reset to default. Exiting with a NOT DONE status means that the latest executed draw function was pended and the object is not yet fully rendered. To complete the rendering, GOLDraw() function should be called again. The next call to GOLDraw() will pickup the rendering on the last object that returned a not DONE status. This operation makes the rendering functions non-blocking and gives opportunity to release control to program without waiting for the rendering completion. 

When all objects in the active object linked list are drawn GOLDraw() calls user defined GOLDrawCallback() function. User drawing can be done in this callback function. If the function returns a zero, drawing of GOL objects in the active list is suspended. In this case color, clipping region, line type and graphic cursor will not be modified by GOL. If it returns a 1 drawing control is returned to GOL. GOLDraw() resume rendering of objects in the current active list. Inside the GOLDrawCallback() function, the active object list is not used by GOLDraw(). It is safe to perform modification of the list. Please refer to Configuration Settings to set Blocking or Non-Blocking configuration.

Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved