JBreits
asked on
Transparent parts for Bitmaps in D1
I'm using Delphi 1 and I was wondering if anyone could supply
my with some source code that would show me how to bring
a bitmap onto my form and not display one of the colors in the
bitmap, so that I can see what would normally be hidden
by that color. It also needs to be done quickly.
Thanks,
JBreits
my with some source code that would show me how to bring
a bitmap onto my form and not display one of the colors in the
bitmap, so that I can see what would normally be hidden
by that color. It also needs to be done quickly.
Thanks,
JBreits
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var
bmp : TBitmap;
procedure DoTrans(DestForm : TForm; var Bmp : TBitmap; Col : TColor);
var
x,y : Integer;
begin
for y := 0 to Bmp.Height - 1 do
for x := 0 to Bmp.Width - 1 do
if Bmp.Canvas.Pixels[x,y] = Col then
Bmp.Canvas.Pixels[x,y] := DestForm.Color;
end;
procedure TForm1.Button1Click(Sender
begin
DoTrans(Form1, bmp, clBlack);
Canvas.Draw(100,100, bmp);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp := TBitmap.Create;
bmp.LoadFromFile('C:\windo
end;
procedure TForm1.FormDestroy(Sender:
begin
bmp.Free;
end;
procedure TForm1.FormMouseDown(Sende
Shift: TShiftState; X, Y: Integer);
begin
Edit1.Text := Format('%d',[Canvas.Pixels
end;
Hope this helps...
Cheers,
Viktor