[SOLVED] Does TLazIntfImage.AlphaBlend not work on Linux? lazarus / 39-Graphics ---------------------------------------------------------------------- Aistis · 2024-01-08 07:48 Hello, I'm making an image editor for pixel art graphics as a hobby and I am moving from working purely with TBitmap to working with TLazIntfImage. On Windows, this code runs without problems and works as expected by blending a transparent ImageDataDrawPreview onto ImageData: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i combined := TLazIntfImage.Create(0, 0);combined.DataDescription := GetDescriptionFromDevice(0);combined.SetSize(ImageData.Width, ImageDat a.Height);combined.CopyPixels(ImageData);combined.AlphaBlend(ImageData DrawPreview, nil, 0, 0);DrawCanvas.Picture.Bitmap.LoadFromIntfImage(co mbined);FreeAndNil(combined); On Linux Mint 21.2 and Debian 12 however, it doesn't blend and AlphaBlend instead makes the whole image black. Does anybody have any ideas, fixes, or workarounds for this? ---------------------------------------------------------------------- wp · 2024-01-08 11:39 Can you post a small project? Found the attached project on my disk which demonstrates blending of two TLazIntfImages, and I just checked that it works in Mint 21.1 as well as in Windows. However, it does not directly call TLazIntfImage.AlphaBlend and does the blending manually, but this is essentially the same code as in AlphaBlend. ---------------------------------------------------------------------- Aistis · 2024-01-08 12:10 Quote from: wp on January 08, 2024, 12:39:25 pmCan you post a small project? Here's a small project and a demonstration of applying a transparent image over a white image which makes it black on Linux Mint 21.2. ---------------------------------------------------------------------- wp · 2024-01-08 15:08 It seems that the Description is not created with Alpha channel by calling GetDescriptionFromDevice(0). I added AddAlphaToDescription, and then it works in both Windows and Mint: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.AlphaBlendTest;var  combined: TLazIntfImage;  d: TRawImageDescription;begin  ImageData := TLazIntfImage.Create(0, 0);  ImageData.DataDescription := GetDescriptionFromDevice(0);  d := ImageData.DataDescription;  AddAlphaToDescription(d, 8);  ImageData.DataDescription := d;   ImageData.SetSize(128, 128);  ImageData.FillPixels(colRed); //White);   ImageDataDrawPreview := TLazIntfImage.CreateCompatible(ImageData, ImageData.Width, ImageData.Height);  ImageDataDrawPreview.FillPixels(FPColor($FFFF, $FFFF, $FFFF, $7F7F));   combined := TLazIntfImage.CreateCompatible(ImageData, ImageData.Width, ImageData.Height);  combined.CopyPixels(ImageData);  if TestAlphaBlend then    combined.AlphaBlend(ImageDataDrawPreview, nil, 0, 0);   Image1.Picture.Bitmap.LoadFromIntfImage(combined);   FreeAndNil(combined);  FreeAndNil(ImageData);  FreeAndNil(ImageDataDrawPreview);end; ---------------------------------------------------------------------- Aistis · 2024-01-08 15:41 Quote from: wp on January 08, 2024, 04:08:41 pmIt seems that the Description is not created with Alpha channel by calling GetDescriptionFromDevice(0). I added AddAlphaToDescription, and then it works in both Windows and Mint: Thank you, it seems to be working now. Marking as solved.