Product Application

©
Rev.1.1
2.2 Setting background color and text formatting
In this example the method for setting the background color and text drawing is presented. You will
see a red string with the name of the sub-application in the middle of the white screen. Result is
presented in
Figure 2.
Figure 2. Text formatting and background color example
In the
Figure 2 you can see effect of following code:
Ft_Gpu_CoCmd_Dlstart(phost);
/*Setting first screen*/
Ft_App_WrCoCmd_Buffer(phost,CLEAR_COLOR_RGB(0xff,0xff,0xff));//white color
Ft_App_WrCoCmd_Buffer(phost,CLEAR(1,1,1));//clear screen
Ft_App_WrCoCmd_Buffer(phost,COLOR_RGB(0x80,0x00,0x00));//red color
Ft_Gpu_CoCmd_Text(phost,(FT_DispWidth/2), FT_DispHeight/2, 28, OPT_CENTERX,
"Riverdi 4.3\" CTP demo");
Ft_App_WrCoCmd_Buffer(phost,DISPLAY());
Ft_Gpu_CoCmd_Swap(phost);
/* Download the commands into fifo */
Ft_App_Flush_Co_Buffer(phost);
/* Wait till coprocessor completes the operation */
Ft_Gpu_Hal_WaitCmdfifo_empty(phost);
You can set background color using macro CLEAR_COLOR_RGB and CLEAR, which setting each of red,
blue and green component separately.
You can set color of next graphic objects using macro COLOR_RGB. Using function
Ft_Gpu_CoCmd_Dlstart(phost) you start display list which will be send to FT800. Using
Ft_Gpu_CoCmd_Text(phost,x,y,font,options,string) function you can display text at
location (x,y). The font size and type is setting by font parameter(0 31), it can be one of embedded
font or you can define your own fonts (see ROM and RAM Fonts). The options is responsible for
additional options: By default (x,y) is the top-left pixel of the text and the value of options is zero.