BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Picture transparency on another picture  (Read 1306 times)

Rad

  • Newbie
  • *
  • Posts: 11
    • View Profile
Picture transparency on another picture
« on: April 02, 2024, 08:53:37 AM »

Hi,

I am trying to draw some pictures on another background (white/black color) on another background picture. However I am not able to make the overlaying picture with its background  being transparent.

The closest result I obtain with :
1. draw background image (ACTS),
2. BLEND_FUNC(ONE, ONE)
3. draw overlaying picrute.

But a problem is that the second picture is only visible with some transparency on dark areas of background image.

Can anyone advise how to achieve it?

Thanks in advance
« Last Edit: April 02, 2024, 10:31:48 AM by Rad »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 741
    • View Profile
Re: Picture transparency on another picture
« Reply #1 on: April 02, 2024, 03:27:16 PM »

Hello,

Thank you for your question.

It won't be necessary to blend the two images together using the BLEND_FUNC, this is what is causing the image to only show on the darker sections of the back ground image.

You can simply place one image on top of the other so long as the image has an appropriately transparent background, for example the below code places an ASTC image (motorbike) on top of background image:

Code: [Select]
BITMAP_HANDLE(0)
CMD_SETBITMAP(0, RGB565, 800, 480)
BEGIN(BITMAPS)
VERTEX2F(0, 0)
END()

BITMAP_HANDLE(1)
CMD_SETBITMAP(768000, COMPRESSED_RGBA_ASTC_4x4_KHR, 288, 164)
BEGIN(BITMAPS)
VERTEX2F(6112, 4208)
END()

Please see the attached .png for an example of the above code running in EVE Screen Editor.

Best Regards,
BRT Community
Logged

Rad

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Picture transparency on another picture
« Reply #2 on: April 03, 2024, 09:50:11 AM »

OK, this is simple when image has no background...
But what's the way if the image is jpg with a solid (say white/back) color background?

Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 741
    • View Profile
Re: Picture transparency on another picture
« Reply #3 on: April 03, 2024, 10:11:21 AM »

Hello,

Unfortunately it is not possible to achieve this with a JPEG as these are loaded into EVE as RGB565 bitmaps (or  L8) which do not include an alpha layer (transparency), this is required to make sections of images transparent.

As you have noted using a command such as blend, this effects the whole image because it cannot determine which sections are the background in a JPEG. It may be possible to utilise a second masking image to mask off the background in your JPEG and then use the STENCIL operation to only draw the section of the image that isn't masked, but this would require an image such as a PNG which utilises an alpha layer to be used as the mask. In this case it may be simpler to modify your original JPEG image in a image processor to include a transparent background and save this accordingly.

Best Regards,
BRT Community
Logged