本文整理汇总了C++中GrRectDraw函数的典型用法代码示例。如果您正苦于以下问题:C++ GrRectDraw函数的具体用法?C++ GrRectDraw怎么用?C++ GrRectDraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrRectDraw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
Kentec320x240x16_SSD2119Init();
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
ClrScreen();
GrImageDraw(&sContext, g_pui8Image, 0, 0);
GrFlush(&sContext);
SysCtlDelay(SysCtlClockGet());
// Later lab steps go between here
ClrScreen();
sRect.i16XMin = 1;
sRect.i16YMin = 1;
sRect.i16XMax = 318;
sRect.i16YMax = 238;
GrContextForegroundSet(&sContext, ClrRed);
GrContextFontSet(&sContext, &g_sFontCmss30b);
GrStringDraw(&sContext, "Texas", -1, 110, 2, 0);
GrStringDraw(&sContext, "Instruments", -1, 80, 32, 0);
GrStringDraw(&sContext, "Graphics", -1, 100, 62, 0);
GrStringDraw(&sContext, "Lab", -1, 135, 92, 0);
GrContextForegroundSet(&sContext, ClrWhite);
GrRectDraw(&sContext, &sRect);
GrFlush(&sContext);
SysCtlDelay(SysCtlClockGet());
GrContextForegroundSet(&sContext, ClrYellow);
GrCircleFill(&sContext, 80, 182, 50);
sRect.i16XMin = 160;
sRect.i16YMin = 132;
sRect.i16XMax = 312;
sRect.i16YMax = 232;
GrContextForegroundSet(&sContext, ClrGreen);
GrRectDraw(&sContext, &sRect);
SysCtlDelay(SysCtlClockGet());
// and here
ClrScreen();
while(1)
{
}
}
示例2: DrawBufferMeter
/******************************************************************************
* *
* \brief Draw a horizontal meter at a given position on the display and fill *
* fill it with green. *
* *
* \param psContext is a pointer to the graphics context representing the *
* display. *
* *
* \param lX X - Cordinate. *
* *
* \param lY Y - Cordinate. *
* *
* \return none. *
* *
******************************************************************************/
void DrawBufferMeter(tContext *psContext, int lX, int lY)
{
tRectangle sRect;
int lCorrectedY;
/* Correct the Y coordinate so that the meter is centered on the same line
as the text caption to its left.
*/
lCorrectedY = lY - (BUFFER_METER_HEIGHT - TEXT_HEIGHT) ;
/* Determine the bounding rectangle of the meter. */
sRect.sXMin = lX;
sRect.sXMax = lX + BUFFER_METER_WIDTH - 1;
sRect.sYMin = lCorrectedY;
sRect.sYMax = lCorrectedY + BUFFER_METER_HEIGHT - 1;
/* Fill the meter with green to indicate empty */
GrContextForegroundSet(psContext, ClrGreen);
GrRectFill(psContext, &sRect);
/* Put a white box around the meter. */
GrContextForegroundSet(psContext, ClrWhite);
GrRectDraw(psContext, &sRect);
}
示例3: MenuDisplay
//*****************************************************************************
//
// Draw the whole menu onto the display.
//
//*****************************************************************************
static tBoolean
MenuDisplay(tMenu *psMenu)
{
unsigned long ulLoop;
tRectangle rectMenu;
//
// Erase the rectangle of the display that will contain the menu.
//
rectMenu.sXMin = MENU_LEFT;
rectMenu.sXMax = MENU_RIGHT;
rectMenu.sYMin = MENU_TOP;
rectMenu.sYMax = MENU_BOTTOM(psMenu->ucNumGroups);
GrContextForegroundSet(&g_sContext, MENU_BACKGROUND_COLOR);
GrRectFill(&g_sContext, &rectMenu);
GrContextForegroundSet(&g_sContext, MENU_BORDER_COLOR);
GrRectDraw(&g_sContext, &rectMenu);
//
// Draw a rectangle around the edge of the menu area.
//
//
// Draw each of the buttons corresponding to the groups.
//
for(ulLoop = 0; ulLoop < psMenu->ucNumGroups; ulLoop++)
{
MenuDrawGroupButton(psMenu, ulLoop,
(ulLoop == psMenu->ucFocusGroup) ? &g_psFocusColors : &g_psBtnColors);
}
return(true);
}
示例4: DrawBufferMeter
//*****************************************************************************
//
// Draw a horizontal meter at a given position on the display and fill it
// with green.
//
//*****************************************************************************
void
DrawBufferMeter(tContext *psContext, int32_t i32X, int32_t i32Y)
{
tRectangle sRect;
int32_t i32CorrectedY;
//
// Correct the Y coordinate so that the meter is centered on the same line
// as the text caption to its left.
//
i32CorrectedY = i32Y - ((BUFFER_METER_HEIGHT - TEXT_HEIGHT) / 2);
//
// Determine the bounding rectangle of the meter.
//
sRect.i16XMin = i32X;
sRect.i16XMax = i32X + BUFFER_METER_WIDTH - 1;
sRect.i16YMin = i32CorrectedY;
sRect.i16YMax = i32CorrectedY + BUFFER_METER_HEIGHT - 1;
//
// Fill the meter with green to indicate empty
//
GrContextForegroundSet(psContext, ClrGreen);
GrRectFill(psContext, &sRect);
//
// Put a white box around the meter.
//
GrContextForegroundSet(psContext, ClrWhite);
GrRectDraw(psContext, &sRect);
}
示例5: UpdateButtons
//*****************************************************************************
//
// This function will update the small mouse button indicators in the status
// bar area of the screen. This can be called on its own or it will be called
// whenever UpdateStatus() is called as well.
//
//*****************************************************************************
void
UpdateButtons(void)
{
tRectangle sRect, sRectInner;
int iButton;
//
// Initialize the button indicator position.
//
sRect.i16XMin = GrContextDpyWidthGet(&g_sContext) - 36;
sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - 18;
sRect.i16XMax = sRect.i16XMin + 6;
sRect.i16YMax = sRect.i16YMin + 8;
sRectInner.i16XMin = sRect.i16XMin + 1;
sRectInner.i16YMin = sRect.i16YMin + 1;
sRectInner.i16XMax = sRect.i16XMax - 1;
sRectInner.i16YMax = sRect.i16YMax - 1;
//
// Check all three buttons.
//
for(iButton = 0; iButton < 3; iButton++)
{
//
// Draw the button indicator red if pressed and black if not pressed.
//
if(g_ui32Buttons & (1 << iButton))
{
GrContextForegroundSet(&g_sContext, ClrRed);
}
else
{
GrContextForegroundSet(&g_sContext, ClrBlack);
}
//
// Draw the back of the button indicator.
//
GrRectFill(&g_sContext, &sRectInner);
//
// Draw the border on the button indicator.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Move to the next button indicator position.
//
sRect.i16XMin += 8;
sRect.i16XMax += 8;
sRectInner.i16XMin += 8;
sRectInner.i16XMax += 8;
}
}
示例6: UpdateButtons
//*****************************************************************************
//
// This function will update the mouse button indicators in the status
// bar area of the screen.
//
//*****************************************************************************
static void
UpdateButtons(void)
{
tRectangle sRect, sRectInner;
int iButton;
//
// Initialize the button indicator position.
//
sRect.i16XMin = BUTTON_MIN_X;
sRect.i16YMin = STATUS_MIN_Y;
sRect.i16XMax = sRect.i16XMin + BUTTON_WIDTH;
sRect.i16YMax = sRect.i16YMin + BUTTON_HEIGHT ;
sRectInner.i16XMin = sRect.i16XMin + 1;
sRectInner.i16YMin = sRect.i16YMin + 1;
sRectInner.i16XMax = sRect.i16XMax - 1;
sRectInner.i16YMax = sRect.i16YMax - 1;
//
// Check all three buttons.
//
for(iButton = 0; iButton < 3; iButton++)
{
//
// Draw the button indicator red if pressed and black if not pressed.
//
if(g_sStatus.ui32Buttons & (1 << iButton))
{
GrContextForegroundSet(&g_sContext, ClrRed);
}
else
{
GrContextForegroundSet(&g_sContext, ClrBlack);
}
//
// Draw the back of the button indicator.
//
GrRectFill(&g_sContext, &sRectInner);
//
// Draw the border on the button indicator.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Move to the next button indicator position.
//
sRect.i16XMin += BUTTON_WIDTH;
sRect.i16XMax += BUTTON_WIDTH;
sRectInner.i16XMin += BUTTON_WIDTH;
sRectInner.i16XMax += BUTTON_WIDTH;
}
}
示例7: draw_usbmouse_slide
static void draw_usbmouse_slide()
{
const tRectangle rect1 = {50, 48, 430, 228};
const tRectangle rect2 = {51, 49, 429, 227};
GrImageDraw(&sContextUsbMouse, iconHome, 0, 0);
GrImageDraw(&sContextUsbMouse, iconBack, 0, HEIGHT - 60);
GrImageDraw(&sContextUsbMouse, iconNext, WIDTH - 60, HEIGHT - 60);
/* draw special trackpad graphics instead of standard slide layout */
GrContextForegroundSet(&sContextUsbMouse, ClrDarkBlue);
GrRectDraw(&sContextUsbMouse, &rect1);
GrRectDraw(&sContextUsbMouse, &rect2);
GrContextForegroundSet(&sContextUsbMouse, ClrDarkGray);
GrContextFontSet(&sContextUsbMouse, &g_sFontCmss22b);
GrStringDrawCentered(&sContextUsbMouse, "Touch Pad", -1, 240, 140, 0);
GrImageDraw(&sContextUsbMouse, (unsigned char *)usbMouseButtons, 50, 238);
}
示例8: window_volume
void window_volume(tContext *pContext, long lX, long lY, int total, int current)
{
for (int i = 0; i <= total; i++)
{
tRectangle rect = {lX + i * 10, lY - 3 - i * 3, lX + 7 + i * 10, lY};
if (i <= current)
{
// solid
GrRectFill(pContext, &rect);
}
else
{
GrRectDraw(pContext, &rect);
}
}
}
示例9: UpdateStatus
//*****************************************************************************
//
// This function updates the status area of the screen. It uses the current
// state of the application to print the status bar.
//
//*****************************************************************************
void
UpdateStatus(char *pcString, tBoolean bClrBackground)
{
tRectangle sRect;
//
// Fill the bottom rows of the screen with blue to create the status area.
//
sRect.sXMin = 0;
sRect.sYMin = GrContextDpyHeightGet(&g_sContext) -
DISPLAY_BANNER_HEIGHT - 1;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT;
//
//
//
GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG);
if(bClrBackground)
{
//
// Draw the background of the banner.
//
GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG);
GrRectDraw(&g_sContext, &sRect);
}
//
// Write the current state to the left of the status area.
//
GrContextFontSet(&g_sContext, g_pFontFixed6x8);
//
// Update the status on the screen.
//
if(pcString != 0)
{
GrStringDraw(&g_sContext, pcString, -1, 4, sRect.sYMin + 4, 1);
}
}
示例10: UpdateStatusBox
//*****************************************************************************
//
// Update one of the status boxes at the bottom of the screen.
//
//*****************************************************************************
static void
UpdateStatusBox(tRectangle *psRect, const char *pcString, bool bActive)
{
uint32_t ui32TextColor;
//
// Change the status box to green for active devices.
//
if(bActive)
{
GrContextForegroundSet(&g_sContext, ClrOrange);
ui32TextColor = ClrBlack;
}
else
{
GrContextForegroundSet(&g_sContext, ClrBlack);
ui32TextColor = ClrWhite;
}
//
// Draw the background box.
//
GrRectFill(&g_sContext, psRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Draw the box border.
//
GrRectDraw(&g_sContext, psRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ui32TextColor);
//
// Unknown device is currently connected.
//
GrStringDrawCentered(&g_sContext, pcString, -1,
psRect->i16XMin + (BUTTON_WIDTH / 2),
psRect->i16YMin + 8, false);
}
示例11: InitGraphics
//*****************************************************************************
//
// Set up the OLED Graphical Display
//
//*****************************************************************************
void
InitGraphics(void)
{
tRectangle sRect;
//
// Initialize the display driver.
//
CFAL96x64x16Init();
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sCFAL96x64x16);
//
// Fill the top 24 rows of the screen with blue to create the banner.
//
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.i16YMax = 9;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
GrStringDrawCentered(&g_sContext, "CAN Example", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);
//
// Flush any cached drawing operations.
//
GrFlush(&g_sContext);
}
示例12: DisplayGR
static void DisplayGR(void)
{
tRectangle sRect;
// Fill the top 24 rows of the screen with blue to create the banner.
sRect.sXMin = 0;
sRect.sYMin = 0;
sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
sRect.sYMax = 23;
GrContextForegroundSet(&sContext, ClrDarkBlue);
GrRectFill(&sContext, &sRect);
// Put a white box around the banner.
GrContextForegroundSet(&sContext, ClrWhite);
GrRectDraw(&sContext, &sRect);
// Put the application name in the middle of the banner.
GrContextFontSet(&sContext, &g_sFontCm20);
GrStringDrawCentered(&sContext, "grlib demo", -1,
GrContextDpyWidthGet(&sContext) / 2, 8, 0);
GrStringDrawCentered(&sContext, "Touch here to proceed ", -1,
GrContextDpyWidthGet(&sContext) / 2, 140, 0);
// Initialize the sound driver.
// Add the title block and the previous and next buttons to the widget tree.
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious);
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle);
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext);
// Add the first panel to the widget tree.
g_ulPanel = 0;
WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);
CanvasTextSet(&g_sTitle, g_pcPanelNames[0]);
// Issue the initial paint request to the widgets.
//WidgetPaint(WIDGET_ROOT);
WidgetMessageQueueAdd(WIDGET_ROOT, WIDGET_MSG_PAINT, 0, 0, 0, 0);
}
示例13: vShowBootText
/**
* Show the Text for the Bootscreen
*/
void vShowBootText(char* text)
{
/* Header Rectangle */
tRectangle sRect;
if (g_sContext.pDisplay == 0)
{
GrContextInit(&g_sContext, DISPLAY_DRIVER);
}
//
// Fill the top 24 rows of the screen with blue to create the banner.
//
sRect.sXMin = 0;
sRect.sYMin = 0;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext);
sRect.sYMax = GrContextDpyHeightGet(&g_sContext);
GrContextForegroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_BACKGROUND_COLOR);
GrContextBackgroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_BACKGROUND_COLOR);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrRectDraw(&g_sContext, &sRect);
GrContextForegroundSet(&g_sContext, DISPLAY_BOOT_SCREEN_COLOR);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, DISPLAY_BOOT_SCREEN_FONT);
GrStringDrawCentered(&g_sContext, text, -1,
GrContextDpyWidthGet(&g_sContext) / 2, GrContextDpyHeightGet(&g_sContext) / 2, 0);
}
示例14: DrawTextBox
//*****************************************************************************
//
// Draw a string of text centered within an outlined rectangle.
//
// \param pszText is a pointer to the zero-terminated ASCII string which will
// be displayed within the given rectangle.
// \param prectOutline points to the rectangle within which the test is to be
// displayed.
// \param psColors points to a structure defining the colors to be used for
// the background, outline and text.
//
// This function draws a text string centered within a given rectangle. The
// rectangle is filled with a given color and outlined in another color prior
// to drawing the text.
//
// \return None.
//
//*****************************************************************************
void
DrawTextBox(const char *pszText, tRectangle *prectOutline,
tOutlineTextColors *psColors)
{
//
// Set the clipping region to guard against text strings that are too
// long for the supplied rectangle.
//
GrContextClipRegionSet(&g_sContext, prectOutline);
//
// Draw the background area
//
GrContextForegroundSet(&g_sContext, psColors->ulBackground);
GrRectFill(&g_sContext, prectOutline);
//
// Draw the border
//
GrContextForegroundSet(&g_sContext, psColors->ulBorder);
GrRectDraw(&g_sContext, prectOutline);
//
// Draw the text
//
GrContextForegroundSet(&g_sContext, psColors->ulText);
GrStringDrawCentered(&g_sContext, (char *)pszText, strlen(pszText),
(prectOutline->sXMax + prectOutline->sXMin) / 2,
(prectOutline->sYMax + prectOutline->sYMin) / 2,
false);
//
// Remove our clipping area.
//
GrContextClipRegionSet(&g_sContext, &g_sRectDisplay);
}
示例15: main
//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
uint32_t ui32TxCount, ui32RxCount, ui32Fullness, ui32SysClock, ui32PLLRate;
tRectangle sRect;
char pcBuffer[16];
#ifdef USE_ULPI
uint32_t ui32Setting;
#endif
//
// Set the system clock to run at 120MHz from the PLL.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Configure the device pins.
//
PinoutSet();
#ifdef USE_ULPI
//
// Switch the USB ULPI Pins over.
//
USBULPIPinoutSet();
//
// Enable USB ULPI with high speed support.
//
ui32Setting = USBLIB_FEATURE_ULPI_HS;
USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32Setting);
//
// Setting the PLL frequency to zero tells the USB library to use the
// external USB clock.
//
ui32PLLRate = 0;
#else
//
// Save the PLL rate used by this application.
//
ui32PLLRate = 480000000;
#endif
//
// Enable the system tick.
//
ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Not configured initially.
//
g_ui32Flags = 0;
//
// Initialize the display driver.
//
Kentec320x240x16_SSD2119Init(ui32SysClock);
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&g_sContext, "usb-dev-serial");
//
// Fill the top 15 rows of the screen with blue to create the banner.
//
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.i16YMax = 23;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Show the various static text elements on the color STN display.
//
GrContextFontSet(&g_sContext, TEXT_FONT);
GrStringDraw(&g_sContext, "Tx bytes:", -1, 8, 80, false);
GrStringDraw(&g_sContext, "Tx buffer:", -1, 8, 105, false);
//.........这里部分代码省略.........