Help needed

From: AHM (ingen_at_spam.tak)
Date: 01/14/05


Date: Fri, 14 Jan 2005 19:20:17 +0100

Why can't I skip the loading of a background bitmap? If I don't include
that line then nothing will be drawn on the image. If I remove

  Bitmap.LoadFromFile('images\background.bmp');

is there then some properties I should set myself for the code to work?

begin
  Image := TImage.Create(nil);
  Image.Left := 0;
  Image.Parent := MyForm;
  Image.Top := 0;

  Bitmap := TBitmap.Create;
  Bitmap.LoadFromFile('images\background.bmp'); // This line

  GIF := TGIFImage.Create;
  GIF.LoadFromFile('images\piece.gif');

  Piece := TBitmap.Create;
  Piece.Assign(GIF.Bitmap);

  GIF.Free;

  for X := 0 to Piece.Width - 1 do
    for Y := 0 to Piece.Height - 1 do
      if (Piece.Canvas.Pixels[X, Y] <> clWhite) then
          Bitmap.Canvas.Pixels[X, Y] := Piece.Canvas.Pixels[X, Y];

  Piece.Free;

  Image.Picture.Assign(Bitmap);
end;