on delphi/android how to draw a TbitmapSurface on a Canvas?

后端 未结 2 680
既然无缘
既然无缘 2021-01-28 08:36

Under delphi (and under firemonkey/android), What is the most fastest way to draw on a Tcanvas a TbitmapSurface ?

I try to use TTexture like MyTexture.Assign(aBitmapSur

2条回答
  •  迷失自我
    2021-01-28 09:17

    TBitmapSurface is in system memory so you need to assign your TBitmapSurface to a TBitmap first, to be converted to native OS bitmap (or texture) format that FMX uses for drawing:

    bmp.Assign(surf);
    

    Then draw the Bitmap to the canvas:

    canvas.BeginScene();
    canvas.DrawBitmap(bmp, SrcRect, DstRect, AOpacity);
    canvas.EndScene();
    

    I have tested it on Windows and Android. On android you need to call the Repaint too see the change.

提交回复
热议问题