313 GUIXc or GUIXOSc GUIXc for single task execution Single task means that the

313 guixc or guixosc guixc for single task execution

This preview shows page 14 - 17 out of 31 pages.

3.1.3 GUI_X.c or GUI_X_OS.c GUI_X.c for single task execution: “Single task” means that the project uses STemWin only from within one single task. The main purpose is to supply STemWin with a timing base. OS_TimeMS needs to be incremented each ms. GUI_X_OS.c for multitask execution: If STemWin is used in a multitasking system, this file contains additional routines required for synchronizing tasks (for this purpose, the file GUI_X_FreeRTOS.c can be used as a template). 3.2 GUI initialization To initialize the STemWin internal data structures and variables, GUI_Init() should be used. Note that before initializing the GUI, the CRC module (in RCC peripheral clock enable register) should be enabled A simple “Hello world” program illustrates this initialization, as shown below. “Hello world” example: void Main(void) { int xPos, yPos; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); GUI_Init(); xPos = LCD_GetXSize() / 2; yPos = LCD_GetYSize() / 3; GUI_SetFont(GUI_FONT_COMIC24B_ASCII); GUI_DispStringHCenterAt("Hello world!", xPos, yPos);
Image of page 14
DocID024959 Rev 4 15/31 AN4323 How to use STemWin Library step by step 30 while(1); } 3.3 Core functions 3.3.1 Image file display STemWin currently supports the BMP, JPEG, GIF and PNG file formats. The library includes rich APIs for each one of these image formats (fully documented in the STemWin User Manual). An approximation of the memory resources needed for each image type is given in Section 4: Performance and footprint . 3.3.2 Bidirectional text Drawing Arabic or Hebrew text with STemWin is quite easy and is supported automatically in each text-based function. It only needs to be enabled once by using the following command: GUI_UC_EnableBIDI() 3.3.3 Alpha blending Alpha blending is a method combining the alpha channel with other layers in an image in order to create the appearance of semi-transparency (see Figure 4 ). Figure 4. Alpha blending effect The user can enable automatic alpha blending using the following command: GUI_EnableAlpha() He can also give an alpha value to determine how much of a pixel should be visible and how much of the background should show through: GUI_SetUserAlpha() 3.3.4 Sprites and cursors A sprite is an image which can be shown above all other graphics on the screen. A sprite preserves the screen area it covers. It can be moved or removed at any time, fully restoring the screen content. Animation by use of multiple images is also possible.
Image of page 15
How to use STemWin Library step by step AN4323 16/31 DocID024959 Rev 4 Figure 5. Animated sprites Sprites can be animated ( Figure 5 ) by calling GUI_SPRITE_CreateAnim() . Note that sprites manage the background automatically. STemWin also includes a system-wide cursor ( Figure 6 ), which can also be animated by using GUI_CURSOR_SetAnim() . Cursors are actually based on sprites. Figure 6. Cursors Although the cursor always exists, it is hidden by default. It is not visible until a call is made to show it ( GUI_CURSOR_Show() ), and may be hidden again at any point ( GUI_CURSOR_Hide() ).
Image of page 16
Image of page 17

You've reached the end of your free preview.

Want to read all 31 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes