本文整理汇总了C++中GUI_SetTextMode函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_SetTextMode函数的具体用法?C++ GUI_SetTextMode怎么用?C++ GUI_SetTextMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_SetTextMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _Paint
/*********************************************************************
*
* _Paint
*/
static void _Paint(PROGBAR_Handle hObj) {
PROGBAR_Obj* pObj;
GUI_RECT r, rInside, rClient, rText;
const char* pText;
char ac[5];
int tm, xPos;
pObj = PROGBAR_H2P(hObj);
WM_GetClientRect(&rClient);
GUI__ReduceRect(&rInside, &rClient, pObj->Widget.pEffect->EffectSize);
xPos = _Value2X(pObj, pObj->v);
pText = _GetText(pObj, ac);
GUI_SetFont(pObj->pFont);
_GetTextRect(pObj, &rText, pText);
tm = GUI_SetTextMode(GUI_TM_TRANS);
/* Draw left bar */
r = rInside;
r.x1 = xPos - 1;
WM_SetUserClipArea(&r);
_DrawPart(pObj, 0, rText.x0, rText.y0, pText);
/* Draw right bar */
r = rInside;
r.x0 = xPos;
WM_SetUserClipArea(&r);
_DrawPart(pObj, 1, rText.x0, rText.y0, pText);
WM_SetUserClipArea(NULL);
GUI_SetTextMode(tm);
WIDGET__EFFECT_DrawDownRect(&pObj->Widget, &rClient);
}
示例2: _Paint
/*********************************************************************
*
* _Paint
*/
static void _Paint(PROGBAR_Handle hObj) {
PROGBAR_Obj* pObj = PROGBAR_H2P(hObj);
WM_HWIN hWin = hObj;
int xsize = WM_GetWindowSizeX(hWin);
int ysize = WM_GetWindowSizeY(hWin);
int tm;
GUI_SetFont(pObj->pFont);
{
int x1;
int FontSizeY = GUI_GetFontSizeY();
int xText = 0;
int yText = (ysize-FontSizeY)/2;
GUI_RECT r;
int XSizeChar;
char ac[5]; /* Just enough for the percentage */
char*s = ac;
const char* pText;
if (pObj->hpText != WM_HMEM_NULL) {
pText = (const char*) WM_HMEM2Ptr(pObj->hpText);
} else {
GUI_AddDecMin((100*(I32)(pObj->v-pObj->Min))/(pObj->Max-pObj->Min), &s);
*s = '%';
*(s+1) =0;
pText = &ac[0];
}
/* Calculate text positions */
XSizeChar = GUI_GetStringDistX(pText);
x1 = _Value2X(hObj, pObj->v);
switch (pObj->TextAlign &GUI_TA_HORIZONTAL) {
case GUI_TA_CENTER:
xText = (xsize-XSizeChar)/2;
break;
case GUI_TA_LEFT:
xText = 0;
break;
case GUI_TA_RIGHT:
xText = xsize-XSizeChar-1;
break;
}
xText += pObj->XOff;
yText += pObj->YOff;
tm = GUI_SetTextMode(GUI_TM_TRANS);
/* Draw left bar */
r.x0=0; r.x1=x1-1; r.y0=0; r.y1 = GUI_YMAX;
WM_SetUserClipArea(&r);
_DrawPart(pObj, 0, xText, yText, pText);
/* Draw right bar */
r.x0=r.x1+1; r.x1=GUI_XMAX;
WM_SetUserClipArea(&r);
_DrawPart(pObj, 1, xText, yText, pText);
}
WM_SetUserClipArea(NULL);
GUI_SetTextMode(tm);
}
示例3: _Explain
/********************************************************************
*
* _Explain
*/
static void _Explain(void) {
int i;
GUI_SetTextMode(GUI_TM_XOR);
GUI_SetFont(&GUI_Font16B_ASCII);
GUI_DispStringHCenterAt("MEMDEV_Printing", 160, 0);
GUI_GotoXY(0,20);
GUI_SetFont(&GUI_Font6x8);
for (i = 0; i < GUI_COUNTOF(_acText); i++) {
GUI_DispString(_acText[i]);
GUI_DispNextLine();
}
GUI_SetTextMode(GUI_TM_TRANS);
}
示例4: main
int main(void)
{
//初始化系统时钟 使用外部50M晶振 PLL倍频到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
DisplayCPUInfo();
//初始化GUI
GUI_Init(&CHGUI_InitStruct1);
//设置背景色为黑色
GUI_SetBkColor(BLACK);
//普通字符显示模式
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
//设置前景色为红色
GUI_SetColor(LGRAY);
//将当前字体设置为CourierNew
GUI_SetFontFormName("FONT_CourierNew");
//打印字符
GUI_printf("HelloWorld\r\n");
//打印CHGUI版本号
GUI_printf("CHGUI_Version:%0.2f\r\n", (float)(GUI_VERSION/100));
//打印LCDID
GUI_printf("ID:%X\r\n", GUI_GetDeivceID());
while(1)
{
}
}
示例5: _Paint
/*********************************************************************
*
* _Paint
*/
static void _Paint(TEXT_Handle hObj, TEXT_Obj* pObj) {
const char * s;
GUI_RECT Rect;
GUI_USE_PARA(hObj);
LCD_SetColor(pObj->Props.TextColor);
GUI_SetFont (pObj->Props.pFont);
/* Fill with parents background color */
#if !TEXT_SUPPORT_TRANSPARENCY /* Not needed any more, since window is transparent*/
if (pObj->Props.BkColor == GUI_INVALID_COLOR) {
LCD_SetBkColor(WIDGET__GetBkColor(hObj));
} else {
LCD_SetBkColor(pObj->Props.BkColor);
}
GUI_Clear();
#else
if (!WM_GetHasTrans(hObj)) {
LCD_SetBkColor(pObj->Props.BkColor);
GUI_Clear();
}
#endif
/* Show the text */
if (pObj->hpText) {
s = (const char*) GUI_ALLOC_h2p(pObj->hpText);
GUI_SetTextMode(GUI_TM_TRANS);
WM_GetClientRect(&Rect);
GUI_DispStringInRectWrap(s, &Rect, pObj->Align, pObj->Props.WrapMode);
}
}
示例6: _DemoFade
/*******************************************************************
*
* _DemoFade
*/
static void _DemoFade(void) {
GUI_MEMDEV_Handle hMem0, hMem1;
GUI_RECT Rect = {0};
int x, y, v = 0, vz = 4;
int xSize, ySize;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
hMem0 = GUI_MEMDEV_CreateFixed(0, 0, 138, 65, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUICC_888); /* Contains the text */
hMem1 = GUI_MEMDEV_CreateFixed(0, 0, 138, 65, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUICC_888); /* Contains the bitmap */
x = (xSize - _bmSeggerLogoBlue.XSize) / 2;
y = (ySize - _bmSeggerLogoBlue.YSize) / 3 * 2;
Rect.x1 = _bmSeggerLogoBlue.XSize - 1;
Rect.y1 = _bmSeggerLogoBlue.YSize - 1;
/* Fill memory device with some text */
GUI_MEMDEV_Select(hMem0);
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_Font32B_ASCII);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringInRect("Fade in", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
GUI_DrawRectEx(&Rect);
/* Fill memory device with bitmap */
GUI_MEMDEV_Select(hMem1);
GUI_DrawBitmap(&_bmSeggerLogoBlue, 0, 0);
/* Set device positions */
GUI_MEMDEV_SetOrg(hMem0, x, y);
GUI_MEMDEV_SetOrg(hMem1, x, y);
GUI_MEMDEV_Select(0);
/* Fading loop */
while (1) {
GUI_MEMDEV_FadeDevices(hMem0, hMem1, 1000);
GUI_MEMDEV_FadeDevices(hMem1, hMem0, 1000);
}
}
示例7: MainTask
/*******************************************************************
*
* MainTask
*/
void MainTask(void) {
int xPos;
int yPos;
int xSize;
int i;
i = 0;
GUI_Init();
//
// Check if recommended memory for the sample is available
//
if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
GUI_ErrorOut("Not enough memory available.");
return;
}
xPos = LCD_GetXSize() / 2;
yPos = LCD_GetYSize() / 3;
GUI_SetTextMode(GUI_TM_REV);
GUI_SetFont(GUI_FONT_20F_ASCII);
GUI_DispStringHCenterAt("Hello world!", xPos, yPos);
GUI_SetFont(GUI_FONT_D24X32);
xSize = GUI_GetStringDistX("0000");
xPos -= xSize / 2;
yPos += 24 + 10;
while (1) {
GUI_DispDecAt( i++, xPos, yPos, 4);
if (i > 9999) {
i = 0;
}
}
}
示例8: utf16big_config
static void utf16big_config(txtEncodeParser *thiz, ParserConfig *config)
{
__u16 tmp_chinese;
config->p_dispstr = thiz->dispstr;
thiz->fd = config->fd;
thiz->txtLength = config->len;
thiz->viewWidth = config->xScrWidth;
// thiz->viewHeight = config->yScrHeight;
// thiz->lineofpage = config->lineofpage;
// thiz->FontHeight = config->FontHeight;
thiz->bufferTxtlen = 0;
thiz->start = config->startOffset;
if( thiz->start <= 2 )
thiz->bof = EPDK_TRUE;
else
thiz->bof = EPDK_FALSE;
thiz->eof = EPDK_FALSE;
thiz->pFont = config->pFont;
thiz->hlyr = config->hlyr;
GUI_LyrWinSel(thiz->hlyr);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(thiz->pFont);
GUI_SetFontMode(GUI_FONTMODE_8BPP256);
tmp_chinese = eLIBs_GB2312_to_Unicode(0xced2);
thiz->chinese_width = GUI_GetCharDistX(tmp_chinese);
}
示例9: GUIDEMO_ShowIntro
/*********************************************************************
*
* GUIDEMO_ShowIntro
*
* This function has to be called by every sample
*/
void GUIDEMO_ShowIntro(const char * acTitle, const char * acDescription) {
int xSize, ySize, xCenter, yCenter, FontDistY, TimeWait, i;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
xCenter = xSize >> 1;
yCenter = ySize >> 1;
GUIDEMO_HideInfoWin();
GUIDEMO_ShowControlWin();
GUI_Exec();
GUIDEMO_DrawBk(1);
GUI_SetColor(GUI_WHITE);
//
// Title
//
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(&GUI_FontRounded22);
GUI_DispStringHCenterAt(acTitle, xCenter, 60);
//
// Description
//
GUI_SetFont(&GUI_FontSouvenir18);
FontDistY = GUI_GetFontDistY();
GUI_DispStringHCenterAt(acDescription, xCenter, yCenter - FontDistY + 10);
//
// Determine time to wait
//
i = 0;
while (acDescription[i]) {
i++;
}
TimeWait = i * 80;
GUIDEMO_Wait(TimeWait);
}
示例10: key_s3c
void key_s3c(void)
{
int which_key,i;
while((rPDATG & 0xf0)==0xf0);
which_key=rPDATG&0xf0;
switch(which_key)
{
case 0xe0:
Led_Display(0x1);
point.y_point-=20;
if(point.y_point<20)
point.y_point=200;
break;
case 0xd0:
Led_Display(0x2);
point.x_point-=20;
if(point.x_point<20)
point.x_point=200;
break;
case 0xb0:
Led_Display(0x4);
if( map[point.y_map][point.x_map]==0 )
{
change_color();
map[point.y_map][point.x_map]=point.color;
draw_map();
if( if_won(point.y_map,point.x_map,point.color) )
{
GUI_SetTextMode(GUI_DM_TRANS); //设置为透明
GUI_SetFont(&GUI_Font8x16x1x2);
GUI_DispStringAt("win!",250,90);
for(i=0;i<20;i++)
GUI_Delay(1000);
map_initial();
GUI_SetDrawMode(GUI_DM_NORMAL);
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);
draw_net();
draw_point();
}
}
break;
case 0x70:
Led_Display(0x7);
/*
point.x_point+=20;
if(point.x_point>200)
point.x_point-=20;*/
break;
default :
break;
}
}
示例11: MYWIDGET_Callback
/*********************************************************************
*
* MYWIDGET_Callback
*/
void MYWIDGET_Callback(WM_MESSAGE * pMsg) {
MYWIDGET_Handle hWin;
GUI_PID_STATE * pState;
MYWIDGET_Obj MyWidget;
GUI_RECT WinRect;
int ColorIndex;
U8 Pressed;
hWin = pMsg->hWin;
WM_GetWindowRectEx(hWin, &WinRect);
GUI_MoveRect(&WinRect, -WinRect.x0, -WinRect.y0);
WM_GetUserData(hWin, &MyWidget, sizeof(MYWIDGET_Obj));
switch (pMsg->MsgId) {
case WM_PAINT:
if (WM_IsEnabled(hWin)) {
if (MyWidget.Pressed) {
ColorIndex = MYWIDGET_CI_PRESSED;
} else {
ColorIndex = MYWIDGET_CI_UNPRESSED;
}
} else {
ColorIndex = MYWIDGET_CI_DISABLED;
}
GUI_SetColor(MyWidget.aBkColor[ColorIndex]);
GUI_FillRectEx(&WinRect);
if (WM_HasFocus(hWin)) {
GUI_SetColor(MyWidget.FocusColor);
GUI_DrawRectEx(&WinRect);
}
GUI_SetColor(MyWidget.aTextColor[ColorIndex]);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringInRect(MyWidget.pText, &WinRect, GUI_TA_HCENTER | GUI_TA_VCENTER);
break;
case WM_TOUCH:
pState = (GUI_PID_STATE *)pMsg->Data.p;
if (pState) {
Pressed = pState->Pressed;
} else {
Pressed = 0;
}
if (MyWidget.Pressed != Pressed) {
MyWidget.Pressed = Pressed;
WM_SetUserData(hWin, &MyWidget, sizeof(MYWIDGET_Obj));
if (Pressed) {
WM_SetFocus(hWin);
}
WM_InvalidateWindow(hWin);
}
break;
case WM_SET_FOCUS:
if (pMsg->Data.v) {
pMsg->Data.v = 0;
}
WM_InvalidateWindow(hWin);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例12: MainTask
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
char acPath[_MAX_PATH];
char acCpyPath[_MAX_PATH];
GUI_Init();
//
// Set colors and text mode
//
GUI_SetBkColor (GUI_WHITE);
GUI_SetColor (GUI_BLACK);
GUI_SetTextMode(GUI_TM_TRANS);
//
// Get base path to font data
//
if (_GetPathToFontData(acPath) == 0) {
//
// Show features
//
while (1) {
//
// Get the local .\FontData\Standard directory of fonts
//
strcpy(acCpyPath, acPath);
strcat(acCpyPath, "\\FontData\\Standard");
//
// Page 1 - iType features
//
_IterateOverAllFiles(acCpyPath, "*.*", _PageOne);
//
// Page 2 - Linked font
//
// Get the local .\FontData\Linked directory of fonts
//
strcpy(acCpyPath, acPath);
strcat(acCpyPath, "\\FontData\\Linked");
_IterateOverAllFiles(acCpyPath, "*.ltt", _PageTwo);
//
// Page 3 - Edge Font
//
// Get the local \FontData\Edge directory of fonts
//
strcpy(acCpyPath, acPath);
strcat(acCpyPath, "\\FontData\\Edge");
_IterateOverAllFiles(acCpyPath, "*.ttc", _PageThree);
//
// Page 4 - Dynamic CSM adjustment
//
// Get the local \FontData\Edge directory of fonts
//
strcpy(acCpyPath, acPath);
strcat(acCpyPath, "\\FontData\\Edge");
_IterateOverAllFiles(acCpyPath, "*.ccc", _PageFour);
}
GUI_ITYPE_Done();
}
}
示例13: GL_SetDefault
void GL_SetDefault(void) {
GUI_SetBkColor(GUI_DEFAULT_BKCOLOR);
GUI_SetColor (GUI_DEFAULT_COLOR);
GUI_SetPenSize(1);
GUI_SetTextAlign(0);
GUI_SetTextMode(0);
GUI_SetDrawMode(0);
GUI_SetFont(GUI_DEFAULT_FONT);
GUI_SetLineStyle(GUI_LS_SOLID);
}
示例14: _cbStatus
/**
* @brief Callback routine of the status bar
* @param pMsg: pointer to a data structure of type WM_MESSAGE
* @retval None
*/
static void _cbStatus(WM_MESSAGE* pMsg) {
int xSize, ySize;
static uint8_t TempStr[50];
static WM_HTIMER hTimerTime;
WM_HWIN hWin;
hWin = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_CREATE:
hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
break;
case WM_DELETE:
WM_DeleteTimer(hTimerTime);
break;
case WM_TIMER:
WM_InvalidateWindow(hWin);
WM_RestartTimer(pMsg->Data.v, 0);
break;
case WM_PAINT:
xSize = WM_GetWindowSizeX(hWin);
ySize = WM_GetWindowSizeY(hWin);
/* Draw background */
GUI_SetColor(0x303030);
GUI_FillRect(0, 0, xSize, ySize - 3);
GUI_SetColor(0x808080);
GUI_DrawHLine(ySize - 2, 0, xSize);
GUI_SetColor(0x404040);
GUI_DrawHLine(ySize - 1, 0, xSize);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_WHITE);
GUI_SetFont(GUI_FONT_13B_ASCII);
/* Serial port*/
if (pdTRUE == BluetoothReady) {
GUI_DrawBitmap(&bmICON_BluetoothStatus, xSize - 155, 0);
}
if (pdTRUE == GPSReady) {
GUI_DrawBitmap(&bmICON_GPS_Status, xSize - 125, 0);
}
sprintf((char *)TempStr, "CPU : %d %%", FreeRTOS_GetCPUUsage());
if (75 > FreeRTOS_GetCPUUsage()) {
GUI_SetColor(GUI_WHITE);
}
else {
GUI_SetColor(GUI_RED);
}
GUI_DispStringAt((char *)TempStr, 4, 4);
GUI_SetColor(GUI_WHITE);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
示例15: _OnPaint
/*********************************************************************
*
* _OnPaint
*/
static void _OnPaint(WM_HMEM hScaleObj, GUI_RECT * pRectInvalid) {
GRAPH_SCALE_OBJ * pScaleObj;
pScaleObj = (GRAPH_SCALE_OBJ *)GUI_ALLOC_h2p(hScaleObj);
GUI_SetFont(pScaleObj->Props.pFont);
GUI_SetColor(pScaleObj->Props.TextColor);
GUI_SetTextMode(GUI_TM_TRANS);
if (pScaleObj->Flags & GRAPH_SCALE_CF_VERTICAL) {
_OnPaintVert(pScaleObj, pRectInvalid);
} else {
_OnPaintHorz(pScaleObj, pRectInvalid);
}
}