Exemplo n.º 1
0
/***************************************************
* Function       : ErrorCreate
* Parameters     : none
* Return         : none
* Description    : Creates a Error screen 
***************************************************/
void ErrorCreate(GFX_XCHAR* string)
{
    // Blue Screen Error
	GFX_ColorSet(GFX_INDEX_0, 119);
    GFX_ScreenClear(GFX_INDEX_0);
    GFX_ColorSet(GFX_INDEX_0, -1);

    // Flash Error Message
    if(string == NULL)
        {GFX_TextStringDraw(GFX_INDEX_0, 0, 0, "Runtime Error.", 0);}
    else
        {GFX_TextStringDraw(GFX_INDEX_0, 0,0, string, 0);}
}
Exemplo n.º 2
0
/**
 * Show bar chart increaing by defined barValue array
 */
void Set_BarChart_Value(void)
{
    int16_t x0,y0,x1,y1;
    int i,j;
 
    EPD_power_init(USE_EPD_Type);

    GFX_ColorSet(BLACK);
    for(j=0;j<12;j++)
    {
        for(i=1;i<13;i++)
        {    
            if(j==0 || (barValue[j-1][i-1] !=barValue[j][i-1]))
            {      
                 x1=Bar_Origin_x+(i*(Bar_Width+Bar_Gap_Width));
                 y1=Bar_Origin_y;
                 x0=x1-Bar_Width;        
                 y0=Bar_Origin_y-(barValue[j][i-1]/2);            
                 GFX_BarDraw(x0,y0,x1,y1);
            }
        }
        if(GFX_GOL_ObjectListDraw()){
              DRV_EPD_UpdatePartial();
        }
    }
   
     EPD_power_end();

}
Exemplo n.º 3
0
void SpeedDemo(void)
{

uint16_t counter =0;
float       randl,randt,randr,randb,temp;

while(counter++ < 150)
{
	    // draw random bars in the middle of the screen
        GFX_ColorSet(rand()%65536);
 
        randl = rand()%GFX_MaxXGet();
        randr = rand()%GFX_MaxXGet();

        if(randl > randr)
        {
           temp = randl;
           randl = randr;
           randr = temp;
        }

        randt = rand()%GFX_MaxYGet();
        randb = rand()%GFX_MaxYGet();

        if(randt > randb)
        {
           temp = randt;
           randt = randb;
           randb = temp;
        }

         while(GFX_RectangleFillDraw(randl,randt,randr,randb) == GFX_STATUS_FAILURE);
}

}
Exemplo n.º 4
0
void APP_EPD_CreateHomeScreen(void)
{
    GFX_GOL_ObjectListFree();
    GFX_ColorSet(WHITE);
    GFX_ScreenClear();                          //clear screen of EPD

    Show_Logo();                                // layout logos
    Show_Button();                              // layout buttons

}
Exemplo n.º 5
0
/**
 * The Demo2 show function
 */
void Show_EPD_Demo2(void)
{

    GFX_GOL_ObjectListFree();
    GFX_ColorSet(WHITE);
    GFX_ScreenClear();
    Show_BG();
    if(GFX_GOL_ObjectListDraw())
        DRV_EPD_UpdateGlobal();
    Set_BarChart_Value();

}
Exemplo n.º 6
0
/***************************************************
* Function 	      :    GDD_SCREEN_PictureScreenCreate
* Parameters      :    none
* Return          :    none
* Description     :    Creates GOL widgets used in screen - PictureScreen
***************************************************/
void GDD_SCREEN_PictureScreenCreate(void)
{
    GFX_GOL_ObjectListFree(GFX_INDEX_0);
    GFX_ColorSet(GFX_INDEX_0, GFX_RGBConvert(248, 252, 248));
    GFX_ScreenClear(GFX_INDEX_0);


     if(defscheme != NULL) free(defscheme);
        defscheme = GFX_GOL_SchemeCreate();

    defscheme->Color0 = GFX_RGBConvert(32, 168, 224);
    defscheme->Color1 = GFX_RGBConvert(16, 132, 168);
    defscheme->TextColor0 = GFX_RGBConvert(24, 24, 24);
    defscheme->TextColor1 = GFX_RGBConvert(248, 252, 248);
    defscheme->EmbossDkColor = GFX_RGBConvert(248, 204, 0);
    defscheme->EmbossLtColor = GFX_RGBConvert(24, 116, 184);
    defscheme->TextColorDisabled = GFX_RGBConvert(128, 128, 128);
    defscheme->ColorDisabled = GFX_RGBConvert(208, 224, 240);
    defscheme->CommonBkColor = GFX_RGBConvert(208, 236, 240);
    defscheme->pFont = (GFX_RESOURCE_HDR*)&Gentium_16;


    GFX_GOL_WINDOW *pPICTUREWIND;
    pPICTUREWIND = GFX_GOL_WindowCreate(  GFX_INDEX_0, //gfxIndex
                       PICTUREWIND, //name
                       0, //left
                       0, //top
                       319, //right
                       239, //bottom
                       GFX_GOL_WINDOW_DRAW_STATE, //state
                       (GFX_RESOURCE_HDR*)&bekeband_kicsi, //bitmap
                       (GFX_XCHAR*)PictureScreen_PICTUREWINDtext, //text
                       GFX_ALIGN_CENTER, //align
                      defscheme //scheme
                    );

    if(pPICTUREWIND==NULL)
    {
      ErrorCreate(0);
      while(1); //Fatal Error, Check for memory leak or heap size
    }


}
Exemplo n.º 7
0
void APP_EPD_CreateGlobalImageScreen(void)
{
    uint16_t left, top, right, bottom;

    GFX_GOL_ObjectListFree();
    GFX_ColorSet(WHITE);
    GFX_ScreenClear();                          //clear screen of EPD

    left = (GFX_MaxXGet() - global_image_WIDTH) >> 1;
    top  = (GFX_MaxYGet() - global_image_HEIGHT) >> 1;
    right = left + global_image_WIDTH - 1;
    bottom = top + global_image_HEIGHT - 1;

    GFX_GOL_PictureControlCreate(
        ID_PDI_Logo,
        left, top, right, bottom,
        GFX_GOL_PICTURECONTROL_DRAW_STATE,
        1,
        (void *)&global_image,
        (GFX_GOL_OBJ_SCHEME*)&homeDemoScheme);

}
Exemplo n.º 8
0
//           this function returns zero.
/////////////////////////////////////////////////////////////////////////////
bool GFX_GOL_DrawCallback(void)
{
    
   switch(screenState)
    {
        case CREATE_MAINMENU:  

            GFX_GOL_ObjectListFree();

            GFX_ColorSet(WHITE);
            while(GFX_ScreenClear() == GFX_STATUS_FAILURE);

            CreateMainMenu();
            
            screenState = DISPLAY_MAINMENU;       // switch to next state
            break;
            
        case DISPLAY_MAINMENU:
            break;         

        case CREATE_ALPHABLEND:
            GFX_GOL_ObjectListFree();
            
            CreateAlphaBlendScreen();
            CreateBackButton();
            
            screenState = DISPLAY_ALPHABLEND;         // switch to next state
            break;
            
        case DISPLAY_ALPHABLEND:
            break;
            
        default: 
            break;    
    }    
    return (1);
}
Exemplo n.º 9
0
/*********************************************************************
 * Function: uint16_t GFX_GOL_StaticTextDraw(void *pObj)
 *
 * Notes: This is the state machine to draw the static text.
 *
 ********************************************************************/
GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject)
{

    typedef enum
    {
        GFX_GOL_STATICTEXT_STATE_IDLE,
        GFX_GOL_STATICTEXT_STATE_CLEANAREA,
        GFX_GOL_STATICTEXT_STATE_INIT,
        WAIT
    } GFX_GOL_STATICTEXT_DRAW_STATES;

    static GFX_GOL_STATICTEXT_DRAW_STATES state = GFX_GOL_STATICTEXT_STATE_IDLE;
    static GFX_STATUS index;
    GFX_GOL_STATICTEXT *pSt;

    pSt = (GFX_GOL_STATICTEXT *) pObject;

    while (1)
    {
        switch (state)
        {
            case GFX_GOL_STATICTEXT_STATE_IDLE:
                if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE))
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor);
                    if (GFX_RectangleFillDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE)
                        return (GFX_STATUS_FAILURE);

                    // State is still IDLE STATE so no need to set state
                    return (GFX_STATUS_SUCCESS);
                }

                if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE))
                {

                    if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE))
                    {

                    // show frame if specified to be shown
                    GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);

                    if (!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                    {
                        // show enabled color
                        GFX_ColorSet(pSt->hdr.pGolScheme->Color1);
                    }
                    else
                    {
                        // show disabled color
                        GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled);
                    }
                    
                   if (GFX_RectangleDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE)
                            return (GFX_STATUS_FAILURE);
                    }
                }

                state = GFX_GOL_STATICTEXT_STATE_CLEANAREA;

            case GFX_GOL_STATICTEXT_STATE_CLEANAREA:

            #ifdef USE_ALPHABLEND                //Draw the background image
            if (pSt->hdr.pGolScheme->AlphaValue != 100)
            {

                GFX_AlphaParamsSet(GFX_Primitive_instance.backgroundPage,pSt->hdr.left, pSt->hdr.top,
                                 GFX_Primitive_instance.backgroundPage,pSt->hdr.left, pSt->hdr.top,
                                 GFX_Primitive_instance.activePage,pSt->hdr.left, pSt->hdr.top);

                if(CopyPageWindow(
                        &GFX_Primitive_instance.alphaArea,
                        pSt->hdr.right - pSt->hdr.left, pSt->hdr.bottom - pSt->hdr.top) == GFX_STATUS_FAILURE)
                        return(GFX_STATUS_FAILURE);
            }
            else
            #endif
            {
                // clean area where text will be placed.
                GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor);
                if (GFX_RectangleFillDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE)
                    return (GFX_STATUS_FAILURE);
            }
            state = GFX_GOL_STATICTEXT_STATE_INIT;

            case GFX_GOL_STATICTEXT_STATE_INIT:
                // set the text color
                if (!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0);
                }
                else
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled);
                }

                // use the font specified in the object
                GFX_FontSet(pSt->hdr.pGolScheme->pFont);

                index = GFX_TextStringBoxDraw(
                        
                        pSt->hdr.left,
                        pSt->hdr.top,
                        pSt->hdr.right - pSt->hdr.left,
                        pSt->hdr.bottom - pSt->hdr.top,
                        pSt->pText, pSt->alignment);

                if(index == GFX_STATUS_FAILURE)
                {
                    return (GFX_STATUS_FAILURE);
                }
		state = WAIT;
            case WAIT:
                state = GFX_GOL_STATICTEXT_STATE_IDLE; // go back to IDLE state
                return (GFX_STATUS_SUCCESS);
        }
    } // end of switch()
} // end of while(1)    
Exemplo n.º 10
0
/*********************************************************************
* Function: uint16_t GFX_GOL_PictureDraw(void *pObj)
*
* Output: returns the status of the drawing
*		  0 - not completed
*         1 - done
*
* Overview: draws picture
*
********************************************************************/
GFX_STATUS GFX_GOL_PictureControlDraw(void *pObj)
{
    typedef enum
    {
        REMOVE,
        DRAW_IMAGE,
        DRAW_BACKGROUND1,
        DRAW_BACKGROUND2,
        DRAW_BACKGROUND3,
        DRAW_BACKGROUND4,
        DRAW_FRAME,
    } GFX_GOL_PICTURE_DRAW_STATES;

    static GFX_GOL_PICTURE_DRAW_STATES state = REMOVE;
    static uint16_t posleft;
    static uint16_t postop;
    static uint16_t posright;
    static uint16_t posbottom;
    static GFX_STATUS index = GFX_STATUS_FAILURE;
    GFX_GOL_PICTURECONTROL *pPict;


    pPict = (GFX_GOL_PICTURECONTROL *)pObj;

    switch(state)
    {
        case REMOVE:
            if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_HIDE_STATE))
            {
                GFX_ColorSet(pPict->hdr.pGolScheme->CommonBkColor);
                if(GFX_RectangleFillDraw(pPict->hdr.left, pPict->hdr.top, pPict->hdr.right, pPict->hdr.bottom) == GFX_STATUS_FAILURE)
                    return (GFX_STATUS_FAILURE);
                return (GFX_STATUS_SUCCESS);
            }

            posleft = (pPict->hdr.left + 1 + pPict->hdr.right - pPict->scaleFactor * GFX_ImageWidthGet(pPict->pImage)) >> 1;
            postop = (pPict->hdr.top + 1 + pPict->hdr.bottom - pPict->scaleFactor * GFX_ImageHeightGet(pPict->pImage)) >> 1;
            posright = (pPict->hdr.right + pPict->hdr.left + pPict->scaleFactor * GFX_ImageWidthGet(pPict->pImage)) >> 1;
            posbottom = (pPict->hdr.bottom + pPict->hdr.top + pPict->scaleFactor * GFX_ImageHeightGet(pPict->pImage)) >> 1;

            GFX_ImageStretchSet(pPict->scaleFactor);

            state = DRAW_IMAGE;

        case DRAW_IMAGE:

            if(pPict->pImage != NULL)
            {
                if(GFX_ImagePartialDraw(posleft, postop, pPict->partial.xoffset,pPict->partial.yoffset,pPict->partial.width,pPict->partial.height, pPict->pImage)==GFX_STATUS_FAILURE)
                    return (GFX_STATUS_FAILURE);
            }

            if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_STREAM_STATE))
            {

                    if(pPict->count > 0)
                    {
                        SYS_TMR_DelayMS(pPict->delay);
                        pPict->count -= 1;
                        pPict->pImage = (GFX_RESOURCE_HDR*)*pPict->stream++; //Index to next bitmap in stream
                        return(GFX_STATUS_FAILURE);
                    }
            }

             state = DRAW_BACKGROUND1;

        case DRAW_BACKGROUND1:
             GFX_ColorSet(pPict->hdr.pGolScheme->CommonBkColor);

            if(GFX_RectangleFillDraw(pPict->hdr.left + 1, pPict->hdr.top + 1, pPict->hdr.right - 1, postop - 1) == GFX_STATUS_FAILURE)
                return (GFX_STATUS_FAILURE);
            state = DRAW_BACKGROUND2;

        case DRAW_BACKGROUND2:
            if(GFX_RectangleFillDraw(pPict->hdr.left + 1, posbottom, pPict->hdr.right - 1, pPict->hdr.bottom - 1) == GFX_STATUS_FAILURE)
                return (GFX_STATUS_FAILURE);
            state = DRAW_BACKGROUND3;

        case DRAW_BACKGROUND3:
            if(GFX_RectangleFillDraw(pPict->hdr.left + 1, postop, posleft - 1, posbottom) == GFX_STATUS_FAILURE)
                return (GFX_STATUS_FAILURE);
            state = DRAW_BACKGROUND4;

        case DRAW_BACKGROUND4:
            index = GFX_RectangleFillDraw(posright, postop, pPict->hdr.right - 1, posbottom);
            if(index == GFX_STATUS_FAILURE)
            {
                return (GFX_STATUS_FAILURE);
            }
            state = DRAW_FRAME;

        case DRAW_FRAME:
            if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_FRAME_STATE))
            {
                GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);
                GFX_ColorSet(pPict->hdr.pGolScheme->TextColor0);
                index = GFX_RectangleDraw(pPict->hdr.left, pPict->hdr.top, pPict->hdr.right, pPict->hdr.bottom);
                if(index == GFX_STATUS_FAILURE)
                {
                     return (GFX_STATUS_FAILURE);
                }
            }
            state = REMOVE;
            return (GFX_STATUS_SUCCESS);
    }

    return (GFX_STATUS_SUCCESS);
}
Exemplo n.º 11
0
// *****************************************************************************
GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject)
{
    typedef enum
    {
        DRAW_STATIC_TEXT_IDLE,
        DRAW_STATIC_TEXT_CLEANAREA,
        DRAW_STATIC_TEXT_INIT,
        DRAW_STATIC_TEXT_DRAWTEXT,
    } ST_DRAW_STATES;

    static ST_DRAW_STATES   state = DRAW_STATIC_TEXT_IDLE;
    GFX_GOL_STATICTEXT      *pSt;
    
    static uint16_t         adjustBackground = 0;

#ifdef GFX_CONFIG_ALPHABLEND_DISABLE
#ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE
    uint16_t                transparentColorStatus;
    GFX_COLOR               transparentColorSet = 0;
#endif
#endif

    pSt = (GFX_GOL_STATICTEXT *)pObject;

    while(1)
    {
        if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
            return (GFX_STATUS_FAILURE);
    
        switch(state)
        {
            case DRAW_STATIC_TEXT_IDLE:

#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
                GFX_DRIVER_SetupDrawUpdate( \
                        pSt->hdr.left,      \
                        pSt->hdr.top,       \
                        pSt->hdr.right,     \
                        pSt->hdr.bottom);
#endif

                if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE))
                {

                // Hide the GFX_GOL_STATICTEXT (remove from screen)
                if (GFX_GOL_ObjectHideDraw(&(pSt->hdr)) != GFX_STATUS_SUCCESS)
                    return (GFX_STATUS_FAILURE);

                    // State is still IDLE STATE so no need to set state
#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
                GFX_DRIVER_CompleteDrawUpdate(  \
                        pSt->hdr.left,          \
                        pSt->hdr.top,           \
                        pSt->hdr.right,         \
                        pSt->hdr.bottom);
#endif
                    return (GFX_STATUS_SUCCESS);
                }
    
                if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE))
                {
                    // show frame if specified to be shown
                    GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);
    
                    if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE))
                    {
                        adjustBackground = 1;
                        // set the line style to solid thin line
                        GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);

                        if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                        {    
                            // show enabled color
                            GFX_ColorSet(pSt->hdr.pGolScheme->Color1);
                            if(GFX_RectangleDraw(
                                pSt->hdr.left,
                                pSt->hdr.top,
                                pSt->hdr.right,
                                pSt->hdr.bottom) != GFX_STATUS_SUCCESS)
                            {
                                return (GFX_STATUS_FAILURE);
                            }
                        }
                        else
                        {
                            // show disabled color
                            GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled);
                            if(GFX_RectangleDraw(
                                pSt->hdr.left,
                                pSt->hdr.top,
                                pSt->hdr.right,
                                pSt->hdr.bottom) != GFX_STATUS_SUCCESS)
                            {
                                return (GFX_STATUS_FAILURE);
                            }
                        }
                    }
                    else
                    {
                        adjustBackground = 0;
                    }
                }

                // check if there is no background 
                if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_NOBACKGROUNDCOLORFILL_STATE))
                {
                    state = DRAW_STATIC_TEXT_INIT;
                    break;
                }
                else
                {
                    state = DRAW_STATIC_TEXT_CLEANAREA;
                }
    
            case DRAW_STATIC_TEXT_CLEANAREA:

                /* The refreshing of the static area is dependent on the
                   features set.

                 Case 1:
                    When fill style is GFX_FILL_STYLE_NONE, text cannot be
                    changed and refreshed. If text changes then use one
                    of the following fill styles:
                        GFX_FILL_STYLE_COLOR
                        GFX_FILL_STYLE_ALPHA_COLOR
                        GFX_FILL_STYLE_GRADIENT_DOWN,
                        GFX_FILL_STYLE_GRADIENT_UP,
                        GFX_FILL_STYLE_GRADIENT_RIGHT,
                        GFX_FILL_STYLE_GRADIENT_LEFT,
                        GFX_FILL_STYLE_GRADIENT_DOUBLE_VER,
                        GFX_FILL_STYLE_GRADIENT_DOUBLE_HOR,
                        or
                        use (or enable) the common background image
                        if available in the application (see case 2).
                 Case 2:
                    When common background image is set, then
                    GFX_FILL_STYLE_NONE can be used. Redrawing the
                    static text will redraw the background which in turn
                    refreshes the text. Therefore, in this case the text
                    can be modified.
                 Case 3:
                    Alpha blending cannot be used with gradient fills.
                 Therefore, do use gradient fills when alpha blending of
                 panels are enabled.

                 */

                // check if fill style is GFX_FILL_STYLE_NONE and common
                // background is present
                if ((pSt->hdr.pGolScheme->pCommonBkImage != NULL) &&
                    (pSt->hdr.pGolScheme->fillStyle == GFX_FILL_STYLE_NONE))
                {
#ifdef GFX_CONFIG_ALPHABLEND_DISABLE
#ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE
                    if (GFX_TransparentColorStatusGet() == GFX_FEATURE_ENABLED)
                    {
                        // disable the transparent color since we want the
                        // background to refresh with all pixels being drawn
                        GFX_TransparentColorDisable();
                        transparentColorStatus = 1;
                        transparentColorSet = GFX_TransparentColorGet();
                    }
#endif
#endif
                    if (GFX_ImagePartialDraw(
                            pSt->hdr.left + adjustBackground, pSt->hdr.top + adjustBackground,
                            pSt->hdr.left - pSt->hdr.pGolScheme->CommonBkLeft + adjustBackground,
                            pSt->hdr.top - pSt->hdr.pGolScheme->CommonBkTop + adjustBackground,
                            pSt->hdr.right - pSt->hdr.left + 1 - (adjustBackground << 1),
                            pSt->hdr.bottom - pSt->hdr.top + 1 - (adjustBackground << 1),
                            pSt->hdr.pGolScheme->pCommonBkImage
                        ) != GFX_STATUS_SUCCESS)
                    {
                        return (GFX_STATUS_FAILURE);
                    }

#ifdef GFX_CONFIG_ALPHABLEND_DISABLE
#ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE
                    // after rendering the background, we need to restore the
                    // transparent color if previously enabled.
                    if (transparentColorStatus)
                    {
                        GFX_TransparentColorEnable(transparentColorSet);
                    }
#endif
#endif
                }
                else
                {

                    if (pSt->hdr.pGolScheme->fillStyle != GFX_FILL_STYLE_NONE)
                    {
                        // clean area where text will be placed.
                        GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor);
                        GFX_GOL_ObjectBackGroundSet(&pSt->hdr);

                        if(GFX_RectangleFillDraw(
                            pSt->hdr.left + 1,
                            pSt->hdr.top + 1,
                            pSt->hdr.right - 1,
                            pSt->hdr.bottom - 1) != GFX_STATUS_SUCCESS)
                        {
                            return (GFX_STATUS_FAILURE);
                        }
                    }
                }
                state = DRAW_STATIC_TEXT_INIT;
    
            case DRAW_STATIC_TEXT_INIT:
                if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
                    return (GFX_STATUS_FAILURE);
    
                // set the text color
                if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0);
                }
                else
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled);
                }
    
                // use the font specified in the object
                GFX_FontSet(pSt->hdr.pGolScheme->pFont);
                state = DRAW_STATIC_TEXT_DRAWTEXT;

            case DRAW_STATIC_TEXT_DRAWTEXT:

                if (GFX_TextStringBoxDraw(                      \
                        pSt->hdr.left + 1,                      \
                        pSt->hdr.top + 1,                       \
                        pSt->hdr.right  - pSt->hdr.left - 1,    \
                        pSt->hdr.bottom - pSt->hdr.top  - 1,    \
                        pSt->pText,                             \
                        0,                                      \
                        pSt->alignment)  != GFX_STATUS_SUCCESS)
                    return (GFX_STATUS_FAILURE);

                state = DRAW_STATIC_TEXT_IDLE;    // go back to IDLE state
#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
                GFX_DRIVER_CompleteDrawUpdate(  \
                        pSt->hdr.left,          \
                        pSt->hdr.top,           \
                        pSt->hdr.right,         \
                        pSt->hdr.bottom);
#endif
                return (GFX_STATUS_SUCCESS);

        } // end of switch()
    } // end of while(1)    
}
Exemplo n.º 12
0
// *****************************************************************************
GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject)
{
    typedef enum
    {
        DRAW_STATIC_TEXT_IDLE,
        DRAW_STATIC_TEXT_CLEANAREA,
        DRAW_STATIC_TEXT_INIT,
        DRAW_STATIC_TEXT_DRAWTEXT,
    } ST_DRAW_STATES;

    static ST_DRAW_STATES   state = DRAW_STATIC_TEXT_IDLE;
    GFX_GOL_STATICTEXT      *pSt;

    pSt = (GFX_GOL_STATICTEXT *)pObject;

    while(1)
    {
        if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
            return (GFX_STATUS_FAILURE);
    
        switch(state)
        {
            case DRAW_STATIC_TEXT_IDLE:

                if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE))
                {

                    // Hide the GFX_GOL_STATICTEXT (remove from screen)
                    if (GFX_GOL_ObjectHideDraw(&(pSt->hdr)) != GFX_STATUS_SUCCESS)
                        return (GFX_STATUS_FAILURE);

                    // State is still IDLE STATE so no need to set state
                    return (GFX_STATUS_SUCCESS);
                }
    
                if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE))
                {
                    // show frame if specified to be shown
                    GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);
    
                    if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE))
                    {

                        // set the line style to solid thin line
                        GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);

                        if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                        {    
                            // show enabled color
                            GFX_ColorSet(pSt->hdr.pGolScheme->Color1);
                            if(GFX_RectangleDraw(
                                pSt->hdr.left,
                                pSt->hdr.top,
                                pSt->hdr.right,
                                pSt->hdr.bottom) != GFX_STATUS_SUCCESS)
                            {
                                return (GFX_STATUS_FAILURE);
                            }
                        }
                        else
                        {
                            // show disabled color
                            GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled);
                            if(GFX_RectangleDraw(
                                pSt->hdr.left,
                                pSt->hdr.top,
                                pSt->hdr.right,
                                pSt->hdr.bottom) != GFX_STATUS_SUCCESS)
                            {
                                return (GFX_STATUS_FAILURE);
                            }
                        }
                    }
                }

                // check if there is no background 
                if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_NOBACKGROUNDCOLORFILL_STATE))
                {
                    state = DRAW_STATIC_TEXT_INIT;
                    break;
                }
                else
                {
                    state = DRAW_STATIC_TEXT_CLEANAREA;
                }
    
            case DRAW_STATIC_TEXT_CLEANAREA:
    
                // clean area where text will be placed.
                GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor);
                GFX_GOL_ObjectBackGroundSet(&pSt->hdr);

                if(GFX_RectangleFillDraw(
                    pSt->hdr.left + 1,
                    pSt->hdr.top + 1,
                    pSt->hdr.right - 1,
                    pSt->hdr.bottom - 1) != GFX_STATUS_SUCCESS)
                {
                    return (GFX_STATUS_FAILURE);
                }
                state = DRAW_STATIC_TEXT_INIT;
    
            case DRAW_STATIC_TEXT_INIT:
                if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
                    return (GFX_STATUS_FAILURE);
    
                // set the text color
                if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE))
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0);
                }
                else
                {
                    GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled);
                }
    
                // use the font specified in the object
                GFX_FontSet(pSt->hdr.pGolScheme->pFont);
                state = DRAW_STATIC_TEXT_DRAWTEXT;

            case DRAW_STATIC_TEXT_DRAWTEXT:

                if (GFX_TextStringBoxDraw(                      \
                        pSt->hdr.left + 1,                      \
                        pSt->hdr.top + 1,                       \
                        pSt->hdr.right  - pSt->hdr.left - 1,    \
                        pSt->hdr.bottom - pSt->hdr.top  - 1,    \
                        pSt->pText,                             \
                        0,                                      \
                        pSt->alignment)  != GFX_STATUS_SUCCESS)
                    return (GFX_STATUS_FAILURE);

                state = DRAW_STATIC_TEXT_IDLE;    // go back to IDLE state
                return (GFX_STATUS_SUCCESS);

        } // end of switch()
    } // end of while(1)    
}
Exemplo n.º 13
0
void PagingDemo(void)
{

  int        x,y;
  GFX_XCHAR      Scroll[] = {'C','o','l','o','r','s',' ','C','h','a','n','g','e',' ','w',' ','T','e','m','p','s',0};
  GFX_XCHAR      Cloud[] = {'C','l','o','u','d','y',0};
  GFX_XCHAR      Temper[] = {'T','e','m','p','e','r','a','t','u','r','e',0};
  GFX_XCHAR      SetTemp[] = {'S','e','t',' ','T','e','m','p',0};
  GFX_XCHAR      Time[] = {'8',':','2','0',' ','P','M',0};
  GFX_XCHAR      Date[] = {'J','u','n','e',' ','1','1',',',' ','2','0','1','2',0};
  GFX_XCHAR      Room[] = {'7','4',0};

              while(GFX_PageSet(ACTIVE_PAGE,PIP_BUFFER) == GFX_STATUS_FAILURE);
              GFX_GradientColorSet(GFX_RGBConvert(55,0,0),BLACK);
              GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN);
              while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),55) == GFX_STATUS_FAILURE);
              GFX_ColorSet(WHITE);

              GFX_FontSet((void *) &Monospaced_plain_36);
              while(GFX_TextStringBoxDraw(0,0,0,0,(GFX_XCHAR*)Scroll,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

  GFX_XCHAR Temp[] ={'7','3',0};

for(x=0;x<2;x++)        
{  

  while(GFX_PageSet(ACTIVE_PAGE,x) == GFX_STATUS_FAILURE);

  if(x==0)
  {
     GFX_GradientColorSet(BRIGHTRED,BLACK);
     while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),GFX_MaxYGet())== GFX_STATUS_FAILURE);
  }
  else
  {
      GFX_GradientColorSet(BRIGHTBLUE,BLACK);
      while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE);
  }

  GFX_GradientColorSet(WHITE,BLACK);
  while(GFX_BevelGradientDraw(340,120,370,140,10) == GFX_STATUS_FAILURE);
  while(GFX_BevelGradientDraw(340,165,370,185,10) == GFX_STATUS_FAILURE);
  GFX_ColorSet(WHITE);
  GFX_FontSet((void *) &Gentium_16);
  while(GFX_TextStringBoxDraw(50,75,0,0,(GFX_XCHAR*)Cloud,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
  while(GFX_TextStringBoxDraw(190,75,0,0,(GFX_XCHAR*)Temper,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
  while(GFX_TextStringBoxDraw(380,75,0,0,(GFX_XCHAR*)SetTemp,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

   GFX_ColorSet(WHITE);
   while(GFX_TextStringBoxDraw(GFX_MaxXGet()-80,0,0,0,(GFX_XCHAR*)Time,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
   while(GFX_TextStringBoxDraw(10,0,0,0,(GFX_XCHAR*)Date,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

   GFX_FontSet((void *) &Monospaced_plain_36);
   while(GFX_TextStringBoxDraw(345,100,0,0,(GFX_XCHAR*)"+",0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
   while(GFX_TextStringBoxDraw(345,145,0,0,(GFX_XCHAR*)"-",0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

   GFX_FontSet((void *) &Monospaced_bold_Bold_72);

  if(x==0)
  { 
    while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);   //Room Temp
  }

  while(GFX_TextStringBoxDraw(385,100,0,0,(GFX_XCHAR*)Room,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

        while(ImageDecode
        (                                              
            (void *)&clouds,
            IMG_JPEG,                          
            10,                              
            100,
            10 + clouds_WIDTH,
            100 + clouds_HEIGHT,
            0,                                 
            &_jpegFileApi,                     
            NULL                   
        ) == 0xff);

}

  while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE);
  while(GFX_PageSet(VISUAL_PAGE,0) == GFX_STATUS_FAILURE);

  while(GFX_Layer(0, SET_PAGE, PIP_BUFFER, 0) == GFX_STATUS_FAILURE);
  while(GFX_Layer(0, SET_SIZE, GFX_MaxXGet()-10, 55) == GFX_STATUS_FAILURE);
  while(GFX_Layer(0, SET_PAGE_START, 0, GFX_MaxYGet()-56) == GFX_STATUS_FAILURE);
  while(GFX_Layer(0, SET_LAYER_START, 0, 0) == GFX_STATUS_FAILURE);

  SYS_TMR_DelayMS(1000);
  x=0;

  while(x++ < 3)
  {
       while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE);
       SYS_TMR_DelayMS(500);
       while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE);
       SYS_TMR_DelayMS(500);
  }

  x = 0;

  while(x++ < 465)
  {
     while(GFX_Layer(0, SET_LAYER_START, x, 0) == GFX_STATUS_FAILURE);
     while(GFX_Layer(0, SET_SIZE, GFX_MaxXGet()-10-x, 55) == GFX_STATUS_FAILURE);
     while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE);
     SYS_TMR_DelayMS(10);
  }

  while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE);
  GFX_ColorSet(WHITE);

 for(x=0;x<1;x++)
 {
  Temp[1] += 1; SYS_TMR_DelayMS(1000);
  GFX_GradientColorSet(GFX_RGBConvert(148,0,0),BLACK);
  GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN);
  while(GFX_BarGradientDraw(250,116,300,GFX_MaxYGet()) == GFX_STATUS_FAILURE);
  GFX_ColorSet(WHITE);
  GFX_FontSet((void *) &Gentium_16);
  while(GFX_TextStringBoxDraw(190,75,0,0,(GFX_XCHAR*)Temper,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
  GFX_FontSet((void *) &Monospaced_bold_Bold_72);
  while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
  } 

  while(GFX_PageSet(ACTIVE_PAGE,1) == GFX_STATUS_FAILURE);
  while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
  while(GFX_PageSet(VISUAL_PAGE,1) == GFX_STATUS_FAILURE);

  SYS_TMR_DelayMS(2000);
  while(GFX_PageSet(ACTIVE_PAGE, 0) == GFX_STATUS_FAILURE);
  while(GFX_PageSet(VISUAL_PAGE, 0) == GFX_STATUS_FAILURE);
  GFX_ColorSet(WHITE);
  while(GFX_ScreenClear() == GFX_STATUS_FAILURE);

}
Exemplo n.º 14
0
/***************************************************
* Function 	      :    GDD_SCREEN_WelcomeScreenCreate
* Parameters      :    none
* Return          :    none
* Description     :    Creates GOL widgets used in screen - WelcomeScreen
***************************************************/
void GDD_SCREEN_WelcomeScreenCreate(void)
{
    GFX_GOL_ObjectListFree(GFX_INDEX_0);
    GFX_ColorSet(GFX_INDEX_0, GFX_RGBConvert(248, 252, 248));
    GFX_ScreenClear(GFX_INDEX_0);


     if(enter_new_s524cheme != NULL) free(enter_new_s524cheme);
        enter_new_s524cheme = GFX_GOL_SchemeCreate();

    enter_new_s524cheme->Color0 = GFX_RGBConvert(32, 168, 224);
    enter_new_s524cheme->Color1 = GFX_RGBConvert(16, 132, 168);
    enter_new_s524cheme->TextColor0 = GFX_RGBConvert(24, 24, 24);
    enter_new_s524cheme->TextColor1 = GFX_RGBConvert(248, 252, 248);
    enter_new_s524cheme->EmbossDkColor = GFX_RGBConvert(248, 204, 0);
    enter_new_s524cheme->EmbossLtColor = GFX_RGBConvert(24, 116, 184);
    enter_new_s524cheme->TextColorDisabled = GFX_RGBConvert(128, 128, 128);
    enter_new_s524cheme->ColorDisabled = GFX_RGBConvert(208, 224, 240);
    enter_new_s524cheme->CommonBkColor = GFX_RGBConvert(208, 236, 240);
    enter_new_s524cheme->pFont = (GFX_RESOURCE_HDR*)&DroidSans_Bold_12;

    if(defscheme != NULL) free(defscheme);
        defscheme = GFX_GOL_SchemeCreate();

    defscheme->Color0 = GFX_RGBConvert(32, 168, 224);
    defscheme->Color1 = GFX_RGBConvert(16, 132, 168);
    defscheme->TextColor0 = GFX_RGBConvert(24, 24, 24);
    defscheme->TextColor1 = GFX_RGBConvert(248, 252, 248);
    defscheme->EmbossDkColor = GFX_RGBConvert(248, 204, 0);
    defscheme->EmbossLtColor = GFX_RGBConvert(24, 116, 184);
    defscheme->TextColorDisabled = GFX_RGBConvert(128, 128, 128);
    defscheme->ColorDisabled = GFX_RGBConvert(208, 224, 240);
    defscheme->CommonBkColor = GFX_RGBConvert(208, 236, 240);
    defscheme->pFont = (GFX_RESOURCE_HDR*)&Gentium_16;


    GFX_GOL_WINDOW *pMAIN_WINDOW;
    pMAIN_WINDOW = GFX_GOL_WindowCreate(  GFX_INDEX_0, //gfxIndex
                       MAIN_WINDOW, //name
                       0, //left
                       0, //top
                       319, //right
                       239, //bottom
                       GFX_GOL_WINDOW_DRAW_STATE, //state
                       NULL, //bitmap
                       (GFX_XCHAR*)WelcomeScreen_MAIN_WINDOWtext, //text
                       GFX_ALIGN_CENTER, //align
                      enter_new_s524cheme //scheme
                    );

    if(pMAIN_WINDOW==NULL)
    {
      ErrorCreate(0);
      while(1); //Fatal Error, Check for memory leak or heap size
    }

    GFX_GOL_METER *pMTR_2;
    pMTR_2 = GFX_GOL_MeterCreate(  GFX_INDEX_0, //gfxIndex
                       MTR_2, //name
                       13, //left
                       45, //top
                       133, //right
                       165, //bottom
                       GFX_GOL_METER_DRAW_STATE, //state
                       GFX_GOL_METER_WHOLE_TYPE, //metertype
                       1, //pos
                       1, //minval
                       50, //maxval
                       (GFX_RESOURCE_HDR*)&Gentium_16, //titlefont
                       (GFX_RESOURCE_HDR*)&Gentium_16, //valuefont
                       (GFX_XCHAR*)WelcomeScreen_MTR_2text, //text
                      defscheme //scheme
                    );

    if(pMTR_2==NULL)
    {
      ErrorCreate(0);
      while(1); //Fatal Error, Check for memory leak or heap size
    }


}
Exemplo n.º 15
0
// *****************************************************************************
GFX_STATUS GFX_GOL_CheckBoxDraw(void *pObject)
{
    typedef enum
    {
        DRAW_CHECKBOX_START,
        DRAW_CHECKBOX_BOX_DRAW,
        DRAW_CHECKBOX_RUN_DRAW,
        DRAW_CHECKBOX_TEXT_DRAW,
        DRAW_CHECKBOX_TEXT_DRAW_RUN,
        DRAW_CHECKBOX_CHECK_SET_DRAW,
        DRAW_CHECKBOX_CHECK_DRAW,
        DRAW_CHECKBOX_FOCUS_DRAW
    } CB_DRAW_STATES;

    static CB_DRAW_STATES   state = DRAW_CHECKBOX_START;
    static int16_t          checkIndent;
    static uint16_t         width;
    GFX_GOL_CHECKBOX        *pCb;

    pCb = (GFX_GOL_CHECKBOX *)pObject;

    while(1)
    {
        if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
            return (GFX_STATUS_FAILURE);
    
        switch(state)
        {
            case DRAW_CHECKBOX_RUN_DRAW:

                if(GFX_GOL_PanelDraw() != GFX_STATUS_SUCCESS)
                {
                    return (GFX_STATUS_FAILURE);
                }
                state = DRAW_CHECKBOX_TEXT_DRAW;

            case DRAW_CHECKBOX_TEXT_DRAW:
                if(pCb->pText != NULL)
                {
                    GFX_FontSet(pCb->hdr.pGolScheme->pFont);
    
                    if(!GFX_GOL_ObjectStateGet(
                            pCb,
                            GFX_GOL_CHECKBOX_DISABLED_STATE))
                    {
                        GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0);
                    }
                    else
                    {
                        GFX_ColorSet(pCb->hdr.pGolScheme->TextColorDisabled);
                    }
                    width = pCb->hdr.bottom - pCb->hdr.top;
                    state = DRAW_CHECKBOX_TEXT_DRAW_RUN;
                }
                else
                {
                    state = DRAW_CHECKBOX_CHECK_SET_DRAW;
                    break;
                }
    
            case DRAW_CHECKBOX_TEXT_DRAW_RUN:
                if (GFX_TextStringBoxDraw(
                        pCb->hdr.left + width + CB_INDENT,
                        pCb->hdr.top + pCb->hdr.pGolScheme->EmbossSize,
                        pCb->hdr.right -
                            pCb->hdr.left -
                            (pCb->hdr.pGolScheme->EmbossSize << 1) -
                            width,
                        width -
                            (pCb->hdr.pGolScheme->EmbossSize << 1),
                        pCb->pText,
                        0,
                        pCb->alignment) != GFX_STATUS_SUCCESS)
                {
                    return (GFX_STATUS_FAILURE);
                }

                state = DRAW_CHECKBOX_CHECK_SET_DRAW;
                break;

            case DRAW_CHECKBOX_START:
#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
	        GFX_DRIVER_SetupDrawUpdate( pCb->hdr.left,
	                                    pCb->hdr.top,
	                                    pCb->hdr.right,
	                                    pCb->hdr.bottom);
#endif
                if(GFX_GOL_ObjectStateGet(pCb, GFX_GOL_CHECKBOX_HIDE_STATE))
                {
                    if (GFX_GOL_ObjectHideDraw(&(pCb->hdr)) != GFX_STATUS_SUCCESS)
                        return (GFX_STATUS_FAILURE);

#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
                    GFX_DRIVER_CompleteDrawUpdate(   pCb->hdr.left,
	                                             pCb->hdr.top,
	                                             pCb->hdr.right,
	                                             pCb->hdr.bottom);
#endif
                    return (GFX_STATUS_SUCCESS);
                }
                else if(GFX_GOL_ObjectStateGet(
                        pCb,
                        GFX_GOL_CHECKBOX_DRAW_STATE))
                {

                    GFX_ColorSet(pCb->hdr.pGolScheme->CommonBkColor);
                    GFX_GOL_ObjectBackGroundSet(&pCb->hdr);

                    if(GFX_RectangleFillDraw(
                            pCb->hdr.left,
                            pCb->hdr.top,
                            pCb->hdr.right,
                            pCb->hdr.bottom) != GFX_STATUS_SUCCESS)
                    {
                        return (GFX_STATUS_FAILURE);
                    }
                }
    
                state = DRAW_CHECKBOX_BOX_DRAW;
    
            case DRAW_CHECKBOX_BOX_DRAW:

                GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);

                if(GFX_GOL_ObjectStateGet(
                        pCb,
                        GFX_GOL_CHECKBOX_DRAW_STATE))
                {
                    if(GFX_GOL_ObjectStateGet(
                            pCb,
                            GFX_GOL_CHECKBOX_DISABLED_STATE))
                    {
                        GFX_GOL_PanelParameterSet(
                            pCb->hdr.left + CB_INDENT,
                            pCb->hdr.top + CB_INDENT,
                            pCb->hdr.left + \
                                (pCb->hdr.bottom - pCb->hdr.top) - CB_INDENT,
                            pCb->hdr.bottom - CB_INDENT,
                            0,
                            pCb->hdr.pGolScheme->ColorDisabled,
                            pCb->hdr.pGolScheme->EmbossDkColor,
                            pCb->hdr.pGolScheme->EmbossLtColor,
                            NULL,
                            pCb->hdr.pGolScheme->fillStyle,
                            pCb->hdr.pGolScheme->EmbossSize);
                    }
                    else
                    {
                        GFX_GOL_PanelParameterSet(
                            pCb->hdr.left + CB_INDENT,
                            pCb->hdr.top + CB_INDENT,
                            pCb->hdr.left + \
                                (pCb->hdr.bottom - pCb->hdr.top) - CB_INDENT,
                            pCb->hdr.bottom - CB_INDENT,
                            0,
                            pCb->hdr.pGolScheme->Color0,
                            pCb->hdr.pGolScheme->EmbossDkColor,
                            pCb->hdr.pGolScheme->EmbossLtColor,
                            NULL,
                            pCb->hdr.pGolScheme->fillStyle,
                            pCb->hdr.pGolScheme->EmbossSize);
                    }
                    // set the background information
                    GFX_GOL_PanelBackgroundSet(&pCb->hdr);
                    state = DRAW_CHECKBOX_RUN_DRAW;
                    break;
                }
                else
                {
                    state = DRAW_CHECKBOX_CHECK_SET_DRAW;
                }
   
            case DRAW_CHECKBOX_CHECK_SET_DRAW:
                if(GFX_GOL_ObjectStateGet(
                        pCb,
                        (GFX_GOL_CHECKBOX_DRAW_STATE | GFX_GOL_CHECKBOX_DRAW_CHECK_STATE)))
                {
                    if(!GFX_GOL_ObjectStateGet(
                            pCb,
                            GFX_GOL_CHECKBOX_DISABLED_STATE))
                    {
                        if(GFX_GOL_ObjectStateGet(
                                pCb,
                                GFX_GOL_CHECKBOX_CHECKED_STATE))
                        {
                            GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0);
                            GFX_FillStyleSet(GFX_FILL_STYLE_COLOR);
                        }
                        else
                        {
                            GFX_GOL_ObjectBackGroundSet(&pCb->hdr);
                            GFX_ColorSet(pCb->hdr.pGolScheme->Color0);
                        }
                    }
                    else
                    {
                        if(GFX_GOL_ObjectStateGet(
                                pCb,
                                GFX_GOL_CHECKBOX_CHECKED_STATE))
                        {
                            GFX_ColorSet(pCb->hdr.pGolScheme->TextColorDisabled);
                            GFX_FillStyleSet(GFX_FILL_STYLE_COLOR);
                        }
                        else
                        {
                            GFX_GOL_ObjectBackGroundSet(&pCb->hdr);
                            GFX_ColorSet(pCb->hdr.pGolScheme->ColorDisabled);
                        }
                    }
    
                    checkIndent = (pCb->hdr.bottom - pCb->hdr.top) >> 2;
                    state = DRAW_CHECKBOX_CHECK_DRAW;
                }   
                else
                {
                    state = DRAW_CHECKBOX_FOCUS_DRAW;
                    break;
                }
    
            case DRAW_CHECKBOX_CHECK_DRAW:
                if (    GFX_RectangleFillDraw(
                            pCb->hdr.left +
                                checkIndent + pCb->hdr.pGolScheme->EmbossSize,
                            pCb->hdr.top +
                                checkIndent + pCb->hdr.pGolScheme->EmbossSize,
                            pCb->hdr.left +
                                (pCb->hdr.bottom - pCb->hdr.top) -
                                checkIndent - pCb->hdr.pGolScheme->EmbossSize,
                            pCb->hdr.bottom -
                                checkIndent - pCb->hdr.pGolScheme->EmbossSize)
                    != GFX_STATUS_SUCCESS)
                {
                    return (GFX_STATUS_FAILURE);
                }
    
                state = DRAW_CHECKBOX_FOCUS_DRAW;
    
            case DRAW_CHECKBOX_FOCUS_DRAW:
                if(GFX_GOL_ObjectStateGet(
                        pCb,
                        (GFX_GOL_CHECKBOX_DRAW_STATE |
                        GFX_GOL_CHECKBOX_DRAW_FOCUS_STATE)))
                {
                    if(GFX_GOL_ObjectStateGet(
                            pCb,
                            GFX_GOL_CHECKBOX_FOCUSED_STATE))
                    {
                        GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0);
                    }
                    else
                    {
                        GFX_ColorSet(pCb->hdr.pGolScheme->CommonBkColor);
                    }
    
                    GFX_LineStyleSet(GFX_LINE_STYLE_THIN_DASHED);
                    if(GFX_RectangleDraw(
                            pCb->hdr.left,
                            pCb->hdr.top,
                            pCb->hdr.right,
                            pCb->hdr.bottom) != GFX_STATUS_SUCCESS)
                    {
                        return (GFX_STATUS_FAILURE);
                    }
    
                    GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID);
                }
    
                state = DRAW_CHECKBOX_START;
#ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE
            	GFX_DRIVER_CompleteDrawUpdate(  pCb->hdr.left,
                                                pCb->hdr.top,
                                                pCb->hdr.right,
                                                pCb->hdr.bottom);
#endif
                return (GFX_STATUS_SUCCESS);
        } // end of switch()   
    } // end of while(1)
Exemplo n.º 16
0
// *****************************************************************************
GFX_STATUS GFX_GOL_EditBoxDraw(void *pObject)
{
    typedef enum
    {
        DRAW_EDITBOX_START, 
        DRAW_EDITBOX_PANEL, 
        DRAW_EDITBOX_PREPARE_TEXT, 
        DRAW_EDITBOX_TEXT, 
        DRAW_EDITBOX_CARET, 
    } DRAW_EDITBOX_STATES;

    static DRAW_EDITBOX_STATES  state = DRAW_EDITBOX_START;
    static GFX_COLOR            tempColor;
    GFX_GOL_EDITBOX             *pEb;

    pEb = (GFX_GOL_EDITBOX *)pObject;

    while(1)
    {
        if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT)
            return (GFX_STATUS_FAILURE);

        switch(state)
        {
    
            case DRAW_EDITBOX_START:
#ifdef GFX_LIB_CFG_USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH
                GFX_DRIVER_SetupDrawUpdate( pEb->hdr.left,
                                            pEb->hdr.top,
                                            pEb->hdr.right,
                                            pEb->hdr.bottom);
#endif
    
              	if(GFX_GOL_ObjectStateGet(pEb, GFX_GOL_EDITBOX_HIDE_STATE))
                {

                    // Hide the object (remove from screen)
                    if (GFX_GOL_ObjectHideDraw(&(pEb->hdr)) != GFX_STATUS_SUCCESS)
                        return (GFX_STATUS_FAILURE);

#ifdef GFX_LIB_CFG_USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH
                    GFX_DRIVER_CompleteDrawUpdate(  pEb->hdr.left,
                                                    pEb->hdr.top,
                                                    pEb->hdr.right,
                                                    pEb->hdr.bottom);
#endif
                    return (GFX_STATUS_SUCCESS);
                }
    
                if(GFX_GOL_ObjectStateGet(pEb,GFX_GOL_EDITBOX_DISABLED_STATE))
                {
                    tempColor = pEb->hdr.pGolScheme->ColorDisabled;
    	        }
                else
                {
                    tempColor = pEb->hdr.pGolScheme->Color0;
                }
    
                if(GFX_GOL_ObjectStateGet(pEb,GFX_GOL_EDITBOX_DRAW_STATE))
                {
                    // set up the background
                    GFX_GOL_PanelBackgroundSet(&pEb->hdr);

                    // set panel parameters
                    GFX_GOL_PanelParameterSet
                    (
                        pEb->hdr.left,
                        pEb->hdr.top,
                        pEb->hdr.right,
                        pEb->hdr.bottom,
                        0,
                        tempColor,
                        pEb->hdr.pGolScheme->EmbossDkColor,
                        pEb->hdr.pGolScheme->EmbossLtColor,
                        NULL,
                        pEb->hdr.pGolScheme->fillStyle,
                        pEb->hdr.pGolScheme->EmbossSize
                    );
    
                    state = DRAW_EDITBOX_PANEL;
                    // no break here since it will always go
                    // to the DRAW_EDITBOX_PANEL state
                }
                else
                {
                    state = DRAW_EDITBOX_PREPARE_TEXT;
                    break;
                }    
                
            case DRAW_EDITBOX_PANEL:

                if(GFX_GOL_PanelDraw() != GFX_STATUS_SUCCESS)
		{
                    return (GFX_STATUS_FAILURE);
                }
                state = DRAW_EDITBOX_PREPARE_TEXT;
                // no break here since it will always go to
                // the DRAW_EDITBOX_PREPARE_TEXT state
    
            case DRAW_EDITBOX_PREPARE_TEXT:
    
    	        GFX_FontSet(pEb->hdr.pGolScheme->pFont);
    
                if(GFX_GOL_ObjectStateGet(pEb,GFX_GOL_EDITBOX_DISABLED_STATE))
                {
                    GFX_ColorSet(pEb->hdr.pGolScheme->TextColorDisabled);
                }
                else
                {
                    GFX_ColorSet(pEb->hdr.pGolScheme->TextColor0);
                }
  
                state = DRAW_EDITBOX_TEXT;
    		    
    		// no break here since it will always go to
                // the DRAW_EDITBOX_TEXT state
    
            case DRAW_EDITBOX_TEXT:

                // render the text
                if (GFX_TextStringBoxDraw(
                    pEb->hdr.left + pEb->hdr.pGolScheme->EmbossSize,
                    pEb->hdr.top  + pEb->hdr.pGolScheme->EmbossSize,
                    pEb->hdr.right - pEb->hdr.left -
                        (pEb->hdr.pGolScheme->EmbossSize << 1),
                    pEb->hdr.bottom - pEb->hdr.top -
                        (pEb->hdr.pGolScheme->EmbossSize << 1),
                    pEb->pText,
                    0,
                    pEb->alignment) != GFX_STATUS_SUCCESS)
                {
                  return (GFX_STATUS_FAILURE);
                };
       			
                // draw the caret if required
                if(!GFX_GOL_ObjectStateGet(
                        pEb,
                        GFX_GOL_EDITBOX_DISABLED_STATE))
                {
    	            if(    (GFX_GOL_ObjectStateGet(
                                pEb,
                                GFX_GOL_EDITBOX_FOCUSED_STATE) &&
                            GFX_GOL_ObjectStateGet(
                                pEb,
                                GFX_GOL_EDITBOX_DRAW_CARET_STATE)
                           ) ||
                           (GFX_GOL_ObjectStateGet(
                                pEb,
                                GFX_GOL_EDITBOX_ENABLE_CARET_STATE)
                            )
                      )
                    {
                        GFX_ColorSet(pEb->hdr.pGolScheme->TextColor0);
                    }
                    else
                    {
                        GFX_ColorSet(pEb->hdr.pGolScheme->Color0);
                    }
                    state = DRAW_EDITBOX_CARET;

                    // no break here since it will always go to
                    // the DRAW_EDITBOX_CARET state
                }
                else
                {
                    state = DRAW_EDITBOX_START;
#ifdef GFX_LIB_CFG_USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH
                    GFX_DRIVER_CompleteDrawUpdate(  pEb->hdr.left,
                                                    pEb->hdr.top,
                                                    pEb->hdr.right,
                                                    pEb->hdr.bottom);
#endif
                    return (GFX_STATUS_SUCCESS);
                }
   
            case DRAW_EDITBOX_CARET:
            
                // draw the caret if required
                if(!GFX_BarDraw(
                        GFX_TextCursorPositionXGet(),
                        GFX_TextCursorPositionYGet(),
                        GFX_TextCursorPositionXGet() +
                            GFX_GOL_EDITBOX_CARET_WIDTH,
                        GFX_TextCursorPositionYGet() +
                            pEb->textHeight)
                  )
                {
                    return (GFX_STATUS_FAILURE);
                }
    
                state = DRAW_EDITBOX_START;

#ifdef GFX_LIB_CFG_USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH
                GFX_DRIVER_CompleteDrawUpdate(  pEb->hdr.left,
                                                pEb->hdr.top,
                                                pEb->hdr.right,
                                                pEb->hdr.bottom);
#endif
                return (GFX_STATUS_SUCCESS);
        } // switch()
        
    }//  while(1)

}
Exemplo n.º 17
0
void PIPDemo(void)
{
        int        x,y;

        GFX_XCHAR Title1[] = {'P','I','P',' ','D','e','m','o',0};
        GFX_XCHAR Title2[] = {'P','a','g','e',0};
        GFX_XCHAR Title3[] = {'S','t','a','r','t',0};

        while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE);
        while(GFX_PageSet(VISUAL_PAGE,0) == GFX_STATUS_FAILURE);
        GFX_ColorSet(BLACK);

        while(GFX_ScreenClear() == GFX_STATUS_FAILURE);

        while(GFX_PageSet(ACTIVE_PAGE,PIP_BUFFER) == GFX_STATUS_FAILURE);

        GFX_ColorSet(BLACK);
        while(GFX_ScreenClear() == GFX_STATUS_FAILURE);

        while(GFX_ImageDraw(0,0, (void*)&mouse) == GFX_STATUS_FAILURE);    //Draw Mouse in cursor area
        while(GFX_ImageDraw(15,0, (void*)&Pacman) == GFX_STATUS_FAILURE);   //Draw Pacman in cursor area
 
        while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE);

        GFX_FontSet((void *) &Monospaced_plain_36);
        GFX_ColorSet(WHITE);

        while(GFX_TextStringBoxDraw(0,40,0,0,(GFX_XCHAR*)Title1,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);
        while(GFX_TextStringBoxDraw(0,90,0,0,(GFX_XCHAR*)Title2,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

        GFX_GradientColorSet(WHITE,BLACK);
        GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN);
        while(GFX_BevelGradientDraw(200,125,300,165,5) == GFX_STATUS_FAILURE);
        GFX_ColorSet(BLACK);
        while(GFX_TextStringBoxDraw(195,115,0,0,(GFX_XCHAR*)Title3,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

        while(GFX_Layer(0, SET_PAGE, PIP_BUFFER, 0) == GFX_STATUS_FAILURE);
        while(GFX_Layer(0, SET_SIZE, 15, 15) == GFX_STATUS_FAILURE);
        while(GFX_Layer(0, SET_LAYER_START, 0, 0) == GFX_STATUS_FAILURE);
        while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE);

        x = 0;
        y = 224;

             while(x<280)
             {
             while(GFX_Layer(0, SET_PAGE_START, x, y) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE);
             y--;
             SYS_TMR_DelayMS(40);
             x+=5;
             }

             SYS_TMR_DelayMS(500);

             GFX_GradientColorSet(BLUE,BLACK);
             GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN);
             while(GFX_BevelGradientDraw(200,125,300,165,5)==GFX_STATUS_FAILURE);
             GFX_ColorSet(WHITE);
             while(GFX_TextStringBoxDraw(195,115,0,0,(GFX_XCHAR*)Title3,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE);

             SYS_TMR_DelayMS(1000);
             while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE);
             SYS_TMR_DelayMS(1000);
           
             x = GFX_MaxXGet()-50;
             GFX_ColorSet(BLACK);

             while(GFX_Layer(0, SET_SIZE, 45, 45) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, SET_LAYER_START, 15, 0) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE);

             while(x>5)
             {
             while(GFX_Layer(0, SET_PAGE_START, x, 32) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, SET_LAYER_START, 15, 0) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE);
             SYS_TMR_DelayMS(40);
             while(GFX_Layer(0, SET_PAGE_START, x-5, 32) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, SET_LAYER_START, 60, 0) == GFX_STATUS_FAILURE);
             while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE);
             SYS_TMR_DelayMS(40);
             x -= 10;
             }
              while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE);
}