procedure TForm1.PaintTest1;
var
bmp: TBGRABitmap;
layer: TBGRABitmap;
i, j, ww, hh: integer;
p1, p2: TPointF;
c1, c2: TBGRAPixel;
co: integer;
begin
bmp := TBGRABitmap.Create(Width, Height, BGRAWhite);
ww := bmp.Width;
hh := bmp.Height;
//------------------
for i := 1 to 5 do
begin
case i of
1:
begin
c1 := BGRA(179, 130, 210, 255);
c2 := BGRA(255, 255, 255, 255);
p1 := PointF(-ww / 5, -hh / 5);
p2 := PointF(ww, hh);
co := 2;
end;
2:
begin
c1 := BGRA(49, 206, 148, 255);
c2 := BGRA(255, 255, 255, 255);
p1 := PointF(ww / 3, hh * 1.1);
p2 := PointF(0, 0);
co := 2;
end;
3:
begin
c1 := BGRA(131, 198, 57, 255);
c2 := BGRA(255, 255, 255, 255);
p1 := PointF(ww * 1.1, hh / 2);
p2 := PointF(ww * 0.2, hh / 2);
co := 2;
end;
4:
begin
c1 := BGRABlack;
c2 := BGRA(255, 255, 255, 255);
p1 := PointF(ww, -hh / 2);
p2 := PointF(ww / 2, hh / 2);
co := 1;
end;
5:
begin
c1 := BGRA(0, 0, 0, 0);
c2 := BGRAWhite;
p1 := PointF(-ww / 5, hh * 1.2);
p2 := PointF(ww / 4, hh * 4 / 5);
co := 3;
end;
end;
layer := TBGRABitmap.Create(bmp.Width, bmp.Height);
layer.GradientFill(0, 0, layer.Width, layer.Height, c1, c2, gtRadial, p1, p2, dmSet);
for j := 1 to co do
begin
bmp.BlendImage(0, 0, layer,boMultiply);
end;
layer.Free;
end;
//------------------
bmp.Draw(Panel2.Canvas, 0, 0);
bmp.SaveToFile('BlendImage.png');
bmp.Free;
end;