FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: Basic Question - Image overlap  (Read 9667 times)

dnpark

  • Newbie
  • *
  • Posts: 3
    • View Profile
Basic Question - Image overlap
« on: August 31, 2020, 04:20:47 PM »

Hi !
I am using FT800 for the first time.
The LCD has a resolution of 480x272. MCU uses STM32F .
I use background image (480x272) and  several small images (140x140 size).
If touch is detected, smallimage is displayed on background image.
I wrote data directly to RAM_G and displayed , but small images is nor correctly displayed.
I have tried various ways, but I have not solved the problem .

How can I display small image on the background image !
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: Basic Question - Image overlap
« Reply #1 on: September 01, 2020, 02:42:42 PM »

Hello,

Just to clarify are you trying to place one image on top of your background image?

Would it be possible to see the display list being used?

Best Regards,
FTDI Community
Logged

dnpark

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Basic Question - Image overlap
« Reply #2 on: September 02, 2020, 04:00:21 PM »

Hello,

I am testing by writing data directly to RAM_G without using a specific library.
The image is stored in the internal Flash of the MCU (ST32F413), so I don't use SDCARD.
I convert image using the EVE Asset Builder. There are 3 background images (480x272) and about 20 small images.
I check many kinds of libraries and sample codes, but I didn't understand them exactly because they had many functions.

The function is simple, such as displaying background images, displaying some small images, and changing small images by touch input.
1. Display Background
2. Delay
3. Add small images on the background.
4. Wait touch input
5. clear samll image.
6. Repeat
Currently, background images are implemented by writing data directly to RAM_G, but there is a problem with background images being erased when small images are displayed on background images.

If possible, please let me know the Display List with this function.

Thank you .
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: Basic Question - Image overlap
« Reply #3 on: September 03, 2020, 02:28:12 PM »

Hello,

Are you overwriting previously written sections of RAM_G when you are displaying the smaller images?

Best Regards,
FTDI Community.
Logged

dnpark

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Basic Question - Image overlap
« Reply #4 on: September 04, 2020, 01:06:59 AM »

This is a testing code.
Please , check the code.

And, LCD screen is changed for a short time.
I think that the if RAM_G is updating, than LCD screen is changed .
Is there a command (methods) on the LCD to lock or stop the output while modifying the RAM_G data?

Thanks you.

#define Handle_BG     0
#define Handle_Small  1

void Image_Test_2(Gpu_Hal_Context_t *phost)
{
    uint8_t *p;
    uint32_t imgID;
    uint32_t imgFormat, imgSize, sizeX, sizeY, posX, posY;
   
    // Large Image  ------------------------------------------------------------
    p = (uint8_t *)Large_Image;
    imgFormat = RGB565;
    imgSize = 52804;
    sizeX = 480;
    sizeY = 272;
    posX = 0;
    posY = 0;
   
    /* Load Compressed Image */
    Gpu_CoCmd_Inflate(phost, 0); 
    Gpu_Hal_WrCmdBufFromFlash(phost, p, imgSize);
 
    //
    Gpu_CoCmd_Dlstart(phost);
    App_WrCoCmd_Buffer(phost, CLEAR_TAG(1));
    App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(255,255,255));
    App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
       
//    App_WrCoCmd_Buffer(phost, COLOR_A(255));
//    App_WrCoCmd_Buffer(phost, COLOR_RGB(255,255,255));
//    App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(Handle_BG));

    App_WrCoCmd_Buffer(phost,BITMAP_SOURCE(0));
    App_WrCoCmd_Buffer(phost,BITMAP_LAYOUT(imgFormat, (sizeX*2), sizeY));
    App_WrCoCmd_Buffer(phost,BITMAP_SIZE(NEAREST, BORDER, BORDER, sizeX, sizeY));   

    App_WrCoCmd_Buffer(phost,BEGIN(BITMAPS));
//    App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(Handle_BG));
    App_WrCoCmd_Buffer(phost,VERTEX2F(posX<<4 , posY<<4));  // (posX * 16, posY * 16)

    //Start drawing bitmap
    App_WrCoCmd_Buffer(phost, END());
    App_WrCoCmd_Buffer(phost, RESTORE_CONTEXT());
    App_WrCoCmd_Buffer(phost, DISPLAY());
    Gpu_CoCmd_Swap(phost);
    App_Flush_Co_Buffer(phost);
    Gpu_Hal_WaitCmdfifo_empty(phost);
   
    // for Test
    HAL_Delay(1000);
   
    // Samll Image  ------------------------------------------------------------
    p = (uint8_t *)Samll_Image;
    imgFormat = ARGB4;
    imgSize = 6703;
    sizeX = 264;
    sizeY = 80;
    posX = 100;
    posY = 100;
   
    /* Load Compressed Image */
    Gpu_CoCmd_Inflate(phost, 0); 
    Gpu_Hal_WrCmdBufFromFlash(phost, p, imgSize);
 
    //
    Gpu_CoCmd_Dlstart(phost);
   
    App_WrCoCmd_Buffer(phost,SCISSOR_XY( posX, posY));
   App_WrCoCmd_Buffer(phost,SCISSOR_SIZE(sizeX,sizeY));
   
    App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
    App_WrCoCmd_Buffer(phost, CLEAR_TAG(1));
    App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(255,255,255));
       
    App_WrCoCmd_Buffer(phost, COLOR_A(255));
    App_WrCoCmd_Buffer(phost, COLOR_RGB(255,255,255));
    App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(Handle_Small));

    App_WrCoCmd_Buffer(phost,BITMAP_SOURCE(0));
    App_WrCoCmd_Buffer(phost,BITMAP_LAYOUT(imgFormat, (sizeX*2), sizeY));
    App_WrCoCmd_Buffer(phost,BITMAP_SIZE(NEAREST, BORDER, BORDER, sizeX, sizeY));   

    App_WrCoCmd_Buffer(phost,BEGIN(BITMAPS));
 //   App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(Handle_Small));
    App_WrCoCmd_Buffer(phost,VERTEX2F(posX<<4 , posY<<4));  // (posX * 16, posY * 16)

    //Start drawing bitmap
    App_WrCoCmd_Buffer(phost, END());
    App_WrCoCmd_Buffer(phost, RESTORE_CONTEXT());
    App_WrCoCmd_Buffer(phost, DISPLAY());
    Gpu_CoCmd_Swap(phost);
    App_Flush_Co_Buffer(phost);
    Gpu_Hal_WaitCmdfifo_empty(phost);
}
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 892
    • View Profile
Re: Basic Question - Image overlap
« Reply #5 on: September 04, 2020, 04:31:37 PM »

Hello,

It looks like you have loaded both images into the same section of RAM_G:
Gpu_Hal_WrCmdBufFromFlash(phost, p, imgSize);

You need to load these concurrently into RAM_G.
I would suggest loading both images into RAM_G at the beginning of your code, then you can select the desired image to be displayed upon touch. this should mitigate any issues with loading times for the images to RAM_G.

Best Regards,
FTDI Community
Logged