@predy-js/render-interface 0.1.75-beta.3 → 0.1.75-beta.4

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.1.75-beta.3
5
+ * Version: v0.1.75-beta.4
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, 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
5
  export interface PredyRequestOptions {
@@ -26,20 +26,26 @@ export declare abstract class PredyNativeInternal {
26
26
  abstract requestWithCache(options: PredyRequestOptions, callback: PredyRequestCallback): void;
27
27
  /**
28
28
  * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
29
- * 创建 template.size尺寸的画布, 接下来的绘制均应用 template.offset
30
- * 将source绘制到画布上,绘制的尺寸为template.sourceSize
31
- * content绘制到画布上,使用variables替换文案
32
- * @param source
29
+ * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
30
+ * 将images绘制到画布上,images的尺寸由image.frame决定
31
+ * 将数据模板content绘制到画布上,使用variables替换文案
33
32
  * @param template
34
33
  * @param variables
35
34
  */
36
- abstract renderImageTemplate(source: ImageBitmap, template: PredyResizeTemplate, variables: Record<string, string | number>): ImageBitmap;
35
+ abstract renderImageTemplate(template: PredyResizeTemplate, variables: Record<string, string | number>): ImageBitmap;
37
36
  }
38
37
  export interface PredyResizeTemplate {
39
38
  /**
40
39
  * 要替换的文案
41
40
  */
42
41
  content: StringTemplate;
42
+ /**
43
+ * 要绘制的图片
44
+ */
45
+ images: Array<{
46
+ s: ImageBitmap;
47
+ frame: vec4;
48
+ }>;
43
49
  /**
44
50
  * 画布尺寸
45
51
  */
@@ -47,9 +53,5 @@ export interface PredyResizeTemplate {
47
53
  /**
48
54
  * 画布绘制的offset 默认[0,0]
49
55
  */
50
- offset: vec2;
51
- /**
52
- * source image绘制到画布的尺寸
53
- */
54
- sourceSize: vec2;
56
+ offset?: vec2;
55
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.1.75-beta.3",
3
+ "version": "0.1.75-beta.4",
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, 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
5
  export interface PredyRequestOptions {
@@ -35,20 +35,28 @@ export declare abstract class PredyNativeInternal {
35
35
 
36
36
  /**
37
37
  * 将图片绘制到画布上,同时替换文案,绘制的顺序如下
38
- * 创建 template.size尺寸的画布, 接下来的绘制均应用 template.offset
39
- * 将source绘制到画布上,绘制的尺寸为template.sourceSize
40
- * content绘制到画布上,使用variables替换文案
41
- * @param source
38
+ * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset
39
+ * 将images绘制到画布上,images的尺寸由image.frame决定
40
+ * 将数据模板content绘制到画布上,使用variables替换文案
42
41
  * @param template
43
42
  * @param variables
44
43
  */
45
- abstract renderImageTemplate (source: ImageBitmap, template: PredyResizeTemplate, variables: Record<string, string | number>): ImageBitmap;
44
+ abstract renderImageTemplate (template: PredyResizeTemplate, variables: Record<string, string | number>): ImageBitmap;
46
45
  }
47
46
  export interface PredyResizeTemplate {
48
47
  /**
49
48
  * 要替换的文案
50
49
  */
51
50
  content: StringTemplate,
51
+
52
+ /**
53
+ * 要绘制的图片
54
+ */
55
+ images: Array<{
56
+ s: ImageBitmap,
57
+ //图片绘制区域,尺寸可能和image不一样
58
+ frame: vec4,
59
+ }>,
52
60
  /**
53
61
  * 画布尺寸
54
62
  */
@@ -56,9 +64,5 @@ export interface PredyResizeTemplate {
56
64
  /**
57
65
  * 画布绘制的offset 默认[0,0]
58
66
  */
59
- offset: vec2,
60
- /**
61
- * source image绘制到画布的尺寸
62
- */
63
- sourceSize: vec2,
67
+ offset?: vec2,
64
68
  }