Beispiel #1
0
/*******************************************************************
*
*       _ShowComments
*
* Shows all comments of a GIF file
*/
static void _ShowComments(const char * pFile, int FileSize) {
  GUI_RECT Rect          = {80, 100, 239, 199};
  char     acBuffer[256] = {0};
  int      CommentCnt;
  /* Display sample information */
  GUI_SetFont(&GUI_Font8x16);
  GUI_ClearRect(0, 40, 319, 59);
  GUI_DispStringHCenterAt("Show all comments of a GIF file", 160, 40);
  /* Show all comments */
  GUI_ClearRect(0, 60, 319, 239);                                 /* Clear the image area */
  CommentCnt = 0;
  while (!GUI_GIF_GetComment(pFile, FileSize, (unsigned char *)acBuffer, sizeof(acBuffer), CommentCnt)) {
    char acNumber[12] = "Comment #0:";
    acNumber[9] = '0' + CommentCnt;
    GUI_DispStringHCenterAt(acNumber, 160, 80);
    GUI_SetBkColor(GUI_BLACK);
    GUI_SetColor(GUI_WHITE);
    GUI_ClearRectEx(&Rect);
    GUI_DispStringInRectWrap(acBuffer, &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER, GUI_WRAPMODE_WORD);
    GUI_SetBkColor(GUI_WHITE);
    GUI_SetColor(GUI_BLACK);
    GUI_Delay(4000);                                              /* Wait a while */
    CommentCnt++;
  }
}
Beispiel #2
0
/*******************************************************************
*
*       _DrawPolygon

  Draws polygons of different shapes and colors
*/
static void _DrawPolygon(void) {
  int y = 90;
  /* clear display */
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  /* display text */
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_DispStringAt("DrawPolygon - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringAt("using", 5, 40);
  GUI_DispStringAt("GUI_FillPolygon", 5, 55);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_DispStringAt("Polygons of arbitrary shape\nin any color", 160, y + 90);
  GUI_Delay(500);
  /* draw filled polygons */
  while (1) {
    GUI_ClearRect(100, y, 220, y + 85);
    GUI_SetColor(GUI_BLUE);
    GUI_FillPolygon (&_aPointArrow[0], 7, 160, y + 80);
    GUI_Delay(1000);
    GUI_ClearRect(100, y, 220, y + 85);
    GUI_SetColor(GUI_RED);
    GUI_FillPolygon (&_aPointStar[0], 8, 160, y + 45);
    GUI_Delay(1000);
    GUI_ClearRect(100, y, 220, y + 85);
    GUI_SetColor(GUI_GREEN);
    GUI_FillPolygon(&_aPointHexagon[0], 6, 160, y + 45);
    GUI_Delay(1000);
  }
}
/*******************************************************************
*
*       _DemoButton
*/
static void _DemoButton(void) {
  BUTTON_Handle hButton;
  int Stat = 0;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on phone button...", 160,80);
  GUI_Delay(500);
  /* Create the button */
  hButton = BUTTON_Create(142, 100, 36, 40, GUI_ID_OK, WM_CF_SHOW);
  /* Modify the button attributes */
  BUTTON_SetBkColor (hButton, 1, GUI_RED);
  /* Loop until button is pressed */
  while (1) {
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_1, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
    if (!_Wait(50)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_0, 2, 4);
    if (!_Wait(45)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_2, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_2, 2, 4);
    if (!_Wait(50)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_0, 2, 4);
    if (!_Wait(45)) break;
  }
  BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_1, 2, 4);
  BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
  GUI_ClearRect(0, 80, 319, 120);
  GUI_DispStringHCenterAt("You have answered the telephone", 160, 145);
  GUI_Delay(2000);
  /* Delete button object */
  BUTTON_Delete(hButton);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(400);
}
/*********************************************************************
*
*       _ExecFill
*/
static void _ExecFill(void * p) {
  GUI_POINT * pPoint;

  pPoint = (GUI_POINT *)p;
  GUI_SetBkColor(GUI_WHITE);
  GUI_ClearRect(1, 1, pPoint->x - 3, pPoint->y - 3);
  GUI_SetBkColor(GUI_BLACK);
  GUI_ClearRect(3, 3, pPoint->x - 1, pPoint->y - 1);
}
/*********************************************************************
*
*       _DispCursor
*/
static void _DispCursor(void) {
  int i, x, y;
  GUI_DispStringHCenterAt("Available cursors:", 160,  80);
  for (i = 0; i < 12; i++) {
    x = 160 - (_apCursor[i]->pBitmap->XSize / 2);
    y = 120 - (_apCursor[i]->pBitmap->YSize / 2);
    GUI_DrawBitmap(_apCursor[i]->pBitmap, x, y);
    GUI_DispStringHCenterAt(_aacCursorName[i], 160,145);
    GUI_Delay(750);
    GUI_ClearRect(0, 100, 319, 165);
  }
  GUI_ClearRect(0, 80, 319, 100);
  GUI_Delay(500);
}
/*********************************************************************
*
*       _DemoCursor
*/
static void _DemoCursor(void) {
  GUI_SetBkColor(GUI_BLUE);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("CURSOR_Sample - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  while (1) {
    _DispCursor();
    GUI_ClearRect(0, 60, 319, 200);
    _MoveCursor();
    GUI_ClearRect(0, 60, 319, 200);
  }
}
Beispiel #7
0
/*********************************************************************
*
*       _GetFileName
*
* Purpose:
*   Returns the file name of the XBF file to be used
*/
static void _GetFileName(char * pPath, unsigned MaxSize) {
  WM_HWIN hWin;
  
  /* Set default value on first call */
  if (!strlen(pPath)) {
    strcpy(pPath, "Sample\\GUI\\FONT_ShowXBF\\ExtBinFont.xbf");
  }
  /* Display small hint */
  GUI_SetFont(&GUI_Font10_ASCII);
  GUI_DispStringHCenterAt("Please enter the file name of the XBF-file:", 160, 80);
  /* Create edit widget */
  hWin = EDIT_Create(10, 120, 300, 20, 0, MaxSize, WM_CF_SHOW);
  EDIT_SetText(hWin, pPath);
  WM_SetFocus(hWin);
  /* Wait until GUI_KEY_ENTER has been pressed */
  while (GUI_GetKey() != GUI_KEY_ENTER) {
    GUI_Delay(100);
  }
  /* Get filename from EDIT widget */
  EDIT_GetText(hWin, pPath, MaxSize);
  /* Create edit widget */
  WM_DeleteWindow(hWin);
  /* Clear screen */
  GUI_ClearRect(0, 40, 319, 239);
}
Beispiel #8
0
static void _Paint(FRAMEWIN_Obj* pObj) {
  WM_HWIN hWin = WM_GetActiveWindow();
  int xsize = WM_GetWindowSizeX(hWin);
  int ysize = WM_GetWindowSizeY(hWin);
  int FrameSize = pObj->FrameSize;
  GUI_RECT rClient; GUI_GetClientRect(&rClient);
  GUI_SetFont(pObj->pFont);
/* Draw Title */
  GUI_SetBkColor((pObj->Widget.State & WIDGET_STATE_CHILD_HAS_FOCUS) ? pObj->BarColor[1] : pObj->BarColor[0]);
  GUI_SetColor  (pObj->TextColor);
  GUI_SetTextAlign(pObj->TextAlign);
	GUI_ClearRect(FrameSize,FrameSize, xsize-1-FrameSize, FrameSize+pObj->rClient.y0-1);
  GUI_DispStringAt( pObj->pText,
                   FrameSize+pObj->XOff,
                   FrameSize+pObj->YOff);
/* Draw Frame */
  GUI_SetColor  (FRAMEWIN_FRAMECOLOR_DEFAULT);  /* pObj->BarColor[1]*/
  GUI_FillRect  (0, 0, xsize-1, FrameSize-1);
	GUI_FillRect  (0, 0, pObj->rClient.x0-1, ysize-1);
	GUI_FillRect  (pObj->rClient.x1+1, 0, xsize-1, ysize-1);
  GUI_FillRect  (0, pObj->rClient.y1+1, xsize-1, ysize-1);
  GUI_FillRect  (0, pObj->TitleHeight+FrameSize,
                    xsize-1, pObj->TitleHeight+2*FrameSize-1);
/* Draw Client area */
  WM_SetUserClipArea(&pObj->rClient);
  /*GUI_SetBkColor(pObj->ClientColor);
  GUI_Clear();*/
  WM_SetUserClipArea(NULL);
/* Draw the 3D effect (if configured) */
  #if FRAMEWIN_USE_3D
    WIDGET_EFFECT_3D_DrawUp();
  #endif
  
}
/*******************************************************************
*
*       _Label

  Labels the x & y-axis
*/
static void _Label(void) {
  int x, y;
  GUI_SetBkColor(GUI_RED);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("MEMDEV_DrawGraph - Sample", 160, 5);
  GUI_SetPenSize(1);
  GUI_ClearRect(0, (LCD_YSIZE - 21) - YSIZE, (LCD_XSIZE - 1), (LCD_YSIZE - 1));
  GUI_DrawRect(18, (LCD_YSIZE - 21) - YSIZE, (LCD_XSIZE - 1), (LCD_YSIZE - 20));
  GUI_SetFont(&GUI_Font6x8);
  for (x = 0; x < (LCD_XSIZE - 20); x += 40) {
    int xPos = x + 18;
    GUI_DrawVLine(xPos, (LCD_YSIZE - 20), (LCD_YSIZE - 14));
    GUI_DispDecAt(x / 40, xPos - 2, (LCD_YSIZE - 9), 1);
  }
  for (y = 0; y < YSIZE / 2; y += 20) {
    int yPos = (LCD_YSIZE - 20) - YSIZE / 2 + y;
    GUI_DrawHLine(yPos, 13, 18);
    if (y) {
      GUI_GotoXY(1, yPos - 4);
      GUI_DispSDec(-y / 20, 2);
      yPos = (LCD_YSIZE - 20) - YSIZE / 2 - y;
      GUI_DrawHLine(yPos, 13, 18);
      GUI_GotoXY(1, yPos - 4);
      GUI_DispSDec(y / 20, 2);
    } else {
      GUI_DispCharAt('0', 7, yPos - 4);
    }
  }
}
/*******************************************************************
*
*       _DemoSineWave
*/
static void _DemoSineWave(void) {
  PARAM Param;
  I16 * pStart;
  int t0, Cnt = 0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Sine wave", 20, 55);
  pStart = GUI_ALLOC_h2p(hMem);
  _GetSineData(pStart, 405);
  GUI_SetFont(&GUI_Font6x8);
  t0 = GUI_GetTime();
  while((GUI_GetTime() - t0) < 10000) {
    int t1, tDiff2;
    if (Cnt++ % 90) {
      Param.aY++;
    } else {
      Param.aY = pStart;
    }
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw2, &Param, 0, 0);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
  }
  GUI_ALLOC_Free(hMem);
}
/*******************************************************************
*
*       _DemoRandomGraph
*/
static void _DemoRandomGraph(void) {
  PARAM Param;
  int tDiff, t0;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE - 20) * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Random graph", 20, 55);
  GUI_Lock();
  Param.aY = GUI_ALLOC_h2p(hMem);
  GUI_SetFont(&GUI_Font6x8);
  t0 = GUI_GetTime();
  while((tDiff = (GUI_GetTime() - t0)) < 10000) {
    int t1, tDiff2;
    _GetRandomData(Param.aY, tDiff, (LCD_XSIZE - 20));
    t1 = GUI_GetTime();
    GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
    tDiff2 = GUI_GetTime() - t1;
    if (tDiff2 < 100) {
      GUI_Delay(100 - tDiff2);
    }
  }
  GUI_Unlock();
  GUI_ALLOC_Free(hMem);
}
Beispiel #12
0
static void _Label(void) {
  int x, y;
  GUI_SetPenSize(1);
  GUI_ClearRect(0, (LCD_GetYSize() - 21) - _YSize, (LCD_GetXSize() - 1), (LCD_GetYSize() - 1));
  GUI_DrawRect(18, (LCD_GetYSize() - 21) - _YSize, (LCD_GetXSize() - 1), (LCD_GetYSize() - 20));
  GUI_SetFont(&GUI_Font6x8);
  for (x = 0; x < (LCD_GetXSize() - 20); x += 40) {
    int xPos = x + 18;
    GUI_DrawVLine(xPos, (LCD_GetYSize() - 20), (LCD_GetYSize() - 14));
    GUI_DispDecAt(x / 40, xPos - 2, (LCD_GetYSize() - 9), 1);
  }
  for (y = 0; y < _YSize / 2; y += 20) {
    int yPos = (LCD_GetYSize() - 20) - _YSize / 2 + y;
    GUI_DrawHLine(yPos, 13, 18);
    if (y) {
      GUI_GotoXY(1, yPos - 4);
      GUI_DispSDec(-y / 20, 2);
      yPos = (LCD_GetYSize() - 20) - _YSize / 2 - y;
      GUI_DrawHLine(yPos, 13, 18);
      GUI_GotoXY(1, yPos - 4);
      GUI_DispSDec(y / 20, 2);
    } else {
      GUI_DispCharAt('0', 7, yPos - 4);
    }
  }
}
static void _Show(const char* s0, const char* s1) {
  GUIDEMO_SetColor(GUI_WHITE);
  #if (LCD_YSIZE < 160)
    GUI_SetFont(&GUI_Font8_ASCII);
  #else
    GUI_SetFont(&GUI_Font13B_ASCII);
  #endif
  GUI_DispString("\n");
  #if (LCD_YSIZE < 128)
    GUIDEMO_Delay(200);
    GUI_GotoXY(0, LCD_YSIZE / 2 - 6);
    GUI_ClearRect(0, 24, LCD_XSIZE - 1, LCD_YSIZE - 1);
    GUIDEMO_Delay(200);
  #endif
  GUI_DispString(s0);
  GUIDEMO_Delay(500);
  #if GUIDEMO_LARGE
    GUI_GotoX(110);
    GUIDEMO_SetColor(GUI_GREEN);
  #else
    GUI_GotoX(100);
    GUIDEMO_SetColor(GUI_BLUE);
  #endif
  #if (LCD_XSIZE < 320)
    GUI_DispString("\n");
    #if (LCD_XSIZE < 200)
      GUI_GotoX(10);
    #else
      GUI_GotoX(LCD_XSIZE / 6);
    #endif
  #endif
  GUI_DispString(s1);
  GUIDEMO_Delay(1500);
}
Beispiel #14
0
/* Invalidate, using window coordinates */
static void WM_InvalidateBWin1(WM_HWIN hWin, const GUI_RECT*pRect) {
  GUI_RECT r;
  WM_Obj* pWin = WM_H2P(hWin);
  WM__GetClientRectWin(pWin, &r);
  if (pRect)
    GUI__IntersectRect(&r, pRect);
  if (WM__RectIsNZ(&r)) {
    if (pWin->Status & WM_SF_INVALID) {
      GUI_MergeRect(&pWin->InvalidRect, &pWin->InvalidRect, &r);
    } else {
      pWin->InvalidRect = r;
      pWin->Status |= WM_SF_INVALID;
      WM__NumInvalidWindows++;
      /* Debug code: shows invalid areas */
      #if (WM_SHOW_INVALID)
      {
        GUI_CONTEXT Context = GUI_Context;
        WM_SelectWindow(hWin);
        GUI_SetBkColor(GUI_GREEN);
        GUI_ClearRect(r.x0, r.y0, r.x1, r.y1);
        GUI_Context = Context;
      }
      #endif


    }
  }
}
/*********************************************************************
*
*       _LabelGraph
*/
static void _LabelGraph(void) {
  GUI_RECT Rect;
  int      x;
  int      y;
  int      xSize;
  int      ySize;

  WM_GetClientRect(&Rect);
  xSize = Rect.x1;
  ySize = Rect.y1;
  GUI_SetBkColor(_ColorBackGround);
  GUI_Clear();
  GUI_SetColor(_ColorLabel);
  GUI_SetPenSize(1);
  GUI_ClearRect(0, (ySize - 21) - ySize, (xSize - 1), (ySize - 1));
  GUI_DrawRect(25, 0, xSize, ySize - 20);
  GUI_SetFont(&GUI_Font6x8);
  for (x = 0; x < (xSize - 20); x += 40) {
    int xPos = x + 25;
    GUI_DrawVLine(xPos, (ySize - 20), (ySize - 14));
    GUI_DispDecAt(x / 40, xPos - 2, (ySize - 9), 1);
  }
  for (y = 0; y < ySize - 20; y += 20) {
    int yPos = ySize - 20 - y;
    GUI_DrawHLine(yPos, 20, 25);
    GUI_GotoXY(1, yPos - 4);
    GUI_DispDecSpace(_TempMin + y, 3);
  }
}
/*******************************************************************
*
*       _DrawGraph
*/
static void _DrawGraph(void) {
  GUI_RECT Rect;
  int      xSize;
  int      ySize;
  int      x;
  int      y;

  WM_GetClientRect(&Rect);
  xSize = Rect.x1;
  ySize = Rect.y1;
  GUI_SetBkColor(GUI_BLACK);
  GUI_ClearRect(26, 1, 302, ySize - 21);
  GUI_SetColor(_ColorGrid);
  for (y = 20; y < (ySize - 21); y += 20) {
    int yPos = ySize - 20 - y;
    GUI_DrawHLine(yPos, 26, 302);
  }
  for (x = 40; x < (xSize - 25); x += 40) {
    int xPos = x + 25;
    GUI_DrawVLine(xPos, 1, ySize - 21);
  }
  GUI_SetColor(_ColorTemp1);
  GUI_DrawGraph(_aTemp1, GUI_COUNTOF(_aTemp1), 26, ySize - 121);
  GUI_SetColor(_ColorTemp2);
  GUI_DrawGraph(_aTemp2, GUI_COUNTOF(_aTemp2), 26, ySize - 121);
}
/*******************************************************************
*
*       _Draw

  This function draws the non high resolution pointer
*/
static void _Draw(void * p) {
  PARAM * pParam = (PARAM *)p;
  if (pParam->AutoInfo.DrawFixed) {
    GUI_ClearRect(160, 60, 259, 159);
  }
  GUI_AA_FillPolygon(pParam->aPoints, countof(_aPointer), 165, 155);
}
Beispiel #18
0
__u32  TxtLayer_ClearTxtItem(txtlayer_man_t *ptxtlayer,__u32 x,__u32 y)
{
   #if 0
   void *               base;
   __u32                bpp;
   __u32                size;
    
   bpp  = TxtLayer_GetBPP(ptxtlayer);

   size = (ptxtlayer->txtlist->head->rect.width * 
            ptxtlayer->txtlist->head->rect.height * ptxtlayer->txtlist->bpp + 7)/8;
   
   
   base = (void *)((__u32)ptxtlayer->txtbuffer->buffer + 
            (ptxtlayer->txtbuffer->rectsz.width * y *bpp + 7)/8 + 
            (x * bpp +7)/8);
   
   eLIBs_memset(base, 0x00, size);
  #else
    GUI_LyrWinSel(ptxtlayer->layer);
    GUI_SetBkColor(ptxtlayer->bk_color);
    GUI_ClearRect(x,y,x + ptxtlayer->txtbuffer->rectsz.width - 1,y + ptxtlayer->txtlist->head->rect.height - 1);
  #endif
   
   return 0;
}
/*******************************************************************
*
*       _DemoListBox
*/
static void _DemoListBox(void) {
  int            i;
  int            Entries;
  int            ySize;
  LISTBOX_Handle hListBox;
  
  Entries = GUI_COUNTOF(_ListBox) - 1;
  ySize   = GUI_GetYDistOfFont(&GUI_Font13B_1) * Entries;
  //
  // Create the listbox
  //
  hListBox = LISTBOX_Create(_ListBox, 130, 80, 60, ySize, WM_CF_SHOW);
  //
  // Change current selection of the listbox
  //
  for (i = 0; i < Entries-1; i++) {
    GUI_Delay(500);
    LISTBOX_IncSel(hListBox);
    WM_ExecIdle();
	}
  for (i = 0; i < Entries-1; i++) {
    GUI_Delay(500);
    LISTBOX_DecSel(hListBox);
    WM_ExecIdle();
	}
  GUI_Delay(750);
  //
  // Delete listbox widget
  //
  LISTBOX_Delete(hListBox);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(750);
}
Beispiel #20
0
/********************************************************************
*
*       _Draw
*
* Function description
*   Draws some coloured output to the current device (display or memory device)
*/
static void _Draw(void) {
  int i;
  GUI_SetBkColor(GUI_YELLOW);
  GUI_ClearRect(0, 75, 319, 138);
  GUI_SetColor(GUI_RED);
  GUI_SetFont(&GUI_Font32B_ASCII);
  GUI_DispStringHCenterAt("Printing demo", 160, 75);
  for (i = 0; i < 12; i += 2) {
    GUI_SetColor(GUI_GREEN);
    GUI_DrawRect(5 + i, 80 + i, 50 - i, 101 - i);
    GUI_SetColor(GUI_BLUE);
    GUI_DrawRect(269 + i, 80 + i, 314 - i, 101 - i);
  }
  for (i = 0; i < 32; i += 8) {
    GUI_SetColor(GUI_BLUE);
    GUI_FillRect(0, 107 + i, 319, 110 + i);
    GUI_SetColor(GUI_YELLOW);
    GUI_FillRect(0, 111 + i, 319, 114 + i);
  }
  i = 8;
  _DrawBitmap(&bmTestPicture1, i +   0, 111, 0, 0);
  _DrawBitmap(&bmTestPicture1, i +  35, 111, 1, 0);
  _DrawBitmap(&bmTestPicture1, i +  70, 111, 0, 1);
  _DrawBitmap(&bmTestPicture2, i + 105, 111, 0, 0);
  _DrawBitmap(&bmTestPicture2, i + 140, 111, 1, 0);
  _DrawBitmap(&bmTestPicture4, i + 175, 111, 0, 0);
  _DrawBitmap(&bmTestPicture4, i + 210, 111, 1, 0);
  _DrawBitmap(&bmTestPicture8, i + 245, 111, 0, 0);
  _DrawBitmap(&bmTestPicture8, i + 280, 111, 1, 0);
}
Beispiel #21
0
/*******************************************************************
*
*       _DemoButton
*/
static void _DemoButton(void) {
  BUTTON_Handle hButton;
  int Stat = 0;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on phone button...", 160,80);
  GUI_Delay(500);
  /* Create the button */
  hButton = BUTTON_Create(142, 100, 36, 40, GUI_ID_OK, WM_CF_SHOW);
  /* Modify the button attributes */
  BUTTON_SetBkColor(hButton, 1, GUI_RED);
  BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
  BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
  /* Loop until button is pressed */
  while(GUI_GetKey() != GUI_ID_OK) {
    if (Stat ^= 1) {
      BUTTON_SetState(hButton, 
                      BUTTON_STATE_HASFOCUS | BUTTON_STATE_INACTIVE);
    } else {
      BUTTON_SetState(hButton, 
                      BUTTON_STATE_HASFOCUS | BUTTON_STATE_PRESSED);
    }
    GUI_Delay(500);
  }
  /* Delete button object */
  BUTTON_Delete(hButton);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(1750);
}
Beispiel #22
0
/*******************************************************************
*
*       _DemoListBox
*/
void _DemoListBox(void) {
  int i;
  int Entries = GUI_COUNTOF(_ListBox) - 1;
  LISTBOX_Handle hListBox;
  int xSize = LCD_GetXSize();
  //int ySize = GUI_GetYDistOfFont(&GUI_Font13B_1) * Entries;
  int ySize = LCD_GetYSize();
  /* Create the listbox */
  hListBox = LISTBOX_Create(_ListBox, 0, 0, xSize, ySize, WM_CF_SHOW);
  /* Change current selection of the listbox */
  for (i = 0; i < Entries-1; i++) {
    GUI_Delay(500);
    LISTBOX_IncSel(hListBox);
    WM_ExecIdle();
	}
  GUI_Delay(75000);
  for (i = 0; i < Entries-1; i++) {
    GUI_Delay(500);
    LISTBOX_DecSel(hListBox);
    WM_ExecIdle();
	}
  GUI_Delay(7500);
  /* Delete listbox widget */
  LISTBOX_Delete(hListBox);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(750);
}
/*********************************************************************
*
*       _DrawJPEG
*/
static void _DrawJPEG(const char * sFilename) {
    int XPos, YPos, XSize, YSize, nx, ny, n;
    HANDLE hFile;
    GUI_JPEG_INFO Info;
    hFile = CreateFile(sFilename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    GUI_JPEG_GetInfoEx(_GetData, &hFile, &Info);
    GUI_ClearRect(0, 60, 319, 239);
    nx = 320000 / Info.XSize;
    ny = 180000 / Info.YSize;
    if (nx < ny) {
        n = nx;
    } else {
        n = ny;
    }
    XSize = Info.XSize * n / 1000;
    YSize = Info.YSize * n / 1000;
    XPos = (320 - XSize) / 2;
    YPos = (180 - YSize) / 2 + 60;
    if (n > 1000) {
        int temp=0;
    }
    GUI_JPEG_DrawScaledEx(_GetData, &hFile, XPos, YPos, n, 1000);
    GUI_Delay(1000);
    CloseHandle(hFile);
}
/*******************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE* pMsg) {
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_ClearRect(0, 50, 319, 239);
  default:
    WM_DefaultProc(pMsg);
  }
}
Beispiel #25
0
/*********************************************************************
*
*       _DrawBkCircle
*/
static void _DrawBkCircle(int DrawLogo) {
  static GUI_MEMDEV_Handle   hMemStretch;
  GUI_MEMDEV_Handle          hMemGradient;
  GUI_MEMDEV_Handle          hMemCircle;
  GUI_MEMDEV_Handle          hMemOld;
  int                        CircleWidth;
  int                        ySizeV;
  int                        xSize;
  int                        ySize;
  int                        i;
  U32                      * pData;

  xSize  = LCD_GetXSize();
  ySize  = LCD_GetYSize();
  ySizeV = LCD_GetVYSize();
  if (ySizeV > ySize) {
    GUI_SetBkColor(BK_COLOR_1);
    GUI_ClearRect(0, 0, xSize, ySizeV);
  }
  if (hMemStretch == 0) {
    CircleWidth  = (CIRCLE_RADIUS << 1) + 1;
    hMemCircle   = GUI_MEMDEV_CreateFixed(0, 0, CircleWidth, CircleWidth,   GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
    hMemStretch  = GUI_MEMDEV_CreateEx   (0, 0, xSize,       ySize,         GUI_MEMDEV_NOTRANS);
    hMemGradient = GUI_MEMDEV_CreateFixed(0, 0, 1,           CIRCLE_RADIUS, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888);
    //
    // Initialize background
    //
    hMemOld = GUI_MEMDEV_Select(hMemCircle);
    GUI_SetBkColor(BK_COLOR_1);
    GUI_Clear();
    //
    // Create Gradient
    //
    GUI_MEMDEV_Select(hMemGradient);
    GUI_DrawGradientV(0, 0, 0, CIRCLE_RADIUS, BK_COLOR_0, BK_COLOR_1);
    //
    // Get color and draw circles
    //
    pData = (U32 *)GUI_MEMDEV_GetDataPtr(hMemGradient);
    GUI_MEMDEV_Select(hMemCircle);
    for (i = 0; i < CIRCLE_RADIUS; i++, pData++) {
      GUI_SetColor(*pData);
      GUI_DrawCircle(CIRCLE_RADIUS, CIRCLE_RADIUS, i);
    }
    //
    // Stretch and display
    //
    GUI_MEMDEV_Select(hMemStretch);
    GUI_MEMDEV_DrawPerspectiveX(hMemCircle, 0, 0, ySize, ySize, xSize, 0);
    GUI_MEMDEV_Delete(hMemCircle);
    GUI_MEMDEV_Delete(hMemGradient);
    GUI_MEMDEV_Select(hMemOld);
  }
  GUI_MEMDEV_Write(hMemStretch);
  if (DrawLogo) {
    GUI_DrawBitmap(&bmSTLogo70x35, LOGO_DIST_BORDER, LOGO_DIST_BORDER);
  }
}
Beispiel #26
0
static void _ShowText(const char * sText) {
  int lcd_xsize;
  lcd_xsize = LCD_GetXSize();
  GUIDEMO_SetColor(GUI_WHITE);
  GUIDEMO_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 0, lcd_xsize, 60);
  GUI_SetFont(&GUI_FontComic18B_ASCII);
  GUI_DispStringAt(sText, 10, 20);
}
/*******************************************************************
*
*       _DrawHiRes

  This function draws the high resolution pointer
*/
static void _DrawHiRes(void * p) {
  PARAM * pParam = (PARAM *)p;
  if (pParam->AutoInfo.DrawFixed) {
    GUI_ClearRect(60, 60, 159, 159);
  }
  GUI_AA_FillPolygon(pParam->aPoints, 
                     countof(_aPointer), 
                     65  * pParam->Factor, 
                     155 * pParam->Factor);
}
/*******************************************************************
*
*       _cbWindow

  This is the callback for the window. A callback was used
  for memory devices.
*/
static void _cbWindow(WM_MESSAGE* pMsg) {
    switch (pMsg->MsgId) {
    case WM_PAINT:
        GUI_SetBkColor(_color_a);
        GUI_ClearRect( 0, 0, 250, 14);
        GUI_SetBkColor(_color_b);
        GUI_ClearRect( 0, 15, 250, 29);
        GUI_SetBkColor(GUI_BLACK);
        GUI_ClearRect( 0, 30, 250, 60);
        GUI_SetColor(_color_c);
        GUI_FillPolygon(_aPolygon, POLY_POINTS, _pos_x1, _pos_y1);
        GUI_AA_FillPolygon(_aPolygon, POLY_POINTS, _pos_x2, _pos_y2);
        GUI_AA_EnableHiRes();
        GUI_AA_FillPolygon(_aPolygonHiRes, POLY_POINTS, _pos_x3, _pos_y3);
        GUI_AA_DisableHiRes();
        break;
    default:
        WM_DefaultProc(pMsg);
    }
}
Beispiel #29
0
static void _ShowText(const char * sText) {
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  #if GUIDEMO_LARGE
    GUI_ClearRect(0, 0, LCD_XSIZE, 60);
    GUI_SetFont(&GUI_FontComic18B_ASCII);
    GUI_DispStringAt(sText, 10, 20);
  #else
    sText = sText;  /* Avoid warning */
  #endif
}
Beispiel #30
0
void DisplayBattery(void)
{
    u16 ADC1_value; 
    u32 temp_color;
    ADC1_value = ADC_GetConversionValue(ADC1); 
    GUI_SetFont(&GUI_Font6x8);
    GUI_SetColor(GUI_WHITE);
    GUI_DispStringAt("RFID",3,0);
    temp_color=GUI_GetColor();
		GUI_SetColor(GUI_GREEN);
    if (ADC1_value > 2500)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    }
    else if (ADC1_value > 2350)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,86,6);
    }
    else if(ADC1_value > 2300)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,90,6);
    }
    else
    {
    	GUI_SetColor(GUI_RED);
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,94,6);
    }
    GUI_SetColor(temp_color);
    GUI_SetFont(&GUI_NOW_FONT);
}