Recent

Author Topic: CanvasBGRA transparency  (Read 343 times)

petevick

  • Sr. Member
  • ****
  • Posts: 419
CanvasBGRA transparency
« on: October 04, 2024, 10:36:57 am »
Is there anyway of making a CanvasBGRA background transparent?. I'd want to be able to draw on the BGRABitmap but also draw on the BGRABitmap's CanvasBGRA, so to be able to see both means the CanvasBGRA needs to have a transparent background. Everything I've tried has resulted in a black background for the CanvasBGRA.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

circular

  • Hero Member
  • *****
  • Posts: 4356
    • Personal webpage
Re: CanvasBGRA transparency
« Reply #1 on: October 06, 2024, 03:16:10 pm »
Hello @petevick,

CanvasBGRA is a way of accessing the image and the image can have a transparent background. When you create the image, you can pass a color as parameter, or you can omit the parameter or use the value BGRAPixelTransparent. This way the image starts by being transparent.

CanvasBGRA is not a layer, so if you would like to manager layers, you need either to create multiple images, one for each layer and one for the merged result, or use a layered bitmap, like the TBGRALayeredImage class.

Regards
Conscience is the debugger of the mind

petevick

  • Sr. Member
  • ****
  • Posts: 419
Re: CanvasBGRA transparency
« Reply #2 on: October 06, 2024, 03:31:10 pm »
Thanks for reply circular, I'll see where the suggestions take me  ;)
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

 

TinyPortal © 2005-2018