本文整理汇总了C++中GUI_ClearRect函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_ClearRect函数的具体用法?C++ GUI_ClearRect怎么用?C++ GUI_ClearRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_ClearRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ShowComments
/*******************************************************************
*
* _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++;
}
}
示例2: _DrawPolygon
/*******************************************************************
*
* _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);
}
}
示例3: _DemoButton
/*******************************************************************
*
* _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);
}
示例4: _ExecFill
/*********************************************************************
*
* _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);
}
示例5: _DispCursor
/*********************************************************************
*
* _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);
}
示例6: _DemoCursor
/*********************************************************************
*
* _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);
}
}
示例7: _GetFileName
/*********************************************************************
*
* _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);
}
示例8: _Paint
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
}
示例9: _Label
/*******************************************************************
*
* _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);
}
}
}
示例10: _DemoSineWave
/*******************************************************************
*
* _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);
}
示例11: _DemoRandomGraph
/*******************************************************************
*
* _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);
}
示例12: _Label
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);
}
}
}
示例13: _Show
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);
}
示例14: WM_InvalidateBWin1
/* 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
}
}
}
示例15: _LabelGraph
/*********************************************************************
*
* _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);
}
}