本文整理汇总了C++中GrContextBackgroundSet函数的典型用法代码示例。如果您正苦于以下问题:C++ GrContextBackgroundSet函数的具体用法?C++ GrContextBackgroundSet怎么用?C++ GrContextBackgroundSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrContextBackgroundSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearRightButton
void ClearRightButton( tContext *context ){
GrContextForegroundSet( context, ClrWhite);
GrContextBackgroundSet( context, ClrBlack);
GrRectFill( context, &myRectangleBotRight);
GrContextForegroundSet( context, ClrBlack);
GrContextBackgroundSet( context, ClrWhite);
}
示例2: window_drawtime
void window_drawtime(tContext *pContext, long y, uint8_t times[3], uint8_t selected)
{
char data[3];
data[0] = data[1] = '0';
data[2] = ':';
#define SPACING 3
uint8_t height = GrStringHeightGet(pContext);
uint8_t width_all = GrStringWidthGet(pContext, data, 3) + 10;
uint8_t width_digit = GrStringWidthGet(pContext, data, 2) + 4;
long startx = (LCD_WIDTH - width_all - width_all - width_digit) / 2;
if (startx < 0) startx = 0;
for(int i = 0; i < 3; i++)
{
data[0] = '0' + times[i] / 10;
data[1] = '0' + times[i] % 10;
GrContextForegroundSet(pContext, ClrWhite);
GrContextBackgroundSet(pContext, ClrBlack);
if (selected & (1 << i))
window_selecttext(pContext, data, 2, startx + SPACING + i * width_all, y);
else
GrStringDraw(pContext, data, 2, startx + SPACING + i * width_all, y, 0);
if (i != 2)
{
GrContextForegroundSet(pContext, ClrWhite);
GrContextBackgroundSet(pContext, ClrBlack);
GrStringDraw(pContext, ":", 1, startx + SPACING + width_digit + i * width_all, y, 0);
}
}
}
示例3: PrintReminder
void PrintReminder(tContext *context, y_menus f_menuChoice){
char outString[32] = "";
unsigned char text_start = 18;
// Draw top and bottom banner and buttons
LoadLeftButton( context , "BACK");
LoadMiddleButton( context , "SEL");
//LoadRightButton("");
// Menu options
GrStringDraw( context, "Create Reminder", AUTO_STRING_LENGTH, 5, 18, OPAQUE_TEXT);
GrStringDraw( context, "Remove Reminder", AUTO_STRING_LENGTH, 5, 31, OPAQUE_TEXT);
// Highlight selected item
switch (f_menuChoice) {
case Reminder_Create:
text_start = 18;
strcpy(outString, "Create Reminder");
break;
case Reminder_Remove:
text_start = 31;
strcpy(outString, "Remove Reminder");
break;
default: break;
}
GrContextForegroundSet(context, ClrWhite); //ClrBlack this affects the highlight color
GrContextBackgroundSet(context, ClrBlack); //ClrWhite this affects the text color in the highlight
GrStringDraw(context, outString, AUTO_STRING_LENGTH, 5, text_start, OPAQUE_TEXT);
GrContextForegroundSet(context, ClrBlack);
GrContextBackgroundSet(context, ClrWhite);
}
示例4: UpdateWindow
//*****************************************************************************
//
// This function updates the contents of the directory text window.
//
// \param None.
//
// This function is will update the state of the directory window. This can
// be the result of a DirUpdate() call which completely changed the contents
// of the window, or a selection changed and the screen needs to be updated.
//
// \return None.
//
//*****************************************************************************
void
UpdateWindow(void)
{
int iIdx;
int iLine;
//
// Set the first line of the directory text window.
//
iLine = TOP_HEIGHT;
//
// Clear out the text area for the entries.
//
ClearTextBox();
//
// Display all valid values.
//
for(iIdx = 0; iIdx < g_DirData.ulValidValues; iIdx++)
{
//
// Change the backgound for the selected item.
//
if(g_DirData.ulSelectIndex == iIdx)
{
GrContextBackgroundSet(&g_sContext, ClrGray);
}
else
{
GrContextBackgroundSet(&g_sContext, ClrBlack);
}
//
// Change the color for directories.
//
if (g_DirData.FileInfo[iIdx].fattrib & AM_DIR)
{
GrContextForegroundSet(&g_sContext, DIR_COLOR);
GrStringDraw(&g_sContext, g_DirData.FileInfo[iIdx].fname,
100, 0, iLine, 1);
}
//
// Change the color for files.
//
else
{
GrContextForegroundSet(&g_sContext, FILE_COLOR);
GrStringDraw(&g_sContext, g_DirData.FileInfo[iIdx].fname,
100, 0, iLine, 1);
}
//
// Move down by the height of the characters used.
//
iLine += g_sFontFixed6x8.ucHeight;
}
}
示例5: LoadLeftButton
void LoadLeftButton( tContext *context, const char * text){
GrRectFill( context, &myRectangleBotLeft);
GrContextForegroundSet( context, ClrWhite);
GrContextBackgroundSet( context, ClrBlack);
GrStringDrawCentered( context, text, AUTO_STRING_LENGTH, 14, 88, TRANSPARENT_TEXT);
GrContextForegroundSet( context, ClrBlack);
GrContextBackgroundSet( context, ClrWhite);
}
示例6: BlankScreen
// Needed since the TivaWare Graphics Library seems to not have a function
// for clearing the display.
void BlankScreen(void)
{
GrContextForegroundSet(&g_sContext, ClrWhite);
GrContextBackgroundSet(&g_sContext, ClrBlack);
GrRectFill(&g_sContext, &(g_sContext.sClipRegion));
GrFlush(&g_sContext);
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrWhite);
}
示例7: SystemInit
/**********************************************************************//**
* @brief Initializes the System
*
* @param none
*
* @return none
*************************************************************************/
void SystemInit(void)
{
// Set the DCO to 8MHz (it's also the device's power-on setting). Do not change this frequency!
// It impacts the cap touch scan window.
CS_setDCOFreq(__MSP430_BASEADDRESS_CS__, CS_DCORSEL_0, CS_DCOFSEL_6);
// Configure clock source and clock dividers. After this the clock configuration will be as follows:
// ACLK=LFXT1/1=32,768Hz; SMCLK=DCOCLK/1=8MHz; and MCLK=DCOCLK/1=8MHz.
CS_clockSignalInit(__MSP430_BASEADDRESS_CS__, CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
CS_clockSignalInit(__MSP430_BASEADDRESS_CS__, CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
CS_clockSignalInit(__MSP430_BASEADDRESS_CS__, CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
// Set all GPIO to output low to minimize current draw by eliminating floating pins.
GPIO_setOutputLowOnPin(GPIO_PORT_PA, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
GPIO_setOutputLowOnPin(GPIO_PORT_PB, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
GPIO_setOutputLowOnPin(GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
GPIO_setAsOutputPin(GPIO_PORT_PA, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
GPIO_setAsOutputPin(GPIO_PORT_PB, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
GPIO_setAsOutputPin(GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15);
// Configure the left button (S2) connected to P4.6. For this enable the internal pull-up resistor and
// setup the pin interrupt to trigger on rising edges.
GPIO_setAsInputPinWithPullUpresistor(GPIO_PORT_P4, GPIO_PIN5);
GPIO_interruptEdgeSelect(GPIO_PORT_P4, GPIO_PIN5, GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_clearInterruptFlag(GPIO_PORT_P4, GPIO_PIN5);
GPIO_enableInterrupt(GPIO_PORT_P4, GPIO_PIN5);
// Configure the right button (S3) connected to P1.1. For this enable the internal pull-up resistor and
// setup the pin interrupt to trigger on rising edges.
GPIO_setAsInputPinWithPullUpresistor(GPIO_PORT_P1, GPIO_PIN1);
GPIO_interruptEdgeSelect(GPIO_PORT_P1, GPIO_PIN1, GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);
// CapSense Setup. GPIO pins P1.3-1.5 and P3.4-3.6 are used for capacitive touch so let's
// switch them to inputs.
// GPIO_setAsInputPin(GPIO_PORT_P1, GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5);
GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6);
// Enable LFXT functionality on PJ.4 and PJ.5. For this we only need to configure PJ.4 to
// LFXIN and the port module logic takes care of the rest.
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_PJ, GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);
// Disable the GPIO power-on default high-impedance mode to activate previously configured port settings
PMM_unlockLPM5(__MSP430_BASEADDRESS_PMM_FRAM__);
// Perform the required LFXT startup procedure now that all of the port pins are configured.
CS_setExternalClockSource(__MSP430_BASEADDRESS_CS__, 32768, 0);
CS_LFXTStart(__MSP430_BASEADDRESS_CS__, CS_LFXT_DRIVE0);
// Initialize LCD driver and the context for the LCD
Sharp96x96_LCDInit();
TA0_enableVCOMToggle();
GrContextInit(&sContext, &g_sharp96x96LCD);
GrContextForegroundSet(&sContext, ClrBlack);
GrContextBackgroundSet(&sContext, ClrWhite);
onLED(); //blink LED1
}
示例8: vApplicationStackOverflowHook
//*****************************************************************************
//
// This hook is called by FreeRTOS when an stack overflow error is detected.
//
//*****************************************************************************
void
vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName)
{
tContext sContext;
//
// A fatal FreeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_psFontCm20);
GrStringDrawCentered(&sContext, "Fatal FreeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}
示例9: SafeRTOSErrorHook
//*****************************************************************************
//
// This hook is called by SafeRTOS when an error is detected.
//
//*****************************************************************************
static void
SafeRTOSErrorHook(xTaskHandle xHandleOfTaskWithError,
signed portCHAR *pcNameOfTaskWithError,
portBASE_TYPE xErrorCode)
{
tContext sContext;
//
// A fatal SafeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_pFontCm20);
GrStringDrawCentered(&sContext, "Fatal SafeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}
示例10: lcd_init
void lcd_init(){
Dogs102x64_UC1701Init();
GrContextInit(&g_sContext, &g_sDogs102x64_UC1701);
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrWhite);
GrContextFontSet(&g_sContext, &g_sFontFixed6x8);
GrClearDisplay(&g_sContext);
}
示例11: DrawToggle
//*****************************************************************************
//
// Draws a toggle button.
//
//*****************************************************************************
void
DrawToggle(const tButtonToggle *psButton, bool bOn)
{
tRectangle sRect;
int16_t i16X, i16Y;
//
// Copy the data out of the bounds of the button.
//
sRect = psButton->sRectButton;
GrContextForegroundSet(&g_sContext, ClrLightGrey);
GrRectFill(&g_sContext, &psButton->sRectContainer);
//
// Copy the data out of the bounds of the button.
//
sRect = psButton->sRectButton;
GrContextForegroundSet(&g_sContext, ClrDarkGray);
GrRectFill(&g_sContext, &psButton->sRectButton);
if(bOn) {
sRect.i16XMin += 2;
sRect.i16YMin += 2;
sRect.i16XMax -= 15;
sRect.i16YMax -= 2;
} else {
sRect.i16XMin += 15;
sRect.i16YMin += 2;
sRect.i16XMax -= 2;
sRect.i16YMax -= 2;
}
GrContextForegroundSet(&g_sContext, ClrLightGrey);
GrRectFill(&g_sContext, &sRect);
GrContextFontSet(&g_sContext, &g_sFontCm16);
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrLightGrey);
i16X = sRect.i16XMin + ((sRect.i16XMax - sRect.i16XMin) / 2);
i16Y = sRect.i16YMin + ((sRect.i16YMax - sRect.i16YMin) / 2);
if(bOn) {
GrStringDrawCentered(&g_sContext, psButton->pcOn, -1, i16X, i16Y,
true);
} else {
GrStringDrawCentered(&g_sContext, psButton->pcOff, -1, i16X, i16Y,
true);
}
if(psButton->pcLabel) {
GrStringDraw(&g_sContext, psButton->pcLabel, -1,
psButton->sRectButton.i16XMax + 2,
psButton->sRectButton.i16YMin + 6,
true);
}
}
示例12: print_string
void print_string(int column,int row,char *s){
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrWhite);
GrStringDraw(&g_sContext,
s,
AUTO_STRING_LENGTH,
column,
row,OPAQUE_TEXT);
}
示例13: print_char
void print_char(int column,int row,const char s){
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrWhite);
char S[2] = {s, 0};
GrStringDraw(&g_sContext,
S,
AUTO_STRING_LENGTH,
column,
row,OPAQUE_TEXT);
}
示例14: PrintBasTmpActive
void PrintBasTmpActive(tContext *context, y_menus f_menuChoice){
char outString[32];
unsigned char text_start = 18;
// Draw top and bottom banner and buttons
LoadLeftButton( context , "BACK");
LoadMiddleButton( context , "SEL");
//LoadRightButton("");
// Menu options
GrStringDraw(context, "Start Profile", AUTO_STRING_LENGTH, 5, 18, OPAQUE_TEXT);
GrStringDraw(context, "Stop Temporary", AUTO_STRING_LENGTH, 5, 31, OPAQUE_TEXT);
GrStringDraw(context, "Manage Profiles", AUTO_STRING_LENGTH, 5, 44, OPAQUE_TEXT);
// Highlight selected item
switch (f_menuChoice) {
case Basal_StartProfile:
text_start = 18;
strcpy(outString, "Start Profile");
break;
case Basal_StopTmp:
text_start = 31;
strcpy(outString, "Stop Temporary");
break;
case Basal_Manage:
text_start = 44;
strcpy(outString, "Manage Profiles");
break;
default: break;
}
GrContextForegroundSet(context, ClrWhite); //ClrBlack this affects the highlight color
GrContextBackgroundSet(context, ClrBlack); //ClrWhite this affects the text color in the highlight
GrStringDraw(context, outString, AUTO_STRING_LENGTH, 5, text_start, OPAQUE_TEXT);
GrContextForegroundSet(context, ClrBlack);
GrContextBackgroundSet(context, ClrWhite);
}
示例15: print_int
void print_int(int column,int row,int n){
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrWhite);
char s[10];
snprintf(s,10,"%d",n);
GrStringDraw(&g_sContext,
s,
AUTO_STRING_LENGTH,
column,
row,TRANSPARENT_TEXT);
}