Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

1.4.1.2 Object Layer Rendering
This section describes how objects are rendered.
Description
Object List Rendering
Initially, application will create the objects that it will use by calling the create function of the objects. As the objects are
created, a linked list of objects is created. This linked list of objects is the list that the library will use to manage the rendering
of the objects. The application will only need to call GFX_GOL_ObjectListDraw() function to execute the rendering of all the
objects. It is also through this list that the library is able to parse all the objects to determine if an object is affected by the
user action. This will be discussed in the messaging portion of this documentation.
Each object, has a state variable that is composed of state bits. There are two main groups in the state bits:
Property State Bits - this defines the general shape of the object.
Draw State Bits - this determines if the object will be redrawn. The redrawing can be a full object redraw or partial object
redraw. Depending on the object, definition, a partial redraw means that only portion of the object is redrawn. This makes
the redraw of the object fast and efficient. For example, redrawing the full progress bar object will be longer than just
updating the level of the progress bar.
The Property state bits are usually defined once at the object creation. The Draw state bits, on the other hand dynamically
changes and usually changes because of user action on the object. These user actions are encoded as messages. The
messages are created in user interface drivers such as touch screen or key pads on the system (see messaging section
for details).
The objects in the library implements the rendering sequence using rendering state machine. The rendering state is not to be
confused with the Draw State Bits of the objects. Rendering states are defined in each object's rendering function. An
object is basically drawn using combination of primitive calls. Bars, lines, and text can be drawn to represent an object.
The purpose of these rendering states is to divide the primitive calls into steps. By doing this, each primitive call is now a
step in the process. If one of the primitive call cannot proceed due to busy hardware resource, the object's rendering
sequence can be paused. Since, the length of the delay in the rendering cannot be predicted, it is best to pause the
rendering of the object and give back control of the CPU to application. Each of the object's rendering function coupled
with GFX_GOL_ObjectListDraw(), has this capability. This effectively pauses the rendering of the object.
For the rendering to continue, GFX_GOL_ObjectListDraw() is called again by the application. When this is called, the
specific object rendering function that was called is then resumed and in the object rendering function, the specific step
(or primitive call) is executed again. This basically continues the rendering exactly where it left off.
Object Draw Callback Feature
To allow application to control the rendering of the objects, a callback function is provided
(see GFX_GOL_DRAW_CALLBACK_FUNC). The callback function is an application implemented function. The library
provides the GFX_GOL_DrawCallbackSet(GFX_GOL_DRAW_CALLBACK_FUNC) API to set the callback function.
GFX_GOL_DRAW_CALLBACK_FUNC parameter in this function is the pointer to the defined callback.
The callback allows the application to insert application defined rendering.
For example: A digital signal is sampled on a pin. The value of the signal determines if a scroll bar will increment or
decrement its value. To implement the change in the value of a scroll bar, a callback function can be implemented to do
that.
//*********************************************************************
// Main
//*********************************************************************
int main(void)
{
// GOL message structure
GFX_GOL_MESSAGE msg;
//Initialize board, drivers and graphics library
SYSTEM_InitializeBoard();
GFX_Initialize();
// set the message callback function pointer
GFX_GOL_MessageCallbackSet(APP_ObjectMessageCallback);
// set the draw callback function pointer
GFX_GOL_DrawCallbackSet(APP_ObjectDrawCallback);
1.4 Using The Library MLA - Graphics Library Help Library Overview
46

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh