@predy-js/render-interface 0.3.0-beta.190 → 0.3.0-beta.191

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.190
5
+ * Version: v0.3.0-beta.191
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -23,6 +23,10 @@ export interface PredyRequestResponse {
23
23
  export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
24
24
  export declare const DataCompressMethodZlib = 1;
25
25
  type DataCompressMethod = typeof DataCompressMethodZlib;
26
+ export declare enum PredyTextEncoding {
27
+ utf8 = 0,
28
+ ascii = 1
29
+ }
26
30
  export interface PredyNativeInternal {
27
31
  webpDisabled?: boolean;
28
32
  createImageBitmap(data: TypedArray | string, //图片文件的数据
@@ -30,49 +34,51 @@ export interface PredyNativeInternal {
30
34
  getDefaultGPUCapability(): GPUCapability;
31
35
  requestWithCache(options: PredyRequestOptions, callback: PredyRequestCallback): void;
32
36
  /**
33
- * decode utf8 text from data
34
- * @param data
35
- */
36
- decodeText(data: Uint8Array): string;
37
+ * decode text from data
38
+ * @param data
39
+ * @param encoding 默认utf8
40
+ */
41
+ decodeText(data: Uint8Array, encoding?: PredyTextEncoding): string;
37
42
  /**
38
- * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
39
- * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
40
- * 将images绘制到画布上,images的尺寸由image.frame决定
41
- * 将数据模板content绘制到画布上,使用variables替换文案
42
- * @param template
43
- */
43
+ * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
44
+ * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
45
+ * 将images绘制到画布上,images的尺寸由image.frame决定
46
+ * 将数据模板content绘制到画布上,使用variables替换文案
47
+ * @param template
48
+ */
44
49
  renderImageTemplate(template: PredyResizeTemplate): ImageBitmapInternal;
45
50
  /**
46
- * 异步绘制图片的模板
47
- * @param options
48
- * @param callback 如果传入callback就是异步绘制,否则会直接返回结果
49
- */
51
+ * 异步绘制图片的模板
52
+ * @param options
53
+ * @param callback 如果传入callback就是异步绘制,否则会直接返回结果
54
+ */
50
55
  generateSDFImage(options: SDFImageOptions, callback?: renderSDFImageCallback): SDFImage | undefined;
51
56
  /**
52
- * 下载并且执行脚本文件,此方法会缓存https的脚本内容
53
- * 对于http的请求(开发环境),每次都重新请求
54
- * @param url
55
- * @param callback
56
- */
57
+ * 下载并且执行脚本文件,此方法会缓存https的脚本内容
58
+ * 对于http的请求(开发环境),每次都重新请求
59
+ * @param url
60
+ * @param callback
61
+ */
57
62
  evaluateScriptURL(url: string, callback: (err: Error, result: any) => void): void;
58
63
  /**
59
- * 将float32Array转换为half float,写入Uint16Array中,
60
- * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
61
- * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
62
- * 如果source和target的长度不匹配,返回false
63
- */
64
+ * 将float32Array转换为half float,写入Uint16Array中,
65
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
66
+ * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
67
+ * 如果source和target的长度不匹配,返回false
68
+ */
64
69
  float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean;
65
70
  /**
66
- * 将half float转换为float32,通过Float32Array返回,
67
- * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
68
- * 如果没有提供,float16会被直接转化为float32
69
- * 如果source和target的长度不匹配,返回false
70
- */
71
+ * 将half float转换为float32,通过Float32Array返回,
72
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
73
+ * 如果没有提供,float16会被直接转化为float32
74
+ * 如果source和target的长度不匹配,返回false
75
+ */
71
76
  float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean;
72
77
  /**
73
- * 解压数据
74
- * @param data
75
- */
78
+ * 解压数据
79
+ * @param data
80
+ * @param method
81
+ */
76
82
  inflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined;
77
83
  }
78
84
  type renderSDFImageCallback = (img: SDFImage) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.0-beta.190",
3
+ "version": "0.3.0-beta.191",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -16,6 +16,7 @@ export interface PredyRequestOptions {
16
16
  //使用系统网络库(仅用于试验)
17
17
  useSystemNetwork?: boolean,
18
18
  }
19
+
19
20
  export enum PredyResourceCacheStatus {
20
21
  noCache = 0, // 没有缓存,走网络请求
21
22
  cached = 1, // 命中缓存,如果请求同一个url,在关闭APP之前,一定会命中缓存,关闭APP后,清理时间由系统决定
@@ -34,65 +35,73 @@ export const DataCompressMethodZlib = 1;
34
35
 
35
36
  type DataCompressMethod = typeof DataCompressMethodZlib;
36
37
 
38
+ export enum PredyTextEncoding {
39
+ utf8 = 0,
40
+ ascii = 1,
41
+ }
42
+
37
43
  export interface PredyNativeInternal {
38
44
  webpDisabled?: boolean,
39
45
 
40
- createImageBitmap (data: TypedArray | string, //图片文件的数据
46
+ createImageBitmap(data: TypedArray | string, //图片文件的数据
41
47
  options: ImageBitmapConstructor, callback: ImageBitmapCallback): void,
42
48
 
43
- getDefaultGPUCapability (): GPUCapability,
49
+ getDefaultGPUCapability(): GPUCapability,
44
50
 
45
- requestWithCache (options: PredyRequestOptions, callback: PredyRequestCallback): void,
51
+ requestWithCache(options: PredyRequestOptions, callback: PredyRequestCallback): void,
46
52
 
47
53
  /**
48
- * decode utf8 text from data
49
- * @param data
50
- */
51
- decodeText(data: Uint8Array): string,
54
+ * decode text from data
55
+ * @param data
56
+ * @param encoding 默认utf8
57
+ */
58
+ decodeText(data: Uint8Array, encoding?: PredyTextEncoding): string,
59
+
52
60
  /**
53
- * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
54
- * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
55
- * 将images绘制到画布上,images的尺寸由image.frame决定
56
- * 将数据模板content绘制到画布上,使用variables替换文案
57
- * @param template
58
- */
59
- renderImageTemplate (template: PredyResizeTemplate): ImageBitmapInternal,
61
+ * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
62
+ * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
63
+ * 将images绘制到画布上,images的尺寸由image.frame决定
64
+ * 将数据模板content绘制到画布上,使用variables替换文案
65
+ * @param template
66
+ */
67
+ renderImageTemplate(template: PredyResizeTemplate): ImageBitmapInternal,
60
68
 
61
69
  /**
62
- * 异步绘制图片的模板
63
- * @param options
64
- * @param callback 如果传入callback就是异步绘制,否则会直接返回结果
65
- */
66
- generateSDFImage (options: SDFImageOptions, callback?: renderSDFImageCallback): SDFImage | undefined,
70
+ * 异步绘制图片的模板
71
+ * @param options
72
+ * @param callback 如果传入callback就是异步绘制,否则会直接返回结果
73
+ */
74
+ generateSDFImage(options: SDFImageOptions, callback?: renderSDFImageCallback): SDFImage | undefined,
67
75
 
68
76
  /**
69
- * 下载并且执行脚本文件,此方法会缓存https的脚本内容
70
- * 对于http的请求(开发环境),每次都重新请求
71
- * @param url
72
- * @param callback
73
- */
74
- evaluateScriptURL (url: string, callback: (err: Error, result: any) => void): void,
77
+ * 下载并且执行脚本文件,此方法会缓存https的脚本内容
78
+ * 对于http的请求(开发环境),每次都重新请求
79
+ * @param url
80
+ * @param callback
81
+ */
82
+ evaluateScriptURL(url: string, callback: (err: Error, result: any) => void): void,
75
83
 
76
84
  /**
77
- * 将float32Array转换为half float,写入Uint16Array中,
78
- * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
79
- * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
80
- * 如果source和target的长度不匹配,返回false
81
- */
85
+ * 将float32Array转换为half float,写入Uint16Array中,
86
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
87
+ * 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
88
+ * 如果source和target的长度不匹配,返回false
89
+ */
82
90
  float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean,
83
91
 
84
92
  /**
85
- * 将half float转换为float32,通过Float32Array返回,
86
- * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
87
- * 如果没有提供,float16会被直接转化为float32
88
- * 如果source和target的长度不匹配,返回false
89
- */
93
+ * 将half float转换为float32,通过Float32Array返回,
94
+ * 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
95
+ * 如果没有提供,float16会被直接转化为float32
96
+ * 如果source和target的长度不匹配,返回false
97
+ */
90
98
  float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean,
91
99
 
92
100
  /**
93
- * 解压数据
94
- * @param data
95
- */
101
+ * 解压数据
102
+ * @param data
103
+ * @param method
104
+ */
96
105
  inflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined,
97
106
  }
98
107