@react-native-ohos/react-native-image-crop-picker 0.40.5-rc.7 → 0.40.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/harmony/image_crop_picker/oh-package.json5 +1 -1
- package/harmony/image_crop_picker/src/main/ets/ImageCropPickerTurboModule.ts +26 -25
- package/harmony/image_crop_picker/src/main/ets/pages/CircleImageInfo.ets +1 -1
- package/harmony/image_crop_picker/src/main/ets/pages/ImageEditInfo.ets +1074 -179
- package/harmony/image_crop_picker/src/main/ets/utils/EncodeUtil.ets +1 -5
- package/harmony/image_crop_picker.har +0 -0
- package/package.json +1 -1
- package/react-native-ohos-react-native-image-crop-picker-0.40.5-rc.7.tgz +0 -0
|
@@ -10,7 +10,6 @@ import util from '@ohos.util';
|
|
|
10
10
|
|
|
11
11
|
const TAG: string = 'imageEdit_Encode';
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
export async function encode(component: Object, pixelMap: ESObject) : Promise<string> {
|
|
15
14
|
let imgPath: string = '';
|
|
16
15
|
const newPixelMap: ESObject = pixelMap;
|
|
@@ -20,13 +19,10 @@ export async function encode(component: Object, pixelMap: ESObject) : Promise<st
|
|
|
20
19
|
quality: Constants.ENCODE_QUALITY
|
|
21
20
|
}
|
|
22
21
|
let packerData = await imagePackerApi.packing(newPixelMap, packOptions);
|
|
23
|
-
Logger.info(TAG, 'into compressPictures data: ' + JSON.stringify(packerData));
|
|
24
22
|
const context = getContext(component);
|
|
25
23
|
imgPath = context.tempDir + '/rn_image_crop_picker_lib_temp_' + util.generateRandomUUID(true) + Constants.IMAGE_FORMAT;
|
|
26
24
|
let newFile = fs.openSync(imgPath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
|
|
27
|
-
Logger.info(TAG, 'into compressPictures newFile id: ' + newFile.fd);
|
|
28
25
|
const number = fs.writeSync(newFile.fd, packerData);
|
|
29
|
-
Logger.info(TAG, 'into compressPictures write data to file succeed size: ' + number);
|
|
30
26
|
fs.closeSync(newFile.fd);
|
|
31
27
|
imagePackerApi.release();
|
|
32
28
|
return imgPath;
|
|
@@ -39,7 +35,7 @@ export async function encodeToPng(component: Object, pixelMap: ESObject): Promis
|
|
|
39
35
|
const imagePackerApi = image.createImagePacker()
|
|
40
36
|
const packOptions: image.PackingOption = {
|
|
41
37
|
format: Constants.ENCODE_FORMAT_PNG, // 使用PNG格式
|
|
42
|
-
quality:
|
|
38
|
+
quality: Constants.ENCODE_QUALITY // PNG质量参数可能无效,但保留
|
|
43
39
|
}
|
|
44
40
|
let packerData = await imagePackerApi.packing(newPixelMap, packOptions)
|
|
45
41
|
Logger.info(TAG, 'into PNG encode data size: ' + packerData.byteLength)
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|