ich hab da mal was zusammengeschrieben...einfach ein TImage aufs form, ein bitmap reinladen und folgende Methode mit einbauen:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var bmp_mask,bmp_tmp:TBitmap;
const cl_trans_tmp=clWhite;
cl_trans=clFuchsia;
begin
bmp_mask:=TBitmap.create;
bmp_tmp:=TBitmap.create;
//load bitmap
bmp_tmp.Assign(image1.picture.bitmap);
//resize mask
bmp_mask.width:=bmp_tmp.width;
bmp_mask.height:=bmp_tmp.height;
//create the mask;
bmp_mask.canvas.brush.color:=cl_trans;
bmp_mask.canvas.Pen.color:=cl_trans;
bmp_mask.Canvas.FillRect(rect(0,0,bmp_mask.width,bmp_mask.height));
bmp_mask.canvas.brush.color:=cl_trans_tmp;
bmp_mask.canvas.Pen.color:=cl_trans_tmp;
bmp_mask.canvas.ellipse(0,0,bmp_mask.width,bmp_mask.height);
bmp_mask.TransparentColor:=cl_trans_tmp;
bmp_mask.Transparent:=true;
//merging the mask with original bitmap
bmp_tmp.Canvas.Draw(0,0,bmp_mask);
bmp_tmp.TransparentColor:=cl_trans;
bmp_tmp.Transparent:=true;
//Draw masked bitmap
canvas.draw(0,0,bmp_tmp);
//free Objects
bmp_tmp.free;
bmp_mask.free;
end;
Gruß Frank