@predy-js/render-interface 0.3.0-beta.145 → 0.3.0-beta.147

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/dist/statistic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.0-beta.145
5
+ * Version: v0.3.0-beta.147
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -1,5 +1,5 @@
1
1
  import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
2
- import type { TypedArray } from '../type';
2
+ import type { TypedArray, vec2 } from '../type';
3
3
  import type { GPUCapability } from '../GPUCapability';
4
4
  import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
5
5
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
@@ -21,6 +21,8 @@ export interface PredyRequestResponse {
21
21
  time: number;
22
22
  }
23
23
  export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
24
+ export declare const DataCompressMethodZlib = 1;
25
+ type DataCompressMethod = typeof DataCompressMethodZlib;
24
26
  export interface PredyNativeInternal {
25
27
  webpDisabled?: boolean;
26
28
  createImageBitmap(data: TypedArray | string, //图片文件的数据
@@ -53,6 +55,25 @@ export interface PredyNativeInternal {
53
55
  * @param callback
54
56
  */
55
57
  evaluateScriptURL(url: string, callback: (err: Error, result: any) => void): void;
58
+ /**
59
+ * 将float32Array转换为half float,写入Uint16Array中,
60
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
61
+ * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
62
+ * 如果source和target的长度不匹配,返回false
63
+ */
64
+ float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean;
65
+ /**
66
+ * 将half float转换为float32,通过Float32Array返回,
67
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
68
+ * 如果没有提供,float16会被直接转化为float32
69
+ * 如果source和target的长度不匹配,返回false
70
+ */
71
+ float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean;
72
+ /**
73
+ * 解压数据
74
+ * @param data
75
+ */
76
+ deflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined;
56
77
  }
57
78
  type renderSDFImageCallback = (img: SDFImage) => void;
58
79
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.0-beta.145",
3
+ "version": "0.3.0-beta.147",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -1,5 +1,5 @@
1
1
  import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
2
- import type { TypedArray } from '../type';
2
+ import type { TypedArray, vec2 } from '../type';
3
3
  import type { GPUCapability } from '../GPUCapability';
4
4
  import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
5
5
  import type { ImageBitmapInternal } from './ImageBitmapInternal';
@@ -29,6 +29,10 @@ export interface PredyRequestResponse {
29
29
 
30
30
  export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
31
31
 
32
+ export const DataCompressMethodZlib = 1;
33
+
34
+ type DataCompressMethod = typeof DataCompressMethodZlib;
35
+
32
36
  export interface PredyNativeInternal {
33
37
  webpDisabled?: boolean,
34
38
 
@@ -67,6 +71,28 @@ export interface PredyNativeInternal {
67
71
  * @param callback
68
72
  */
69
73
  evaluateScriptURL (url: string, callback: (err: Error, result: any) => void): void,
74
+
75
+ /**
76
+ * 将float32Array转换为half float,写入Uint16Array中,
77
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
78
+ * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
79
+ * 如果source和target的长度不匹配,返回false
80
+ */
81
+ float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean,
82
+
83
+ /**
84
+ * 将half float转换为float32,通过Float32Array返回,
85
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
86
+ * 如果没有提供,float16会被直接转化为float32
87
+ * 如果source和target的长度不匹配,返回false
88
+ */
89
+ float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean,
90
+
91
+ /**
92
+ * 解压数据
93
+ * @param data
94
+ */
95
+ deflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined,
70
96
  }
71
97
 
72
98
  type renderSDFImageCallback = (img: SDFImage) => void;