AcDraw Function

Microchip Graphics Library

Microchip Graphics Library
AcDraw Function
C
WORD AcDraw(
    void * pAc
);
Overview

This function renders the object on the screen using the current parameter settings. Location of the object is determined by the left, top, right and bottom parameters. The colors used are dependent on the state of the object. The font used is determined by the style scheme set.

Input Parameters
Input Parameters 
Description 
void * pAc 
Pointer to the object to be rendered. 
Returns

Returns the status of the drawing

  • 1 - If the rendering was completed and
  • 0 - If the rendering is not yet finished.
Next call to the function will resume the rendering on the pending drawing state.

Preconditions

Object must be created before this function is called.

Side Effects

none

Example
void MyGOLDraw(){
    static OBJ_HEADER *pCurrentObj = NULL;
    int done;
    
    // There are no objects
    if(GOLGetList() == NULL)
        return;

    // If it's last object jump to head
    if(pCurrentObj == NULL)
        pCurrentObj = GOLGetList();

    done = 0;

    // this only process Button and Window
    while(pCurrentObj != NULL){
        // check if object state indicates redrawing
        if(pCurrentObj->state&0xFC00) {
            switch(pCurrentObj->type){
                case OBJ_ANALOGCLOCK:
                    done = AcDraw((ANALOGCLOCK*)pCurrentObj);
                    break;
                case OBJ_WINDOW:
                    done = WndDraw((WINDOW*)pCurrentObj);
                    break;
                default: 
                    done = 1;
                    break;
            }
            if(done){
                // reset only the state if drawing was finished
                pCurrentObj->state = 0;
            }else{
                // done processing the list
                return;
            }
        }
        // go to next object
        pCurrentObj = pCurrentObj->pNxtObj;
    }
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved