@predy-js/render-interface 0.1.75-beta.6 → 0.1.75-beta.7

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