Ejemplo n.º 1
0
static void TaskSD(void) {
  int br;
  SD_Config();
  SD_PrintSize();
  br = SD_ReadFile("0:/logo.dta", buf, 24000);
  printf("Bytes read: %d\r\n", br);
  GUI_DrawStreamedBitmap((void*) buf, 0, 0);
  while (1)
    OSTimeDlyHMSM(0, 1, 0, 0);
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       _Paint
*/
static void _Paint(BUTTON_Obj* pObj) {
  const char*s =NULL;
  int State = pObj->Widget.State;
  int PressedState = (State & BUTTON_STATE_PRESSED) ? 1:0;
  GUI_RECT rClient;
  GUI_RECT r;
  GUI_SetFont(pObj->pFont);
  GUI_DEBUG_LOG("BUTTON: Paint(..)\n");
  if (pObj->hpText) {
    s = (const char*) WM_HMEM2Ptr(pObj->hpText);
  }
  GUI_GetClientRect(&rClient);
  r = rClient;
/* Draw background */
  GUI_SetBkColor (pObj->aBkColor[PressedState]);
  GUI_SetColor   (pObj->aTextColor[PressedState]);
  GUI_Clear();
/* Draw bitmap.
   If we have only one, we will use it.
   If we have to we will use the second one (Index 1) for the pressed state
*/
  {
    int Index =0;
    if (pObj->apBitmap[1] && PressedState) {
      Index =1;   
    }
    if (pObj->apBitmap[Index]) {
      #if BUTTON_SUPPORT_STREAMED_BITMAP
        if(pObj->aBitmapIsStreamed[Index]) {
        #if BUTTON_SUPPORT_BITMAP_OFFSET
          GUI_DrawStreamedBitmap((const GUI_BITMAP_STREAM*)(pObj->apBitmap[Index]), pObj->xOffBitmap, pObj->yOffBitmap);
        #else
          GUI_DrawBitmapStreamed((const GUI_BITMAP_STREAM*)(pObj->apBitmap[Index]), 0,0);
        #endif
        } else
      #endif
      {
        #if BUTTON_SUPPORT_BITMAP_OFFSET
          GUI_DrawBitmap(pObj->apBitmap[Index], pObj->xOffBitmap[Index], pObj->yOffBitmap[Index]);
        #else
          GUI_DrawBitmap(pObj->apBitmap[Index], 0,0);
        #endif
      }
    }
  }
/* Draw the actual button (background and text) */  
  #if BUTTON_USE_3D
    if (pObj->Widget.State & BUTTON_STATE_PRESSED) {
      GUI_MoveRect(&r, BUTTON_3D_MOVE_X,BUTTON_3D_MOVE_Y);
    }
  #endif
  GUI_SetTextMode(GUI_TM_TRANS);
  GUI_DispStringInRect(s, &r, GUI_TA_HCENTER | GUI_TA_VCENTER);
/* Draw the 3D effect (if configured) */
  #if BUTTON_USE_3D
  if ((State & BUTTON_STATE_PRESSED) == 0) {
    WIDGET_EFFECT_3D_DrawUp();
  } else {
    GUI_SetColor(0x000000);  /// TBD: Use halftone
    GUI_DrawRect(rClient.y0, rClient.x0, rClient.x1, rClient.y1);
  }
  #endif
  /* Draw focus */
  if (State & BUTTON_STATE_FOCUS) {
    GUI_SetColor(GUI_BLACK);
    GUI_DrawFocusRect(&rClient, 2);
  }
}
Ejemplo n.º 3
0
/*********************************************************************
*
*       _Draw
*/
static void _Draw(const GUI_DRAW* pObj, int x, int y) {
  GUI_DrawStreamedBitmap((const GUI_BITMAP_STREAM *)pObj->Data.pData, x + pObj->xOff, y + pObj->yOff);
}