![]() Make sure your code correctly converts PNG to TBitmap32.If you still prefer using TBitmap32, make the following sequence of steps: a slightly different implementation of the same algorithm as (1), and has the same issues as (1). (2) “LoadBitmap32FromPNG” from gr32ex library: Besides that, it doesn't convert correctly transparency from paletted images into the alpha layer of TBitmap32, for example, all white pixels become transparent. You can find more information on this issue here: Delphi, GR32 + PngObject: converting to Bitmap32 doesn't work as expected This code will first apply alpha to RGB and then sets alpha, so when you pain, alpha will be applied again. it applies the transparency twice, so the images with alpha values other than 0 or 255 will look differently than in other software (most noticeable on translucent images with glass effects). Here are the two examples of the incorrect code that is used most frequently: The second way is preferable when it comes to transparency, because the code that you may find to load a PNG into TBitmap32 may work incorrectly. Use TPngImage.Draw (implemented in with Delphi XE2 and later) directly on target Canvas, as you have pointed out. ![]() Load them into intermediary TBitmap32 bitmaps and then manipulate these TBitmap32 bitmaps.There are two ways of working with transparent PNG files:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |