コード例 #1
0
ファイル: 2DGL_DrawPolygon.c プロジェクト: byxob/calendar
/*******************************************************************
*
*       _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);
  }
}
コード例 #2
0
static void DrawPrevious(int x, int y, int size)
{
	GUI_POINT pPoint[3]; 
	pPoint[0].x = (size/2);
	pPoint[0].y = 0;
	pPoint[1].x = (size/2);
	pPoint[1].y = size;
	pPoint[2].x = 0;
	pPoint[2].y = size / 2;
	
	GUI_FillPolygon(pPoint, 3, x, y);
	GUI_FillPolygon(pPoint, 3, x + size/2, y);
}
コード例 #3
0
void GUIDEMO_DemoPolygon(void) {
  int XMid = LCD_GetXSize() / 2;
  int YMid = LCD_GetYSize() / 2;
  GUIDEMO_ShowIntro("Arbitrary Polygons", 
                    "\nStandard and antialiased");
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_FontComic18B_ASCII);
  #if GUIDEMO_LARGE
    GUI_DispStringAt("Arbitrary\nPolygons", 0, 0);
  #endif
  GUI_FillPolygon(&_aArrow[0], 7, XMid - 50, YMid + 40);
  GUI_FillPolygon(&_aArrow[0], 7, XMid + 50, YMid + 40);
  GUI_SetColor(GUI_GREEN);
  GUI_FillPolygon(&_aTriangle[0], 3, XMid, YMid + 60);
  GUI_SetColor(GUI_WHITE);
  #if GUI_SUPPORT_AA
    GUI_AA_EnableHiRes();
    GUI_AA_FillPolygon(&_aiCursor[0], 4, XMid * 3, (YMid - 40) * 3);
  #endif
  GUIDEMO_Wait();
}
コード例 #4
0
static void DrawPlay(int x, int y, int size)
{
	GUI_POINT pPoint[3]; 
	pPoint[0].x = 0;
	pPoint[0].y = 0;
	pPoint[1].x = size;
	pPoint[1].y = size / 2;
	pPoint[2].x = 0;
	pPoint[2].y = size;
	
	GUI_FillPolygon(pPoint, 3, x, y);
}
コード例 #5
0
/*******************************************************************
*
*       _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);
    }
}
コード例 #6
0
ファイル: MEMDEV_Banding.c プロジェクト: dadianxukong/gps
/*******************************************************************
*
*       _DrawIt
*/
static void _DrawIt(void * pData) {
  tDrawItContext * pDrawItContext = (tDrawItContext *)pData;
  GUI_Clear();
  GUI_SetFont(&GUI_Font8x8);
  GUI_SetTextMode(GUI_TM_TRANS);
  /* draw background */
  GUI_SetColor(GUI_GREEN);
  GUI_FillRect(pDrawItContext->XPos_Text, 
               pDrawItContext->YPos_Text - 25,
               pDrawItContext->XPos_Text + 100,
               pDrawItContext->YPos_Text - 5);
  /* draw polygon */
  GUI_SetColor(GUI_BLUE);
  GUI_FillPolygon(pDrawItContext->aPointsDest, SIZE_OF_ARRAY(aPoints), 160, 120);
  /* draw foreground */
  GUI_SetColor(GUI_RED);
  GUI_FillRect(220 - pDrawItContext->XPos_Text, 
               pDrawItContext->YPos_Text + 5,
               220 - pDrawItContext->XPos_Text + 100,
               pDrawItContext->YPos_Text + 25);
}