@wcardinal/wcardinal-ui 0.438.0 → 0.439.0
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/types/wcardinal/ui/util/util-extract.d.ts +13 -0
- package/dist/wcardinal/ui/util/util-extract.js +61 -6
- package/dist/wcardinal/ui/util/util-extract.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +61 -7
- package/dist/wcardinal-ui.js +61 -7
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -40,9 +40,22 @@ export interface UtilExtractFileOptions extends UtilExtractBase64Options {
|
|
|
40
40
|
filename: string;
|
|
41
41
|
}
|
|
42
42
|
export declare class UtilExtract {
|
|
43
|
+
protected static WORK_RENDER_TEXTURE?: RenderTexture;
|
|
43
44
|
static texture(options: UtilExtractTextureOptions): RenderTexture;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts pixels from the target.
|
|
47
|
+
* This method internally creates one render texture and use that to extract pixels from the target.
|
|
48
|
+
* To free the allocated render texture, please call {@link destroy()}.
|
|
49
|
+
*
|
|
50
|
+
* @param options an extraction options
|
|
51
|
+
* @returns extracted pixels
|
|
52
|
+
*/
|
|
44
53
|
static pixels(options: UtilExtractPixelsOptions): UtilExtractorPixels;
|
|
45
54
|
static canvas(options: UtilExtractCanvasOptions): utils.CanvasRenderTarget;
|
|
46
55
|
static base64(options: UtilExtractBase64Options): string;
|
|
47
56
|
static file(options: UtilExtractFileOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* Clears all the memories.
|
|
59
|
+
*/
|
|
60
|
+
static destroy(): void;
|
|
48
61
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (C) 2019 Toshiba Corporation
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
+
import { Matrix, RenderTexture, SCALE_MODES } from "pixi.js";
|
|
5
6
|
import { DApplications } from "../d-applications";
|
|
6
7
|
import { isNumber } from "./is-number";
|
|
7
8
|
import { UtilExtractor } from "./util-extractor";
|
|
@@ -61,17 +62,61 @@ var UtilExtract = /** @class */ (function () {
|
|
|
61
62
|
var skipUpdateTransform = (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update;
|
|
62
63
|
return UtilExtractor.toTexture(target, resolution, options.clear, skipUpdateTransform);
|
|
63
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Extracts pixels from the target.
|
|
67
|
+
* This method internally creates one render texture and use that to extract pixels from the target.
|
|
68
|
+
* To free the allocated render texture, please call {@link destroy()}.
|
|
69
|
+
*
|
|
70
|
+
* @param options an extraction options
|
|
71
|
+
* @returns extracted pixels
|
|
72
|
+
*/
|
|
64
73
|
UtilExtract.pixels = function (options) {
|
|
74
|
+
var _a;
|
|
65
75
|
var renderer = toRenderer(options);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
// Create a render texture
|
|
77
|
+
var target = options.target;
|
|
78
|
+
var scale = target.transform.scale;
|
|
79
|
+
var width = Math.floor(target.width * scale.x);
|
|
80
|
+
var height = Math.floor(target.height * scale.y);
|
|
81
|
+
var resolution = toResolution(options);
|
|
82
|
+
var renderTexture = UtilExtract.WORK_RENDER_TEXTURE;
|
|
83
|
+
if (renderTexture == null) {
|
|
84
|
+
renderTexture = RenderTexture.create({
|
|
85
|
+
width: width,
|
|
86
|
+
height: height,
|
|
87
|
+
scaleMode: SCALE_MODES.LINEAR,
|
|
88
|
+
resolution: resolution
|
|
89
|
+
});
|
|
90
|
+
UtilExtract.WORK_RENDER_TEXTURE = renderTexture;
|
|
69
91
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
else {
|
|
93
|
+
var baseTexture = renderTexture.baseTexture;
|
|
94
|
+
var baseTextureWidth = baseTexture.width;
|
|
95
|
+
var baseTextureHeight = baseTexture.height;
|
|
96
|
+
var isWidthDirty = baseTextureWidth < width;
|
|
97
|
+
var isHeightDirty = baseTextureHeight < height;
|
|
98
|
+
var isResolutionDirty = renderTexture.resolution !== resolution;
|
|
99
|
+
if (isResolutionDirty || isWidthDirty || isHeightDirty) {
|
|
100
|
+
if (isResolutionDirty) {
|
|
101
|
+
baseTexture.resolution = resolution;
|
|
102
|
+
}
|
|
103
|
+
renderTexture.resize(Math.max(width, baseTextureWidth), Math.max(height, baseTextureHeight), true);
|
|
73
104
|
}
|
|
74
105
|
}
|
|
106
|
+
// Render to the render texture
|
|
107
|
+
var frame = renderTexture.frame;
|
|
108
|
+
if (frame.x !== 0 || frame.y !== 0 || frame.width !== width || frame.height !== height) {
|
|
109
|
+
frame.x = 0;
|
|
110
|
+
frame.y = 0;
|
|
111
|
+
frame.width = width;
|
|
112
|
+
frame.height = height;
|
|
113
|
+
renderTexture.frame = frame;
|
|
114
|
+
}
|
|
115
|
+
var targetPosition = target.position;
|
|
116
|
+
var matrix = new Matrix(1, 0, 0, 1, -targetPosition.x, -targetPosition.y);
|
|
117
|
+
renderer.render(target, renderTexture, options.clear, matrix, (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update);
|
|
118
|
+
// Extract pixels
|
|
119
|
+
return UtilExtractor.toPixels(renderTexture, renderer);
|
|
75
120
|
};
|
|
76
121
|
UtilExtract.canvas = function (options) {
|
|
77
122
|
var _a, _b;
|
|
@@ -94,6 +139,16 @@ var UtilExtract = /** @class */ (function () {
|
|
|
94
139
|
UtilExtract.file = function (options) {
|
|
95
140
|
UtilFileDownloader.downloadUrl(options.filename, this.base64(options));
|
|
96
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Clears all the memories.
|
|
144
|
+
*/
|
|
145
|
+
UtilExtract.destroy = function () {
|
|
146
|
+
var texture = this.WORK_RENDER_TEXTURE;
|
|
147
|
+
if (texture != null) {
|
|
148
|
+
this.WORK_RENDER_TEXTURE = undefined;
|
|
149
|
+
texture.destroy(true);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
97
152
|
return UtilExtract;
|
|
98
153
|
}());
|
|
99
154
|
export { UtilExtract };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util-extract.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-extract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA+C5D,IAAM,YAAY,GAAG,UAAC,OAAkC;;IACvD,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,IAAI,UAAU,IAAI,IAAI,EAAE;QACvB,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;YACzB,OAAO,UAAU,CAAC;SAClB;aAAM;YACN,IAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACrC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG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AAS;YACT,IAAI,MAAM,EAAE;gBACX,MAAM,CAAC,OAAO,EAAE,CAAC;aACjB;SACD;IACF,CAAC;IAEM,gBAAI,GAAX,UAAY,OAA+B;QAC1C,kBAAkB,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;IACF,kBAAC;AAAD,CAAC,AAzCD,IAyCC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Renderer, RenderTexture, utils } from \"pixi.js\";\nimport { DApplicationLayerLike } from \"../d-application-layer-like\";\nimport { DApplicationLike } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\nimport { DBase } from \"../d-base\";\nimport { isNumber } from \"./is-number\";\nimport { UtilExtractor } from \"./util-extractor\";\nimport { UtilExtractorPixels } from \"./util-extractor-pixels\";\nimport { UtilFileDownloader } from \"./util-file-downloader\";\n\nexport interface UtilExtractTextureResolutionOptions {\n\tsize: number;\n}\n\nexport interface UtilExtractTextureTransformOptions {\n\tupdate?: boolean;\n}\n\nexport interface UtilExtractTextureOptions {\n\ttarget: DBase;\n\tresolution?: number | UtilExtractTextureResolutionOptions;\n\ttransform?: UtilExtractTextureTransformOptions;\n\tclear?: boolean;\n}\n\nexport interface UtilExtractPixelsOptions extends UtilExtractTextureOptions {\n\trenderer?: Renderer;\n\tapplication?: DApplicationLike;\n\tlayer?: DApplicationLayerLike;\n}\n\nexport interface UtilExtractCanvasScaleOptions {\n\tsize: number;\n}\n\nexport interface UtilExtractCanvasAlphaOptions {\n\tpremultiplied?: {\n\t\tignore?: boolean;\n\t};\n}\n\nexport interface UtilExtractCanvasOptions extends UtilExtractPixelsOptions {\n\tscale?: number | UtilExtractCanvasScaleOptions;\n\talpha?: UtilExtractCanvasAlphaOptions;\n}\n\nexport interface UtilExtractBase64Options extends UtilExtractCanvasOptions {\n\tformat?: string;\n\tquality?: number;\n}\n\nexport interface UtilExtractFileOptions extends UtilExtractBase64Options {\n\tfilename: string;\n}\n\nconst toResolution = (options: UtilExtractTextureOptions): number => {\n\tconst target = options.target;\n\tconst resolution = options.resolution;\n\tif (resolution != null) {\n\t\tif (isNumber(resolution)) {\n\t\t\treturn resolution;\n\t\t} else {\n\t\t\tconst scale = target.transform.scale;\n\t\t\tconst size = Math.max(target.width * scale.x, target.height * scale.y);\n\t\t\treturn Math.min(1, resolution.size / size);\n\t\t}\n\t} else {\n\t\treturn window.devicePixelRatio ?? 1;\n\t}\n};\n\nconst toScale = (\n\tpixels: UtilExtractorPixels,\n\toptions: UtilExtractCanvasOptions\n): number | undefined => {\n\tconst scale = options.scale;\n\tif (scale != null) {\n\t\tif (isNumber(scale)) {\n\t\t\treturn scale;\n\t\t} else {\n\t\t\tconst size = scale.size;\n\t\t\treturn Math.min(1, size / pixels.width, size / pixels.height);\n\t\t}\n\t}\n};\n\nconst toRenderer = (options: UtilExtractPixelsOptions): Renderer => {\n\tconst renderer = options.renderer;\n\tif (renderer) {\n\t\treturn renderer;\n\t}\n\tconst application = options.application;\n\tif (application) {\n\t\treturn application.getLayerBase().renderer;\n\t}\n\tconst layer = options.layer || DApplications.getLayer(options.target);\n\tif (layer) {\n\t\treturn layer.renderer;\n\t}\n\tthrow new Error(\"No renderer / application / layer found.\");\n};\n\nexport class UtilExtract {\n\tstatic texture(options: UtilExtractTextureOptions): RenderTexture {\n\t\tconst target = options.target;\n\t\tconst resolution = toResolution(options);\n\t\tconst skipUpdateTransform = options.transform?.update;\n\t\treturn UtilExtractor.toTexture(target, resolution, options.clear, skipUpdateTransform);\n\t}\n\n\tstatic pixels(options: UtilExtractPixelsOptions): UtilExtractorPixels {\n\t\tconst renderer = toRenderer(options);\n\t\tconst texture = this.texture(options);\n\t\ttry {\n\t\t\treturn UtilExtractor.toPixels(texture, renderer);\n\t\t} finally {\n\t\t\tif (texture) {\n\t\t\t\ttexture.destroy();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic canvas(options: UtilExtractCanvasOptions): utils.CanvasRenderTarget {\n\t\tconst pixels = this.pixels(options);\n\t\tconst ignorePremutipliedAlpha = options.alpha?.premultiplied?.ignore;\n\t\tconst scale = toScale(pixels, options);\n\t\treturn UtilExtractor.toCanvas(pixels, scale, ignorePremutipliedAlpha);\n\t}\n\n\tstatic base64(options: UtilExtractBase64Options): string {\n\t\tconst canvas = this.canvas(options);\n\t\ttry {\n\t\t\treturn UtilExtractor.toBase64(canvas.canvas, options.format, options.quality);\n\t\t} finally {\n\t\t\tif (canvas) {\n\t\t\t\tcanvas.destroy();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic file(options: UtilExtractFileOptions): void {\n\t\tUtilFileDownloader.downloadUrl(options.filename, this.base64(options));\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util-extract.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-extract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAY,aAAa,EAAE,WAAW,EAAS,MAAM,SAAS,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA+C5D,IAAM,YAAY,GAAG,UAAC,OAAkC;;IACvD,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,IAAI,UAAU,IAAI,IAAI,EAAE;QACvB,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;YACzB,OAAO,UAAU,CAAC;SAClB;aAAM;YACN,IAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACrC,IAAM,IAAI,GAAG,IAAI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AAC;AAAD,CAAC,AA1GD,IA0GC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Matrix, Renderer, RenderTexture, SCALE_MODES, utils } from \"pixi.js\";\nimport { DApplicationLayerLike } from \"../d-application-layer-like\";\nimport { DApplicationLike } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\nimport { DBase } from \"../d-base\";\nimport { isNumber } from \"./is-number\";\nimport { UtilExtractor } from \"./util-extractor\";\nimport { UtilExtractorPixels } from \"./util-extractor-pixels\";\nimport { UtilFileDownloader } from \"./util-file-downloader\";\n\nexport interface UtilExtractTextureResolutionOptions {\n\tsize: number;\n}\n\nexport interface UtilExtractTextureTransformOptions {\n\tupdate?: boolean;\n}\n\nexport interface UtilExtractTextureOptions {\n\ttarget: DBase;\n\tresolution?: number | UtilExtractTextureResolutionOptions;\n\ttransform?: UtilExtractTextureTransformOptions;\n\tclear?: boolean;\n}\n\nexport interface UtilExtractPixelsOptions extends UtilExtractTextureOptions {\n\trenderer?: Renderer;\n\tapplication?: DApplicationLike;\n\tlayer?: DApplicationLayerLike;\n}\n\nexport interface UtilExtractCanvasScaleOptions {\n\tsize: number;\n}\n\nexport interface UtilExtractCanvasAlphaOptions {\n\tpremultiplied?: {\n\t\tignore?: boolean;\n\t};\n}\n\nexport interface UtilExtractCanvasOptions extends UtilExtractPixelsOptions {\n\tscale?: number | UtilExtractCanvasScaleOptions;\n\talpha?: UtilExtractCanvasAlphaOptions;\n}\n\nexport interface UtilExtractBase64Options extends UtilExtractCanvasOptions {\n\tformat?: string;\n\tquality?: number;\n}\n\nexport interface UtilExtractFileOptions extends UtilExtractBase64Options {\n\tfilename: string;\n}\n\nconst toResolution = (options: UtilExtractTextureOptions): number => {\n\tconst target = options.target;\n\tconst resolution = options.resolution;\n\tif (resolution != null) {\n\t\tif (isNumber(resolution)) {\n\t\t\treturn resolution;\n\t\t} else {\n\t\t\tconst scale = target.transform.scale;\n\t\t\tconst size = Math.max(target.width * scale.x, target.height * scale.y);\n\t\t\treturn Math.min(1, resolution.size / size);\n\t\t}\n\t} else {\n\t\treturn window.devicePixelRatio ?? 1;\n\t}\n};\n\nconst toScale = (\n\tpixels: UtilExtractorPixels,\n\toptions: UtilExtractCanvasOptions\n): number | undefined => {\n\tconst scale = options.scale;\n\tif (scale != null) {\n\t\tif (isNumber(scale)) {\n\t\t\treturn scale;\n\t\t} else {\n\t\t\tconst size = scale.size;\n\t\t\treturn Math.min(1, size / pixels.width, size / pixels.height);\n\t\t}\n\t}\n};\n\nconst toRenderer = (options: UtilExtractPixelsOptions): Renderer => {\n\tconst renderer = options.renderer;\n\tif (renderer) {\n\t\treturn renderer;\n\t}\n\tconst application = options.application;\n\tif (application) {\n\t\treturn application.getLayerBase().renderer;\n\t}\n\tconst layer = options.layer || DApplications.getLayer(options.target);\n\tif (layer) {\n\t\treturn layer.renderer;\n\t}\n\tthrow new Error(\"No renderer / application / layer found.\");\n};\n\nexport class UtilExtract {\n\tprotected static WORK_RENDER_TEXTURE?: RenderTexture;\n\n\tstatic texture(options: UtilExtractTextureOptions): RenderTexture {\n\t\tconst target = options.target;\n\t\tconst resolution = toResolution(options);\n\t\tconst skipUpdateTransform = options.transform?.update;\n\t\treturn UtilExtractor.toTexture(target, resolution, options.clear, skipUpdateTransform);\n\t}\n\n\t/**\n\t * Extracts pixels from the target.\n\t * This method internally creates one render texture and use that to extract pixels from the target.\n\t * To free the allocated render texture, please call {@link destroy()}.\n\t *\n\t * @param options an extraction options\n\t * @returns extracted pixels\n\t */\n\tstatic pixels(options: UtilExtractPixelsOptions): UtilExtractorPixels {\n\t\tconst renderer = toRenderer(options);\n\n\t\t// Create a render texture\n\t\tconst target = options.target;\n\t\tconst scale = target.transform.scale;\n\t\tconst width = Math.floor(target.width * scale.x);\n\t\tconst height = Math.floor(target.height * scale.y);\n\t\tconst resolution = toResolution(options);\n\t\tlet renderTexture = UtilExtract.WORK_RENDER_TEXTURE;\n\t\tif (renderTexture == null) {\n\t\t\trenderTexture = RenderTexture.create({\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tscaleMode: SCALE_MODES.LINEAR,\n\t\t\t\tresolution\n\t\t\t});\n\t\t\tUtilExtract.WORK_RENDER_TEXTURE = renderTexture;\n\t\t} else {\n\t\t\tconst baseTexture = renderTexture.baseTexture;\n\t\t\tconst baseTextureWidth = baseTexture.width;\n\t\t\tconst baseTextureHeight = baseTexture.height;\n\t\t\tconst isWidthDirty = baseTextureWidth < width;\n\t\t\tconst isHeightDirty = baseTextureHeight < height;\n\t\t\tconst isResolutionDirty = renderTexture.resolution !== resolution;\n\t\t\tif (isResolutionDirty || isWidthDirty || isHeightDirty) {\n\t\t\t\tif (isResolutionDirty) {\n\t\t\t\t\tbaseTexture.resolution = resolution;\n\t\t\t\t}\n\t\t\t\trenderTexture.resize(\n\t\t\t\t\tMath.max(width, baseTextureWidth),\n\t\t\t\t\tMath.max(height, baseTextureHeight),\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Render to the render texture\n\t\tconst frame = renderTexture.frame;\n\t\tif (frame.x !== 0 || frame.y !== 0 || frame.width !== width || frame.height !== height) {\n\t\t\tframe.x = 0;\n\t\t\tframe.y = 0;\n\t\t\tframe.width = width;\n\t\t\tframe.height = height;\n\t\t\trenderTexture.frame = frame;\n\t\t}\n\n\t\tconst targetPosition = target.position;\n\t\tconst matrix = new Matrix(1, 0, 0, 1, -targetPosition.x, -targetPosition.y);\n\n\t\trenderer.render(target, renderTexture, options.clear, matrix, options.transform?.update);\n\n\t\t// Extract pixels\n\t\treturn UtilExtractor.toPixels(renderTexture, renderer);\n\t}\n\n\tstatic canvas(options: UtilExtractCanvasOptions): utils.CanvasRenderTarget {\n\t\tconst pixels = this.pixels(options);\n\t\tconst ignorePremutipliedAlpha = options.alpha?.premultiplied?.ignore;\n\t\tconst scale = toScale(pixels, options);\n\t\treturn UtilExtractor.toCanvas(pixels, scale, ignorePremutipliedAlpha);\n\t}\n\n\tstatic base64(options: UtilExtractBase64Options): string {\n\t\tconst canvas = this.canvas(options);\n\t\ttry {\n\t\t\treturn UtilExtractor.toBase64(canvas.canvas, options.format, options.quality);\n\t\t} finally {\n\t\t\tif (canvas) {\n\t\t\t\tcanvas.destroy();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic file(options: UtilExtractFileOptions): void {\n\t\tUtilFileDownloader.downloadUrl(options.filename, this.base64(options));\n\t}\n\n\t/**\n\t * Clears all the memories.\n\t */\n\tstatic destroy(): void {\n\t\tconst texture = this.WORK_RENDER_TEXTURE;\n\t\tif (texture != null) {\n\t\t\tthis.WORK_RENDER_TEXTURE = undefined;\n\t\t\ttexture.destroy(true);\n\t\t}\n\t}\n}\n"]}
|
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.439.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -23797,17 +23797,61 @@ var UtilExtract = /** @class */ (function () {
|
|
|
23797
23797
|
var skipUpdateTransform = (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update;
|
|
23798
23798
|
return UtilExtractor.toTexture(target, resolution, options.clear, skipUpdateTransform);
|
|
23799
23799
|
};
|
|
23800
|
+
/**
|
|
23801
|
+
* Extracts pixels from the target.
|
|
23802
|
+
* This method internally creates one render texture and use that to extract pixels from the target.
|
|
23803
|
+
* To free the allocated render texture, please call {@link destroy()}.
|
|
23804
|
+
*
|
|
23805
|
+
* @param options an extraction options
|
|
23806
|
+
* @returns extracted pixels
|
|
23807
|
+
*/
|
|
23800
23808
|
UtilExtract.pixels = function (options) {
|
|
23809
|
+
var _a;
|
|
23801
23810
|
var renderer = toRenderer(options);
|
|
23802
|
-
|
|
23803
|
-
|
|
23804
|
-
|
|
23811
|
+
// Create a render texture
|
|
23812
|
+
var target = options.target;
|
|
23813
|
+
var scale = target.transform.scale;
|
|
23814
|
+
var width = Math.floor(target.width * scale.x);
|
|
23815
|
+
var height = Math.floor(target.height * scale.y);
|
|
23816
|
+
var resolution = toResolution(options);
|
|
23817
|
+
var renderTexture = UtilExtract.WORK_RENDER_TEXTURE;
|
|
23818
|
+
if (renderTexture == null) {
|
|
23819
|
+
renderTexture = pixi_js.RenderTexture.create({
|
|
23820
|
+
width: width,
|
|
23821
|
+
height: height,
|
|
23822
|
+
scaleMode: pixi_js.SCALE_MODES.LINEAR,
|
|
23823
|
+
resolution: resolution
|
|
23824
|
+
});
|
|
23825
|
+
UtilExtract.WORK_RENDER_TEXTURE = renderTexture;
|
|
23805
23826
|
}
|
|
23806
|
-
|
|
23807
|
-
|
|
23808
|
-
|
|
23827
|
+
else {
|
|
23828
|
+
var baseTexture = renderTexture.baseTexture;
|
|
23829
|
+
var baseTextureWidth = baseTexture.width;
|
|
23830
|
+
var baseTextureHeight = baseTexture.height;
|
|
23831
|
+
var isWidthDirty = baseTextureWidth < width;
|
|
23832
|
+
var isHeightDirty = baseTextureHeight < height;
|
|
23833
|
+
var isResolutionDirty = renderTexture.resolution !== resolution;
|
|
23834
|
+
if (isResolutionDirty || isWidthDirty || isHeightDirty) {
|
|
23835
|
+
if (isResolutionDirty) {
|
|
23836
|
+
baseTexture.resolution = resolution;
|
|
23837
|
+
}
|
|
23838
|
+
renderTexture.resize(Math.max(width, baseTextureWidth), Math.max(height, baseTextureHeight), true);
|
|
23809
23839
|
}
|
|
23810
23840
|
}
|
|
23841
|
+
// Render to the render texture
|
|
23842
|
+
var frame = renderTexture.frame;
|
|
23843
|
+
if (frame.x !== 0 || frame.y !== 0 || frame.width !== width || frame.height !== height) {
|
|
23844
|
+
frame.x = 0;
|
|
23845
|
+
frame.y = 0;
|
|
23846
|
+
frame.width = width;
|
|
23847
|
+
frame.height = height;
|
|
23848
|
+
renderTexture.frame = frame;
|
|
23849
|
+
}
|
|
23850
|
+
var targetPosition = target.position;
|
|
23851
|
+
var matrix = new pixi_js.Matrix(1, 0, 0, 1, -targetPosition.x, -targetPosition.y);
|
|
23852
|
+
renderer.render(target, renderTexture, options.clear, matrix, (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update);
|
|
23853
|
+
// Extract pixels
|
|
23854
|
+
return UtilExtractor.toPixels(renderTexture, renderer);
|
|
23811
23855
|
};
|
|
23812
23856
|
UtilExtract.canvas = function (options) {
|
|
23813
23857
|
var _a, _b;
|
|
@@ -23830,6 +23874,16 @@ var UtilExtract = /** @class */ (function () {
|
|
|
23830
23874
|
UtilExtract.file = function (options) {
|
|
23831
23875
|
UtilFileDownloader.downloadUrl(options.filename, this.base64(options));
|
|
23832
23876
|
};
|
|
23877
|
+
/**
|
|
23878
|
+
* Clears all the memories.
|
|
23879
|
+
*/
|
|
23880
|
+
UtilExtract.destroy = function () {
|
|
23881
|
+
var texture = this.WORK_RENDER_TEXTURE;
|
|
23882
|
+
if (texture != null) {
|
|
23883
|
+
this.WORK_RENDER_TEXTURE = undefined;
|
|
23884
|
+
texture.destroy(true);
|
|
23885
|
+
}
|
|
23886
|
+
};
|
|
23833
23887
|
return UtilExtract;
|
|
23834
23888
|
}());
|
|
23835
23889
|
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.439.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -23794,17 +23794,61 @@
|
|
|
23794
23794
|
var skipUpdateTransform = (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update;
|
|
23795
23795
|
return UtilExtractor.toTexture(target, resolution, options.clear, skipUpdateTransform);
|
|
23796
23796
|
};
|
|
23797
|
+
/**
|
|
23798
|
+
* Extracts pixels from the target.
|
|
23799
|
+
* This method internally creates one render texture and use that to extract pixels from the target.
|
|
23800
|
+
* To free the allocated render texture, please call {@link destroy()}.
|
|
23801
|
+
*
|
|
23802
|
+
* @param options an extraction options
|
|
23803
|
+
* @returns extracted pixels
|
|
23804
|
+
*/
|
|
23797
23805
|
UtilExtract.pixels = function (options) {
|
|
23806
|
+
var _a;
|
|
23798
23807
|
var renderer = toRenderer(options);
|
|
23799
|
-
|
|
23800
|
-
|
|
23801
|
-
|
|
23808
|
+
// Create a render texture
|
|
23809
|
+
var target = options.target;
|
|
23810
|
+
var scale = target.transform.scale;
|
|
23811
|
+
var width = Math.floor(target.width * scale.x);
|
|
23812
|
+
var height = Math.floor(target.height * scale.y);
|
|
23813
|
+
var resolution = toResolution(options);
|
|
23814
|
+
var renderTexture = UtilExtract.WORK_RENDER_TEXTURE;
|
|
23815
|
+
if (renderTexture == null) {
|
|
23816
|
+
renderTexture = pixi_js.RenderTexture.create({
|
|
23817
|
+
width: width,
|
|
23818
|
+
height: height,
|
|
23819
|
+
scaleMode: pixi_js.SCALE_MODES.LINEAR,
|
|
23820
|
+
resolution: resolution
|
|
23821
|
+
});
|
|
23822
|
+
UtilExtract.WORK_RENDER_TEXTURE = renderTexture;
|
|
23802
23823
|
}
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23824
|
+
else {
|
|
23825
|
+
var baseTexture = renderTexture.baseTexture;
|
|
23826
|
+
var baseTextureWidth = baseTexture.width;
|
|
23827
|
+
var baseTextureHeight = baseTexture.height;
|
|
23828
|
+
var isWidthDirty = baseTextureWidth < width;
|
|
23829
|
+
var isHeightDirty = baseTextureHeight < height;
|
|
23830
|
+
var isResolutionDirty = renderTexture.resolution !== resolution;
|
|
23831
|
+
if (isResolutionDirty || isWidthDirty || isHeightDirty) {
|
|
23832
|
+
if (isResolutionDirty) {
|
|
23833
|
+
baseTexture.resolution = resolution;
|
|
23834
|
+
}
|
|
23835
|
+
renderTexture.resize(Math.max(width, baseTextureWidth), Math.max(height, baseTextureHeight), true);
|
|
23806
23836
|
}
|
|
23807
23837
|
}
|
|
23838
|
+
// Render to the render texture
|
|
23839
|
+
var frame = renderTexture.frame;
|
|
23840
|
+
if (frame.x !== 0 || frame.y !== 0 || frame.width !== width || frame.height !== height) {
|
|
23841
|
+
frame.x = 0;
|
|
23842
|
+
frame.y = 0;
|
|
23843
|
+
frame.width = width;
|
|
23844
|
+
frame.height = height;
|
|
23845
|
+
renderTexture.frame = frame;
|
|
23846
|
+
}
|
|
23847
|
+
var targetPosition = target.position;
|
|
23848
|
+
var matrix = new pixi_js.Matrix(1, 0, 0, 1, -targetPosition.x, -targetPosition.y);
|
|
23849
|
+
renderer.render(target, renderTexture, options.clear, matrix, (_a = options.transform) === null || _a === void 0 ? void 0 : _a.update);
|
|
23850
|
+
// Extract pixels
|
|
23851
|
+
return UtilExtractor.toPixels(renderTexture, renderer);
|
|
23808
23852
|
};
|
|
23809
23853
|
UtilExtract.canvas = function (options) {
|
|
23810
23854
|
var _a, _b;
|
|
@@ -23827,6 +23871,16 @@
|
|
|
23827
23871
|
UtilExtract.file = function (options) {
|
|
23828
23872
|
UtilFileDownloader.downloadUrl(options.filename, this.base64(options));
|
|
23829
23873
|
};
|
|
23874
|
+
/**
|
|
23875
|
+
* Clears all the memories.
|
|
23876
|
+
*/
|
|
23877
|
+
UtilExtract.destroy = function () {
|
|
23878
|
+
var texture = this.WORK_RENDER_TEXTURE;
|
|
23879
|
+
if (texture != null) {
|
|
23880
|
+
this.WORK_RENDER_TEXTURE = undefined;
|
|
23881
|
+
texture.destroy(true);
|
|
23882
|
+
}
|
|
23883
|
+
};
|
|
23830
23884
|
return UtilExtract;
|
|
23831
23885
|
}());
|
|
23832
23886
|
|