попробуем продолжить, на стареньком но не очень уж мертвом устройстве загрузка файла происходит катострофически невероятно долго. нашел более менее нормальный по скорости способ. но и тут не так все хорошо может ктото поймет в чем дело:
procedure JBitmapToBitmap(const AImage: JBitmap; const ResBitmap: TBitmap);
var
ImageData: TJavaArray<Integer>;
BitmapData: TBitmapData;
Width, Height: Integer;
begin
Width := AImage.getWidth;
Height := AImage.getHeight;
try
ImageData := TJavaArray<Integer>.Create(Width * Height);
ResBitmap.SetSize(Width,Height);
AImage.getPixels(ImageData, 0, Width, 0, 0, Width, Height);
if ResBitmap.Map(TMapAccess.maWrite, BitmapData) then
try
Move(ImageData.Data^, BitmapData.Data^, Width * Height * SizeOf(Integer));
finally
ResBitmap.Unmap(BitmapData);
end else
ResBitmap.Clear(TAlphaColorRec.Green);
except
ResBitmap.Clear(TAlphaColorRec.Green);
end;
end;
function calculateInSampleSize(options:JBitmapFactory_Options; reqWidth, reqHeight:integer):integer;
var
nh,nw:integer;
heightRatio,widthRatio:integer;
begin
nh:=options.outHeight;
nw:=options.outWidth;
result:=1;
if (nh> reqHeight) or (nw > reqWidth) then
begin
heightRatio:=round( nh / reqHeight);
widthRatio:= round(nw /reqWidth);
if heightRatio<widthRatio then
Result:=heightRatio else
Result:=widthRatio;
end;
end;
var
cur_bitmap:JBitmap;
bitmap_option:JBitmapFactory_Options;
cf_path:string;
begin
bitmap_option:=TJBitmapFactory_Options.JavaClass.init;
bitmap_option.inJustDecodeBounds := true;
TJBitmapFactory.JavaClass.decodeFile(StringToJString(cf_path),bitmap_option);
bitmap_option.inSampleSize := calculateInSampleSize(bitmap_option, Round(Image5.Width), Round(Image5.Height));
bitmap_option.inJustDecodeBounds := false;
try
cur_bitmap:=TJBitmapFactory.JavaClass.decodeFile(StringToJString(cf_path),bitmap_option);
except
cur_bitmap:=nil;
end;
if Assigned(cur_bitmap) then
JBitmapToBitmap(cur_bitmap,Image5.Bitmap);
end;
таким образом все просто шикарно, загрузка мгновенно все норм кроме одного, вместо синего - красный, не знаю как решить