Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience procedure AssignImage32ToFmxCanvas #95

Open
andre2007 opened this issue Sep 8, 2024 · 0 comments
Open

Convenience procedure AssignImage32ToFmxCanvas #95

andre2007 opened this issue Sep 8, 2024 · 0 comments

Comments

@andre2007
Copy link

Maybe this convenience procedure makes sense here

procedure AssignImage32ToFmxCanvas(Img32: TImage32;
  canvas: TCanvas);
var
  bmp: TBitmap;
  rec: TRectF;
begin
  bmp := TBitmap.Create;
  try
    AssignImage32ToFmxBitmap(Img32, bmp);
    rec := RectF(0, 0, bmp.Width, bmp.Height);
    canvas.BeginScene();
    canvas.Lock;
    canvas.DrawBitmap(bmp, rec, rec, 1.0);
    canvas.Unlock;
    canvas.EndScene();
  finally
    bmp.Free;
  end;
end;

Usages example:

  Img32 := TImage32.Create;
  Img32.LoadFromStream(ms);
  AssignImage32ToFmxCanvas(Img32, Image1.Canvas);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant