TImage32.CopyToBitmap

procedure CopyToBitmap(bmp: TBitmap; dstLeft: integer = 0; dstTop: integer = 0);


Blend copies the image onto the specified bitmap at the specified position.

Note 1: Generally it's much more efficient to draw directly onto a TCanvas (rather than drawing to a TBitmap and then drawing that bitmap onto a Canvas). Therefore this method should only be used in applications that must use TBitmap objects.

Note 2: This method will only be accessible when compiling Windows VCL applications.

Example

  uses Img32, Img32.Fmt.PNG;
  ...
var
  img: TImage32;
  bmp: TBitmap;
begin
  img := TImage32.Create;
  bmp := TBitmap.Create;
  try
    img.LoadFromResource('Beetle', 'PNG');
    with bmp do
    begin
      SetSize(img.Width, img.Height);
      Canvas.Brush.Color := clBtnFace;
      Canvas.FillRect(Rect(0,0,Width,Height));
    end;
    img.CopyToBitmap(bmp);
    // and now do something with 'bmp' ...
  finally
    img.Free;
    bmp.Free;
  end;