uses
Androidapi.JNI.GraphicsContentViewText,
FMX.Helpers.Android,
FMX.Surfaces;
//JBitmap转Bitmap
function JBitmapToBitmap(const AImage: JBitmap): TBitmap;
var
bitmapSurface :TBitmapSurface;
begin
bitmapSurface := TBitmapSurface.Create;
try
if JBitmapToSurface(AImage, bitmapSurface) then
begin
Result.Assign(bitmapSurface);
end;
finally
bitmapSurface.Free;
end;
end;
//Bitmap转JBitmap
function BitmapToJBitmap(Bmp:TBitmap): JBitmap;
var
mBitmap: JBitmap;
Surface: TBitmapSurface;
begin
Surface := TBitmapSurface.Create;
Surface.Assign(bmp);
mBitmap := TJBitmap.JavaClass.createBitmap(Bmp.Width, Bmp.Height, TJBitmap_Config.JavaClass.ARGB_8888);
if SurfaceToJBitmap(Surface, mBitmap) then
Result := mBitmap;
end;
————————————————
版权声明:本文为CSDN博主「郁闷的坦然」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/cmdasm/java/article/details/78530004