• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GrRectDraw函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GrRectDraw函数的典型用法代码示例。如果您正苦于以下问题:C++ GrRectDraw函数的具体用法?C++ GrRectDraw怎么用?C++ GrRectDraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GrRectDraw函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
   {
   }
}
开发者ID:eXamadeus,项目名称:SR03-Robot,代码行数:50,代码来源:main3.c


示例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);
}
开发者ID:OS-Project,项目名称:Divers,代码行数:43,代码来源:usb_dev_serial.c


示例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);
}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:38,代码来源:menu.c


示例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);
}
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:38,代码来源:usb_dev_serial.c


示例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;
    }
}
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:62,代码来源:usb_host_mouse.c


示例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;
    }
}
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:61,代码来源:mouse_ui.c


示例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);
}
开发者ID:ev3osek,项目名称:ev3osek,代码行数:20,代码来源:demoSlides.c


示例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);
    }
  }
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:16,代码来源:controls.c


示例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);
    }
}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:53,代码来源:usb_dev_msc.c


示例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);

}
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:52,代码来源:usb_host_hub.c


示例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);
}
开发者ID:AlexGeControl,项目名称:tiva-c,代码行数:48,代码来源:can.c


示例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);

}
开发者ID:ev3osek,项目名称:ev3osek,代码行数:42,代码来源:grlib_demo.c


示例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);
}
开发者ID:hitubaldaniya,项目名称:lumweb,代码行数:39,代码来源:displayBasics.c


示例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);
}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:54,代码来源:menu.c


示例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);
//.........这里部分代码省略.........
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:101,代码来源:usb_dev_serial.c


示例16: OnPrimitivePaint

//*****************************************************************************
//
// Handles paint requests for the primitives canvas widget.
//
//*****************************************************************************
void
OnPrimitivePaint(tWidget *pWidget, tContext *pContext)
{
    unsigned int ulIdx;
    tRectangle sRect;

    //
    // Draw a vertical sweep of lines from red to green.
    //
    for(ulIdx = 0; ulIdx <= 8; ulIdx++)
    {
        GrContextForegroundSet(pContext,
                               (((((10 - ulIdx) * 255) / 10) << ClrRedShift) |
                                (((ulIdx * 255) / 10) << ClrGreenShift)));
        GrLineDraw(pContext, 115+X_OFFSET, 120+Y_OFFSET, 5+X_OFFSET, 120+Y_OFFSET - (11 * ulIdx));
    }

    //
    // Draw a horizontal sweep of lines from green to blue.
    //
    for(ulIdx = 1; ulIdx <= 10; ulIdx++)
    {
        GrContextForegroundSet(pContext,
                               (((((10 - ulIdx) * 255) / 10) <<
                                 ClrGreenShift) |
                                (((ulIdx * 255) / 10) << ClrBlueShift)));
        GrLineDraw(pContext, 115+X_OFFSET, 120+Y_OFFSET, 5 + (ulIdx * 11)+X_OFFSET, 29+Y_OFFSET);
    }

    //
    // Draw a filled circle with an overlapping circle.
    //
    GrContextForegroundSet(pContext, ClrBrown);
    GrCircleFill(pContext, 185+X_OFFSET, 69+Y_OFFSET, 40);
    GrContextForegroundSet(pContext, ClrSkyBlue);
    GrCircleDraw(pContext, 205+X_OFFSET, 99+Y_OFFSET, 30);

    //
    // Draw a filled rectangle with an overlapping rectangle.
    //
    GrContextForegroundSet(pContext, ClrSlateGray);
    sRect.sXMin = 20+X_OFFSET;
    sRect.sYMin = 100+Y_OFFSET;
    sRect.sXMax = 75+X_OFFSET;
    sRect.sYMax = 160+Y_OFFSET;
    GrRectFill(pContext, &sRect);
    GrContextForegroundSet(pContext, ClrSlateBlue);
    sRect.sXMin += 40;
    sRect.sYMin += 40;
    sRect.sXMax += 30;
    sRect.sYMax += 28;
    GrRectDraw(pContext, &sRect);

    //
    // Draw a piece of text in fonts of increasing size.
    //
    GrContextForegroundSet(pContext, ClrSilver);
    GrContextFontSet(pContext, &g_sFontCm14);
    GrStringDraw(pContext, "Strings", -1, 125+X_OFFSET, 110+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm18);
    GrStringDraw(pContext, "Strings", -1, 145+X_OFFSET, 124+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm22);
    GrStringDraw(pContext, "Strings", -1, 165+X_OFFSET, 142+Y_OFFSET, 0);
    GrContextFontSet(pContext, &g_sFontCm24);
    GrStringDraw(pContext, "Strings", -1, 185+X_OFFSET, 162+Y_OFFSET, 0);

    //
    // Draw an image.
    //
    GrImageDraw(pContext, g_TILogo, 240+X_OFFSET, 60+Y_OFFSET);
}
开发者ID:ev3osek,项目名称:ev3osek,代码行数:76,代码来源:grlib_demo.c


示例17: main

//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
    unsigned long ulTxCount;
    unsigned long ulRxCount;
    tRectangle sRect;
    char pcBuffer[16];

    //
    // Set the clocking to run from the PLL at 50MHz
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_8MHZ);

#ifdef DEBUG
    //
    // Configure the relevant pins such that UART0 owns them.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Open UART0 for debug output.
    //
    UARTStdioInit(0);
#endif

    //
    // Not configured initially.
    //
    g_bUSBConfigured = false;

    //
    // Initialize the display driver.
    //
    Formike128x128x16Init();

    //
    // Turn on the backlight.
    //
    Formike128x128x16BacklightOn();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sFormike128x128x16);

    //
    // Fill the top 15 rows of the screen with blue to create the banner.
    //
    sRect.sXMin = 0;
    sRect.sYMin = 0;
    sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
    sRect.sYMax = 14;
    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_pFontFixed6x8);
    GrStringDrawCentered(&g_sContext, "usb_dev_bulk", -1,
                         GrContextDpyWidthGet(&g_sContext) / 2, 7, 0);

    //
    // Show the various static text elements on the color STN display.
    //
    GrContextFontSet(&g_sContext, TEXT_FONT);
    GrStringDraw(&g_sContext, "Tx bytes:", -1, 8, 70, false);
    GrStringDraw(&g_sContext, "Rx bytes:", -1, 8, 90, false);

    //
    // Configure the USB mux on the board to put us in device mode.  We pull
    // the relevant pin high to do this.
    //
    ROM_SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH);
    ROM_GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN);
    ROM_GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE);

    //
    // Enable the system tick.
    //
    ROM_SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND);
    ROM_SysTickIntEnable();
    ROM_SysTickEnable();

    //
    // Show the application name on the display and UART output.
    //
//.........这里部分代码省略.........
开发者ID:Razofiter,项目名称:Luminary-Micro-Library,代码行数:101,代码来源:usb_dev_bulk.c


示例18: main

void main(void)
{
    // Stop WDT
    WDTCTL = WDTPW + WDTHOLD;

    // Initialize the boards
    boardInit();
    clockInit();
    timerInit();
    flashInit();

    __bis_SR_register(GIE);

    // Set up the LCD
    LCDInit();
    GrContextInit(&g_sContext, &g_sharp96x96LCD);
    GrContextForegroundSet(&g_sContext, ClrBlack);
    GrContextBackgroundSet(&g_sContext, ClrWhite);
    GrContextFontSet(&g_sContext, &g_sFontFixed6x8);
    GrClearDisplay(&g_sContext);
    GrFlush(&g_sContext);

    // Intro Screen
    GrStringDrawCentered(&g_sContext, 
                         "How to use", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         15, 
                         TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "the MSP430", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         35, 
                         TRANSPARENT_TEXT);
    GrStringDraw(&g_sContext, 
                 "Graphics Library", 
                 AUTO_STRING_LENGTH, 
                 1, 
                 51, 
                 TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "Primitives", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         75, 
                         TRANSPARENT_TEXT);
    GrFlush(&g_sContext);
    Delay_long();
    GrClearDisplay(&g_sContext);

    // Draw pixels and lines on the display
    GrStringDrawCentered(&g_sContext, 
                         "Draw Pixels", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         5, 
                         TRANSPARENT_TEXT);
    GrStringDrawCentered(&g_sContext, 
                         "& Lines", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         15, 
                         TRANSPARENT_TEXT);
    GrPixelDraw(&g_sContext, 30, 30);
    GrPixelDraw(&g_sContext, 30, 32);
    GrPixelDraw(&g_sContext, 32, 32);
    GrPixelDraw(&g_sContext, 32, 30);
    GrLineDraw(&g_sContext, 35, 35, 90, 90);
    GrLineDraw(&g_sContext, 5, 80, 80, 20);
    GrLineDraw(&g_sContext, 
               0, 
               GrContextDpyHeightGet(&g_sContext) - 1, 
               GrContextDpyWidthGet(&g_sContext) - 1, 
               GrContextDpyHeightGet(&g_sContext) - 1);
    GrFlush(&g_sContext);
    Delay_long();
    GrClearDisplay(&g_sContext);

    // Draw circles on the display
    GrStringDraw(&g_sContext, 
                 "Draw Circles", 
                 AUTO_STRING_LENGTH, 
                 10, 
                 5, 
                 TRANSPARENT_TEXT);
    GrCircleDraw(&g_sContext, 30, 70, 20);
    GrCircleFill(&g_sContext, 60, 50, 30);
    GrFlush(&g_sContext);
    Delay_long();
    GrClearDisplay(&g_sContext);

    // Draw rectangles on the display
    GrStringDrawCentered(&g_sContext, 
                         "Draw Rectangles", 
                         AUTO_STRING_LENGTH, 
                         48, 
                         5, 
                         TRANSPARENT_TEXT);
    GrRectDraw(&g_sContext, &myRectangle1);
//.........这里部分代码省略.........
开发者ID:tnapiork,项目名称:all,代码行数:101,代码来源:main.c


示例19: main

//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
    uint32_t ui32TxCount;
    uint32_t ui32RxCount;
    tRectangle sRect;
    char pcBuffer[16];
    uint32_t ui32Fullness;

    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run from the PLL at 50MHz
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

    //
    // Configure the required pins for USB operation.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
    ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Erratum workaround for silicon revision A1.  VBUS must have pull-down.
    //
    if(CLASS_IS_BLIZZARD && REVISION_IS_A1)
    {
        HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1;
    }

    //
    // Not configured initially.
    //
    g_bUSBConfigured = false;

    //
    // Initialize the display driver.
    //
    CFAL96x64x16Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sCFAL96x64x16);

    //
    // 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 = 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, "usb-dev-serial", -1,
                         GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);

    //
    // Show the various static text elements on the color STN display.
    //
    GrStringDraw(&g_sContext, "Tx #",-1, 0, 12, false);
    GrStringDraw(&g_sContext, "Tx buf", -1, 0, 22, false);
    GrStringDraw(&g_sContext, "Rx #", -1, 0, 32, false);
    GrStringDraw(&g_sContext, "Rx buf", -1, 0, 42, false);
    DrawBufferMeter(&g_sContext, 40, 22);
    DrawBufferMeter(&g_sContext, 40, 42);

    //
    // Enable the UART that we will be redirecting.
    //
    ROM_SysCtlPeripheralEnable(USB_UART_PERIPH);

    //
//.........这里部分代码省略.........
开发者ID:PhamVanNhi,项目名称:ECE5770,代码行数:101,代码来源:usb_dev_serial.c


示例20: RadioButtonPaint

//*****************************************************************************
//
//! Draws a radio button widget.
//!
//! \param psWidget is a pointer to the radio button widget to be drawn.
//! \param bClick is a boolean that is \b true if the paint request is a result
//! of a pointer click and \b false if not.
//!
//! This function draws a radio button widget on the display.  This is called
//! in response to a \b #WIDGET_MSG_PAINT message.
//!
//! \return None.
//
//*****************************************************************************
static void
RadioButtonPaint(tWidget *psWidget, uint32_t bClick)
{
    tRadioButtonWidget *pRadio;
    tContext sCtx;
    int32_t i32X, i32Y;

    //
    // Check the arguments.
    //
    ASSERT(psWidget);

    //
    // Convert the generic widget pointer into a radio button widget pointer.
    //
    pRadio = (tRadioButtonWidget *)psWidget;

    //
    // Initialize a drawing context.
    //
    GrContextInit(&sCtx, psWidget->psDisplay);

    //
    // Initialize the clipping region based on the extents of this radio
    // button.
    //
    GrContextClipRegionSet(&sCtx, &(psWidget->sPosition));

    //
    // See if the radio button fill style is selected.
    //
    if((pRadio->ui16Style & RB_STYLE_FILL) && !bClick)
    {
        //
        // Fill the radio button with the fill color.
        //
        GrContextForegroundSet(&sCtx, pRadio->ui32FillColor);
        GrRectFill(&sCtx, &(psWidget->sPosition));
    }

    //
    // See if the radio button outline style is selected.
    //
    if((pRadio->ui16Style & RB_STYLE_OUTLINE) && !bClick)
    {
        //
        // Outline the radio button with the outline color.
        //
        GrContextForegroundSet(&sCtx, pRadio->ui32OutlineColor);
        GrRectDraw(&sCtx, &(psWidget->sPosition));
    }

    //
    // Draw the radio button.
    //
    i32X = psWidget->sPosition.i16XMin + (pRadio->ui16CircleSize / 2) + 2;
    i32Y = (psWidget->sPosition.i16YMin +
            ((psWidget->sPosition.i16YMax - psWidget->sPosition.i16YMin) / 2));
    if(!bClick)
    {
        GrContextForegroundSet(&sCtx, pRadio->ui32OutlineColor);
        GrCircleDraw(&sCtx, i32X, i32Y, pRadio->ui16CircleSize / 2);
    }

    //
    // Select the foreground color based on whether or not the radio button is
    // selected.
    //
    if(pRadio->ui16Style & RB_STYLE_SELECTED)
    {
        GrContextForegroundSet(&sCtx, pRadio->ui32OutlineColor);
    }
    else
    {
        GrContextForegroundSet(&sCtx, pRadio->ui32FillColor);
    }

    //
    // Fill in the radio button.
    //
    GrCircleFill(&sCtx, i32X, i32Y, (pRadio->ui16CircleSize / 2) - 2);

    //
    // See if the radio button text or image style is selected.
    //
    if((pRadio->ui16Style & (RB_STYLE_TEXT | RB_STYLE_IMG)) && !bClick)
//.........这里部分代码省略.........
开发者ID:mil

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GrRectFill函数代码示例发布时间:2022-05-30
下一篇:
C++ GrPrintf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap