-1
我有一个功能,采取android安装应用程序与他们的图标。该函数提取Jdrawable并将其转换为Jbitmap(并且为了测试这个函数,我将这个jbitmap保存到了文件中并且一切正常),但是如果我尝试将此jbitmap转换为Tbitmap,我在此行有访问冲突:位图转换德尔福xe5
如果Result.Map(TMapAccess.maWrite,的BitmapData)然后
function JBitmapToBitmap(const AImage: JBitmap): TBitmap;
var
ImageData: TJavaArray<Integer>;
BitmapData: TBitmapData;
Width, Height: Integer;
begin
Assert(AImage <> nil);
Width := AImage.getWidth;
Height := AImage.getHeight;
ImageData := TJavaArray<Integer>.Create(Width * Height);
AImage.getPixels(ImageData, 0, Width, 0, 0, Width, Height);
if Result.Map(TMapAccess.maWrite, BitmapData) then <--- access violation
try
Result := TBitmap.Create(Width, Height);
Move(ImageData.Data^, BitmapData.Data^, Width * Height * SizeOf(Integer));
finally
Result.Unmap(BitmapData);
end
else
Result := nil;
end;
我敢肯定的是,jBitmap没有损坏,因为如果我保存到文件的Jbitmap,我可以看到它好。
在此先感谢
哦谢谢,这是一个愚蠢的错误! – user1931849