Commit 10c4e265 authored by 林生雨's avatar 林生雨

commit

parent cd754ca8
......@@ -280,6 +280,7 @@
</component>
<component name="ToolWindowManager">
<frame x="-7" y="30" width="1440" height="825" extended-state="6" />
<editor active="$ENABLE_FLUTTER_DESKTOP$" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="$ENABLE_FLUTTER_DESKTOP$" weight="0.19742489" />
<window_info id="Captures" order="1" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
......@@ -296,7 +297,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.42837274" />
<window_info anchor="bottom" id="Debug" order="5" weight="0.32962447" />
<window_info active="$ENABLE_FLUTTER_DESKTOP$" anchor="bottom" id="Terminal" order="6" visible="$ENABLE_FLUTTER_DESKTOP$" weight="0.5607094" />
<window_info anchor="bottom" id="Terminal" order="6" weight="0.5607094" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
<window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
<window_info anchor="bottom" id="Version Control" order="9" />
......
......@@ -526,24 +526,37 @@ PHImageRequestOptions *baseImageRequestOption;
PHAsset * assets=self.scanMap[path];
@autoreleasepool{
CFAbsoluteTime startTime =CFAbsoluteTimeGetCurrent();
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:baseImageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime);
NSLog(@"requestImageDataForAsset Time %f ms", linkTime *1000.0);
NSData *imageDataW = nil;
if ([dataUTI isEqualToString:@"public.heif"] || [dataUTI isEqualToString:@"public.heic"]) {
CIImage *ciImage = [CIImage imageWithData:imageData];
CIContext *context = [CIContext context];
NSData *jpgData = [context JPEGRepresentationOfImage:ciImage colorSpace:ciImage.colorSpace options:@{}];
imageDataW = jpgData;
} else {
imageDataW = imageData;
}
// if ([imageDataW length] / (1024 * 1024) > 3.0) {
// imageDataW = [[UIImage imageWithData: imageDataW] c]; //图片大于3M压缩操作,可不调用此方法
// }
//UIImageJPEGRepresentation([UIImage imageWithData:imageDataW], 1.0)
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[FlutterStandardTypedData typedDataWithBytes:imageDataW]];
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
int max=MAX(picWidth, picHeight);
if(max>1960){
tempScareSize=1960/max;
}
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
[[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:baseImageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime);
NSLog(@"requestImageDataForAsset Time %f ms", linkTime *1000.0);
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[FlutterStandardTypedData typedDataWithBytes:UIImageJPEGRepresentation(result, 1.0)]];
}];
// [[PHImageManager defaultManager] requestImageDataForAsset:assets options:baseImageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
// CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime);
// NSLog(@"requestImageDataForAsset Time %f ms", linkTime *1000.0);
// NSData *imageDataW = nil;
// if ([dataUTI isEqualToString:@"public.heif"] || [dataUTI isEqualToString:@"public.heic"]) {
// CIImage *ciImage = [CIImage imageWithData:imageData];
// CIContext *context = [CIContext context];
// NSData *jpgData = [context JPEGRepresentationOfImage:ciImage colorSpace:ciImage.colorSpace options:@{}];
// imageDataW = jpgData;
// } else {
// imageDataW = imageData;
// }
//// if ([imageDataW length] / (1024 * 1024) > 3.0) {
//// imageDataW = [[UIImage imageWithData: imageDataW] c]; //图片大于3M压缩操作,可不调用此方法
//// }
// //
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[FlutterStandardTypedData typedDataWithBytes:imageDataW]];
// }];
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
@autoreleasepool{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment