[emWin]How do I output a bmp image with a transparent color to the LCD?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • [emWin]How do I output a bmp image with a transparent color to the LCD?

      Dear all,
      I'd like to print the bmp-picture with transparent RGB-color value(0xFF00FF) on the background bmp and then print them all on the LCD.
      How do I implement it with emWin?

      image-data(testbg.bmp and num_w....bmp) are 16bit, 565 formated bmp.

      When I try test_trans1 function as below , transparent area also printed on lcd.

      //-----------------------TEST CODE--------------------//
      void test_trans1(....){
      GUI_SelectLayer(1);
      hMem = GUI_MEMDEV_CreateEx(x0, y0, xSize, ySize, GUI_MEMDEV_HASTRANS);
      GUI_MEMDEV_Select(hMem);

      GUI_SetBkColor(0xFFFF00FF);//Transparent Color?
      ...
      ..
      for(int i=0; i< max_images; i++){
      // set "bm_array" and "Bmp" with bmp-info
      GUI_DrawBitmap( (GUI_BITMAP*)&bm_array, &Bmp[i]->Left, (&Bmp[i]->Top) );
      }
      GUI_MEMDEV_Select(0);
      GUI_MEMDEV_CopyToLCD(hMem);
      GUI_MEMDEV_Delete(hMem);
      }
      //----------------------------------------------------------//

      Do anyone happen to know what's problem on emWin lib?

      Actually this kind of job to manipulate transparent color, is not that difficult,
      but It's frustrating that I can't check inside of draw function.

      Thanks in advance for your help.
      Best Regards,
      Tommy
      Files
      • testbg.bmp

        (1.11 kB, downloaded 215 times, last: )
      • num_w_transcolor.bmp

        (1.11 kB, downloaded 229 times, last: )

      The post was edited 2 times, last by Tommy lim ().

    • Hi,

      I'm wondering if "bm_array" is an actual BMP image file? Please note that the GUI_DrawBitmap() function is only for C bitmaps (the GUI_BITMAP structure), not actual BMP files.

      BMP images have to be drawn with the GUI_BMP_... API functions. You can find an example in our wiki on how to draw a BMP image file.

      Best regards,
      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.