function IsWhite(Color32: TColor32): Boolean;
begin
Result:= (TColor32Entry(Color32).B = 255) and
(TColor32Entry(Color32).G = 255) and
(TColor32Entry(Color32).R = 255);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
with Image321 do
begin
Bitmap.ResetAlpha;
for Y := 0 to Bitmap.Height-1 do
for X := 0 to Bitmap.Width-1 do
begin
if IsWhite(Bitmap.Pixel[X, Y]) then
Bitmap.Pixel[X,Y]:=Color32(255,255,255,0);
end;
Png:= TPortableNetworkGraphic32.Create;
Png.Assign(Bitmap);
Png.SaveToFile('C:\Temp\NowTransparent.png');
Png.Free;
end;
end;
procedure TForm1.Button8Click(Sender: TObject); // Paint the barcode
var
bmp: TBitmap32;
Coords: TRect;
begin
bmp := TBitmap32.Create;
bmp.SetSize(image.Width, image.Height);
bmp.Canvas.Brush.Color := color;
bmp.Canvas.Rectangle(-1, -1, image.Width+2, image.Height+2);
bmp.DrawMode := dmTransparent;
bmp.OuterColor := $F0F0F0;
// bmp.OuterColor := image.Bitmap.Pixel[0,0];
// make Coords the size of image
Coords := Rect(0,0,image.Width,image.Height);
// psBarcodeComponent1.Options := [boTransparent];
psBarcodeComponent1.PaintBarCode(bmp.Canvas, Coords);
image.Bitmap.Assign(bmp);
end;
Page created in 0.015 seconds with 19 queries.