General Category > Discussion - EVE

Picture transparency on another picture

(1/1)

Rad:
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

BRT Community:
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: ---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()
--- End code ---

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

Best Regards,
BRT Community

Rad:
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?

BRT Community:
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

Navigation

[0] Message Index

Go to full version