I need to add a transparent border around the image and then a solid border around the transparent border:
procedure TForm1.ButtonAddBorderOneClick(Sender: TObject);
begin
// Add a transparent border around the image:
ImageEnView1.IEBitmap.Resize(
ImageEnView1.IEBitmap.Width + 20, ImageEnView1.IEBitmap.Height + 20, clRed, 0, iehCenter, ievCenter );
ImageEnView1.Update;
end;
procedure TForm1.ButtonAddBorderTwoClick(Sender: TObject);
begin
// Then add a solid border around the transparent border:
ImageEnView1.IEBitmap.Resize(
ImageEnView1.IEBitmap.Width + 20, ImageEnView1.IEBitmap.Height + 20, clBlack, 255, iehCenter, ievCenter );
ImageEnView1.Update;
end;
However, this has undesired side effects on the transparent areas of the image (including the transparent border)!
Here is a test project demonstrating this:
attach/PeterPanino/2024222111448_BorderTest.zip
76.52 KB
How can this be prevented?