Recent

Author Topic: Is it possible to achieve bitmap transparency in android?  (Read 4778 times)

stab

  • Full Member
  • ***
  • Posts: 237
Is it possible to achieve bitmap transparency in android?
« on: April 08, 2013, 12:30:15 pm »
Hi,

Tried the following with no luck:
  Bitmap:= TBitmap.Create;
  Bitmap.LoadFromFile('MyBitmap.bmp');
  Bitmap.Transparent := true;
  Bitmap.TransparentColor:=Bitmap.Canvas.Pixels[0, 0];

  PaintBox1.Canvas.Draw(
    (PaintBox1.Width  - Bitmap.Width) div 2,
    (PaintBox1.Height  - Bitmap.Height) div 2,
     Bitmap);

Am I doing something wrong or is transparency not possible in android?

/stab %)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Is it possible to achieve bitmap transparency in android?
« Reply #1 on: April 08, 2013, 07:16:07 pm »
Possibly a missing feature.

If you use TLazIntfImage then you can have alpha transparency: http://wiki.freepascal.org/Developing_with_Graphics#Working_with_TLazIntfImage.2C_TRawImage_and_TLazCanvas

TLazCanvas has some special blending routines which support color transparency among other things.

stab

  • Full Member
  • ***
  • Posts: 237
Re: Is it possible to achieve bitmap transparency in android?
« Reply #2 on: April 09, 2013, 07:32:21 am »
Thanks alot for answering felipemdc, I'll try your suggestion.

/stab ::)

 

TinyPortal © 2005-2018