@predy-js/render-interface 0.1.78-beta.1 → 0.1.78-beta.2
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/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/MarsRenderer.d.ts +1 -0
- package/dist/statistic.js +1 -1
- package/dist/types/Renderer.d.ts +4 -0
- package/dist/types/native/PredyNativeInternal.d.ts +19 -16
- package/package.json +1 -1
- package/types/Renderer.ts +5 -0
- package/types/native/PredyNativeInternal.ts +22 -17
package/dist/statistic.js
CHANGED
package/dist/types/Renderer.d.ts
CHANGED
@@ -59,4 +59,8 @@ export declare class GPURenderer implements IGPURenderer {
|
|
59
59
|
* @param haltGL if true, this method will call webgl lose context extension which leads webgl absolutely halt
|
60
60
|
*/
|
61
61
|
destroy(haltGL?: boolean): void;
|
62
|
+
/**
|
63
|
+
* 此帧需要进行绘制
|
64
|
+
*/
|
65
|
+
invalid(): void;
|
62
66
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
|
2
|
-
import type { TypedArray, vec2 } from '../type';
|
2
|
+
import type { TypedArray, vec2, vec4 } from '../type';
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { StringTemplate } from '@predy-js/specification';
|
5
|
+
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
5
6
|
export interface PredyRequestOptions {
|
6
7
|
url: string;
|
7
8
|
disableCache?: boolean;
|
@@ -19,27 +20,33 @@ export interface PredyRequestResponse {
|
|
19
20
|
time: number;
|
20
21
|
}
|
21
22
|
export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
|
22
|
-
export
|
23
|
-
|
23
|
+
export interface PredyNativeInternal {
|
24
|
+
webpDisabled?: boolean;
|
25
|
+
createImageBitmap(data: TypedArray | string, //图片文件的数据
|
24
26
|
options: ImageBitmapConstructor, callback: ImageBitmapCallback): void;
|
25
|
-
|
26
|
-
|
27
|
+
getDefaultGPUCapability(): GPUCapability;
|
28
|
+
requestWithCache(options: PredyRequestOptions, callback: PredyRequestCallback): void;
|
27
29
|
/**
|
28
30
|
* 将图片绘制到画布上,同时替换文案,绘制的顺序如下
|
29
|
-
* 创建
|
30
|
-
* 将
|
31
|
-
*
|
32
|
-
* @param source
|
31
|
+
* 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
|
32
|
+
* 将images绘制到画布上,images的尺寸由image.frame决定
|
33
|
+
* 将数据模板content绘制到画布上,使用variables替换文案
|
33
34
|
* @param template
|
34
|
-
* @param variables
|
35
35
|
*/
|
36
|
-
|
36
|
+
renderImageTemplate(template: PredyResizeTemplate): ImageBitmapInternal;
|
37
37
|
}
|
38
38
|
export interface PredyResizeTemplate {
|
39
39
|
/**
|
40
40
|
* 要替换的文案
|
41
41
|
*/
|
42
42
|
content: StringTemplate;
|
43
|
+
/**
|
44
|
+
* 要绘制的图片
|
45
|
+
*/
|
46
|
+
images: Array<{
|
47
|
+
s: ImageBitmap;
|
48
|
+
frame: vec4;
|
49
|
+
}>;
|
43
50
|
/**
|
44
51
|
* 画布尺寸
|
45
52
|
*/
|
@@ -47,9 +54,5 @@ export interface PredyResizeTemplate {
|
|
47
54
|
/**
|
48
55
|
* 画布绘制的offset 默认[0,0]
|
49
56
|
*/
|
50
|
-
offset
|
51
|
-
/**
|
52
|
-
* source image绘制到画布的尺寸
|
53
|
-
*/
|
54
|
-
sourceSize: vec2;
|
57
|
+
offset?: vec2;
|
55
58
|
}
|
package/package.json
CHANGED
package/types/Renderer.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
|
2
|
-
import type { TypedArray, vec2 } from '../type';
|
2
|
+
import type { TypedArray, vec2, vec4 } from '../type';
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { StringTemplate } from '@predy-js/specification';
|
5
|
+
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
5
6
|
export interface PredyRequestOptions {
|
6
7
|
url: string,
|
7
8
|
//用于测试缓存,生产中不要使用
|
@@ -25,30 +26,38 @@ export interface PredyRequestResponse {
|
|
25
26
|
|
26
27
|
export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
|
27
28
|
|
28
|
-
export
|
29
|
-
|
30
|
-
|
29
|
+
export interface PredyNativeInternal {
|
30
|
+
webpDisabled?: boolean,
|
31
|
+
createImageBitmap (data: TypedArray | string, //图片文件的数据
|
32
|
+
options: ImageBitmapConstructor, callback: ImageBitmapCallback): void,
|
31
33
|
|
32
|
-
|
34
|
+
getDefaultGPUCapability (): GPUCapability,
|
33
35
|
|
34
|
-
|
36
|
+
requestWithCache (options: PredyRequestOptions, callback: PredyRequestCallback): void,
|
35
37
|
|
36
38
|
/**
|
37
39
|
* 将图片绘制到画布上,同时替换文案,绘制的顺序如下
|
38
|
-
* 创建
|
39
|
-
* 将
|
40
|
-
*
|
41
|
-
* @param source
|
40
|
+
* 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
|
41
|
+
* 将images绘制到画布上,images的尺寸由image.frame决定
|
42
|
+
* 将数据模板content绘制到画布上,使用variables替换文案
|
42
43
|
* @param template
|
43
|
-
* @param variables
|
44
44
|
*/
|
45
|
-
|
45
|
+
renderImageTemplate (template: PredyResizeTemplate): ImageBitmapInternal,
|
46
46
|
}
|
47
47
|
export interface PredyResizeTemplate {
|
48
48
|
/**
|
49
49
|
* 要替换的文案
|
50
50
|
*/
|
51
51
|
content: StringTemplate,
|
52
|
+
|
53
|
+
/**
|
54
|
+
* 要绘制的图片
|
55
|
+
*/
|
56
|
+
images: Array<{
|
57
|
+
s: ImageBitmap,
|
58
|
+
//图片绘制区域,尺寸可能和image不一样
|
59
|
+
frame: vec4,
|
60
|
+
}>,
|
52
61
|
/**
|
53
62
|
* 画布尺寸
|
54
63
|
*/
|
@@ -56,9 +65,5 @@ export interface PredyResizeTemplate {
|
|
56
65
|
/**
|
57
66
|
* 画布绘制的offset 默认[0,0]
|
58
67
|
*/
|
59
|
-
offset
|
60
|
-
/**
|
61
|
-
* source image绘制到画布的尺寸
|
62
|
-
*/
|
63
|
-
sourceSize: vec2,
|
68
|
+
offset?: vec2,
|
64
69
|
}
|