@kitware/vtk.js 34.2.0 → 34.3.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.
@@ -2256,4 +2256,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2256
2256
  'default': vtkMath
2257
2257
  });
2258
2258
 
2259
- export { min as $, degreesFromRadians as A, ldexp as B, xyz2rgb as C, areEquals as D, clampValue as E, arrayRange as F, getMajorAxisIndex as G, createUninitializedBounds as H, identity as I, multiplyMatrix as J, floor as K, isInf as L, rgb2hsv as M, rgb2lab as N, lab2rgb as O, round as P, normalize2D as Q, nearestPowerOfTwo as R, multiply3x3_vect3 as S, getSparseOrthogonalMatrix as T, areBoundsInitialized as U, isPowerOfTwo as V, angleBetweenVectors as W, signedAngleBetweenVectors as X, createArray as Y, Pi as Z, ceil as _, areMatricesEqual as a, floatRGB2HexCode as a$, max as a0, arrayMin as a1, arrayMax as a2, ceilLog2 as a3, factorial as a4, binomial as a5, beginCombination as a6, nextCombination as a7, randomSeed as a8, getSeed as a9, multiplyQuaternion as aA, orthogonalize3x3 as aB, diagonalize3x3 as aC, singularValueDecomposition3x3 as aD, luFactorLinearSystem as aE, luSolveLinearSystem as aF, invertMatrix as aG, estimateMatrixCondition as aH, solveHomogeneousLeastSquares as aI, solveLeastSquares as aJ, hex2float as aK, lab2xyz as aL, xyz2lab as aM, rgb2xyz as aN, computeBoundsFromPoints as aO, clampAndNormalizeValue as aP, getScalarTypeFittingRange as aQ, getAdjustedScalarRange as aR, extentIsWithinOtherExtent as aS, boundsIsWithinOtherBounds as aT, pointIsWithinBounds as aU, solve3PointCircle as aV, inf as aW, negInf as aX, isFinite as aY, isNaN as aZ, floatToHex2 as a_, gaussian as aa, multiplyScalar2D as ab, multiplyAccumulate2D as ac, outer as ad, projectVector as ae, dot2D as af, projectVector2D as ag, gaussianAmplitude as ah, gaussianWeight as ai, outer2D as aj, norm2D as ak, rowsToMat4 as al, columnsToMat4 as am, columnsToMat3 as an, LUFactor3x3 as ao, LUSolve3x3 as ap, linearSolve3x3 as aq, multiply3x3_mat3 as ar, transpose3x3 as as, invert3x3 as at, identity3x3 as au, isIdentity as av, isIdentity3x3 as aw, quaternionToMatrix3x3 as ax, roundNumber as ay, matrix3x3ToQuaternion as az, roundVector as b, float2CssRGBA as b0, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
2259
+ export { ceil as $, degreesFromRadians as A, ldexp as B, xyz2rgb as C, areEquals as D, clampValue as E, arrayRange as F, getMajorAxisIndex as G, createUninitializedBounds as H, identity as I, multiplyMatrix as J, floor as K, isInf as L, rgb2hsv as M, rgb2lab as N, lab2rgb as O, round as P, normalize2D as Q, nearestPowerOfTwo as R, multiply3x3_vect3 as S, getSparseOrthogonalMatrix as T, areBoundsInitialized as U, floatRGB2HexCode as V, isPowerOfTwo as W, angleBetweenVectors as X, signedAngleBetweenVectors as Y, createArray as Z, Pi as _, areMatricesEqual as a, floatToHex2 as a$, min as a0, max as a1, arrayMin as a2, arrayMax as a3, ceilLog2 as a4, factorial as a5, binomial as a6, beginCombination as a7, nextCombination as a8, randomSeed as a9, matrix3x3ToQuaternion as aA, multiplyQuaternion as aB, orthogonalize3x3 as aC, diagonalize3x3 as aD, singularValueDecomposition3x3 as aE, luFactorLinearSystem as aF, luSolveLinearSystem as aG, invertMatrix as aH, estimateMatrixCondition as aI, solveHomogeneousLeastSquares as aJ, solveLeastSquares as aK, hex2float as aL, lab2xyz as aM, xyz2lab as aN, rgb2xyz as aO, computeBoundsFromPoints as aP, clampAndNormalizeValue as aQ, getScalarTypeFittingRange as aR, getAdjustedScalarRange as aS, extentIsWithinOtherExtent as aT, boundsIsWithinOtherBounds as aU, pointIsWithinBounds as aV, solve3PointCircle as aW, inf as aX, negInf as aY, isFinite as aZ, isNaN as a_, getSeed as aa, gaussian as ab, multiplyScalar2D as ac, multiplyAccumulate2D as ad, outer as ae, projectVector as af, dot2D as ag, projectVector2D as ah, gaussianAmplitude as ai, gaussianWeight as aj, outer2D as ak, norm2D as al, rowsToMat4 as am, columnsToMat4 as an, columnsToMat3 as ao, LUFactor3x3 as ap, LUSolve3x3 as aq, linearSolve3x3 as ar, multiply3x3_mat3 as as, transpose3x3 as at, invert3x3 as au, identity3x3 as av, isIdentity as aw, isIdentity3x3 as ax, quaternionToMatrix3x3 as ay, roundNumber as az, roundVector as b, float2CssRGBA as b0, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
@@ -1,4 +1,4 @@
1
1
  import 'seedrandom';
2
2
  import '../../macros2.js';
3
3
  import './Math/Constants.js';
4
- export { ao as LUFactor3x3, ap as LUSolve3x3, Z as Pi, k as add, W as angleBetweenVectors, U as areBoundsInitialized, D as areEquals, a as areMatricesEqual, a2 as arrayMax, a1 as arrayMin, F as arrayRange, a6 as beginCombination, a5 as binomial, aT as boundsIsWithinOtherBounds, _ as ceil, a3 as ceilLog2, aP as clampAndNormalizeValue, E as clampValue, c as clampVector, an as columnsToMat3, am as columnsToMat4, aO as computeBoundsFromPoints, Y as createArray, H as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, aC as diagonalize3x3, e as distance2BetweenPoints, d as dot, af as dot2D, aH as estimateMatrixCondition, aS as extentIsWithinOtherExtent, a4 as factorial, b0 as float2CssRGBA, a$ as floatRGB2HexCode, a_ as floatToHex2, K as floor, aa as gaussian, ah as gaussianAmplitude, ai as gaussianWeight, aR as getAdjustedScalarRange, G as getMajorAxisIndex, aQ as getScalarTypeFittingRange, a9 as getSeed, T as getSparseOrthogonalMatrix, aK as hex2float, h as hsv2rgb, I as identity, au as identity3x3, aW as inf, at as invert3x3, aG as invertMatrix, aY as isFinite, av as isIdentity, aw as isIdentity3x3, L as isInf, aZ as isNaN, i as isNan, V as isPowerOfTwo, t as jacobi, p as jacobiN, O as lab2rgb, aL as lab2xyz, B as ldexp, aq as linearSolve3x3, aE as luFactorLinearSystem, aF as luSolveLinearSystem, az as matrix3x3ToQuaternion, a0 as max, $ as min, ar as multiply3x3_mat3, S as multiply3x3_vect3, m as multiplyAccumulate, ac as multiplyAccumulate2D, J as multiplyMatrix, aA as multiplyQuaternion, w as multiplyScalar, ab as multiplyScalar2D, R as nearestPowerOfTwo, aX as negInf, a7 as nextCombination, n as norm, ak as norm2D, l as normalize, Q as normalize2D, aB as orthogonalize3x3, ad as outer, aj as outer2D, q as perpendiculars, aU as pointIsWithinBounds, ae as projectVector, ag as projectVector2D, ax as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a8 as randomSeed, M as rgb2hsv, N as rgb2lab, aN as rgb2xyz, P as round, ay as roundNumber, b as roundVector, z as rowsToMat3, al as rowsToMat4, X as signedAngleBetweenVectors, aD as singularValueDecomposition3x3, aV as solve3PointCircle, aI as solveHomogeneousLeastSquares, aJ as solveLeastSquares, g as solveLinearSystem, s as subtract, as as transpose3x3, u as uninitializeBounds, aM as xyz2lab, C as xyz2rgb } from './Math/index.js';
4
+ export { ap as LUFactor3x3, aq as LUSolve3x3, _ as Pi, k as add, X as angleBetweenVectors, U as areBoundsInitialized, D as areEquals, a as areMatricesEqual, a3 as arrayMax, a2 as arrayMin, F as arrayRange, a7 as beginCombination, a6 as binomial, aU as boundsIsWithinOtherBounds, $ as ceil, a4 as ceilLog2, aQ as clampAndNormalizeValue, E as clampValue, c as clampVector, ao as columnsToMat3, an as columnsToMat4, aP as computeBoundsFromPoints, Z as createArray, H as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, aD as diagonalize3x3, e as distance2BetweenPoints, d as dot, ag as dot2D, aI as estimateMatrixCondition, aT as extentIsWithinOtherExtent, a5 as factorial, b0 as float2CssRGBA, V as floatRGB2HexCode, a$ as floatToHex2, K as floor, ab as gaussian, ai as gaussianAmplitude, aj as gaussianWeight, aS as getAdjustedScalarRange, G as getMajorAxisIndex, aR as getScalarTypeFittingRange, aa as getSeed, T as getSparseOrthogonalMatrix, aL as hex2float, h as hsv2rgb, I as identity, av as identity3x3, aX as inf, au as invert3x3, aH as invertMatrix, aZ as isFinite, aw as isIdentity, ax as isIdentity3x3, L as isInf, a_ as isNaN, i as isNan, W as isPowerOfTwo, t as jacobi, p as jacobiN, O as lab2rgb, aM as lab2xyz, B as ldexp, ar as linearSolve3x3, aF as luFactorLinearSystem, aG as luSolveLinearSystem, aA as matrix3x3ToQuaternion, a1 as max, a0 as min, as as multiply3x3_mat3, S as multiply3x3_vect3, m as multiplyAccumulate, ad as multiplyAccumulate2D, J as multiplyMatrix, aB as multiplyQuaternion, w as multiplyScalar, ac as multiplyScalar2D, R as nearestPowerOfTwo, aY as negInf, a8 as nextCombination, n as norm, al as norm2D, l as normalize, Q as normalize2D, aC as orthogonalize3x3, ae as outer, ak as outer2D, q as perpendiculars, aV as pointIsWithinBounds, af as projectVector, ah as projectVector2D, ay as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a9 as randomSeed, M as rgb2hsv, N as rgb2lab, aO as rgb2xyz, P as round, az as roundNumber, b as roundVector, z as rowsToMat3, am as rowsToMat4, Y as signedAngleBetweenVectors, aE as singularValueDecomposition3x3, aW as solve3PointCircle, aJ as solveHomogeneousLeastSquares, aK as solveLeastSquares, g as solveLinearSystem, s as subtract, at as transpose3x3, u as uninitializeBounds, aN as xyz2lab, C as xyz2rgb } from './Math/index.js';
@@ -0,0 +1,64 @@
1
+ import vtkActor2D, { IActor2DInitialValues } from './Actor2D';
2
+ import vtkTextProperty, { ITextPropertyInitialValues } from './TextProperty';
3
+
4
+ export interface ITextActorInitialValues extends IActor2DInitialValues {
5
+ property?: vtkTextProperty;
6
+ }
7
+
8
+ export interface vtkTextActor extends vtkActor2D {
9
+ /**
10
+ * Get the property object that controls this actors properties.
11
+ * @returns {vtkTextProperty} The vtkTextProperty instance.
12
+ */
13
+ getProperty(): vtkTextProperty;
14
+
15
+ /**
16
+ * Create a new property suitable for use with this type of TextActor.
17
+ * @param {ITextPropertyInitialValues} [initialValues] (default: {})
18
+ * @return {vtkTextProperty} A new vtkTextProperty instance.
19
+ */
20
+ makeProperty(initialValues?: ITextPropertyInitialValues): vtkTextProperty;
21
+
22
+ /**
23
+ * Set the text to be displayed by the actor.
24
+ * @param input The text to be displayed by the actor.
25
+ */
26
+ setInput(input: string): boolean;
27
+
28
+ /**
29
+ * Set the property object that controls this actors properties.
30
+ * @param {vtkTextProperty} property The vtkTextProperty instance.
31
+ */
32
+ setProperty(property: vtkTextProperty): boolean;
33
+ }
34
+
35
+ /**
36
+ * Method used to decorate a given object (publicAPI+model) with vtkActor characteristics.
37
+ *
38
+ * @param publicAPI object on which methods will be bounds (public)
39
+ * @param model object on which data structure will be bounds (protected)
40
+ * @param {ITextActorInitialValues} [initialValues] (default: {})
41
+ */
42
+ export function extend(
43
+ publicAPI: object,
44
+ model: object,
45
+ initialValues?: ITextActorInitialValues
46
+ ): void;
47
+
48
+ /**
49
+ * Method used to create a new instance of vtkTextActor
50
+ *
51
+ * @param {ITextActorInitialValues} [initialValues] for pre-setting some of its content
52
+ */
53
+ export function newInstance(
54
+ initialValues?: ITextActorInitialValues
55
+ ): vtkTextActor;
56
+
57
+ /**
58
+ * vtkTextActor can be used to place text annotation into a window.
59
+ */
60
+ export declare const vtkTextActor: {
61
+ newInstance: typeof newInstance;
62
+ extend: typeof extend;
63
+ };
64
+ export default vtkTextActor;
@@ -0,0 +1,134 @@
1
+ import { m as macro } from '../../macros2.js';
2
+ import vtkPlaneSource from '../../Filters/Sources/PlaneSource.js';
3
+ import vtkTexture from './Texture.js';
4
+ import vtkActor2D from './Actor2D.js';
5
+ import vtkMapper2D from './Mapper2D.js';
6
+ import vtkTextProperty from './TextProperty.js';
7
+ import ImageHelper from '../../Common/Core/ImageHelper.js';
8
+ import { V as floatRGB2HexCode } from '../../Common/Core/Math/index.js';
9
+
10
+ // ----------------------------------------------------------------------------
11
+ // vtkTextActor methods
12
+ // ----------------------------------------------------------------------------
13
+ function vtkTextActor(publicAPI, model) {
14
+ // Set our className
15
+ model.classHierarchy.push('vtkTextActor');
16
+ publicAPI.makeProperty = vtkTextProperty.newInstance;
17
+ const texture = vtkTexture.newInstance({
18
+ resizable: true
19
+ });
20
+ const canvas = new OffscreenCanvas(1, 1);
21
+ const mapper = vtkMapper2D.newInstance();
22
+ const plane = vtkPlaneSource.newInstance({
23
+ xResolution: 1,
24
+ yResolution: 1
25
+ });
26
+ function createImageData(text) {
27
+ const fontSizeScale = publicAPI.getProperty().getFontSizeScale();
28
+ const fontStyle = publicAPI.getProperty().getFontStyle();
29
+ const fontFamily = publicAPI.getProperty().getFontFamily();
30
+ const fontColor = publicAPI.getProperty().getFontColor();
31
+ const shadowColor = publicAPI.getProperty().getShadowColor();
32
+ const shadowOffset = publicAPI.getProperty().getShadowOffset();
33
+ const shadowBlur = publicAPI.getProperty().getShadowBlur();
34
+ const resolution = publicAPI.getProperty().getResolution();
35
+ const backgroundColor = publicAPI.getProperty().getBackgroundColor();
36
+ const dpr = Math.max(window.devicePixelRatio || 1, 1);
37
+ const ctx = canvas.getContext('2d');
38
+
39
+ // Set the text properties to measure
40
+ const textSize = fontSizeScale(resolution) * dpr;
41
+ ctx.font = `${fontStyle} ${textSize}px "${fontFamily}"`;
42
+ ctx.textBaseline = 'middle';
43
+ ctx.textAlign = 'center';
44
+
45
+ // Measure the text
46
+ const metrics = ctx.measureText(text);
47
+ const textWidth = metrics.width / dpr;
48
+ const {
49
+ actualBoundingBoxLeft,
50
+ actualBoundingBoxRight,
51
+ actualBoundingBoxAscent,
52
+ actualBoundingBoxDescent
53
+ } = metrics;
54
+ const hAdjustment = (actualBoundingBoxLeft - actualBoundingBoxRight) / 2;
55
+ const vAdjustment = (actualBoundingBoxAscent - actualBoundingBoxDescent) / 2;
56
+ const textHeight = textSize / dpr - vAdjustment;
57
+
58
+ // Update canvas size to fit text and ensure it is at least 1x1 pixel
59
+ const width = Math.max(Math.round(textWidth * dpr), 1);
60
+ const height = Math.max(Math.round(textHeight * dpr), 1);
61
+ canvas.width = width;
62
+ canvas.height = height;
63
+
64
+ // Vertical flip
65
+ ctx.translate(0, height);
66
+ ctx.scale(1, -1);
67
+
68
+ // Clear the canvas
69
+ ctx.clearRect(0, 0, width, height);
70
+ if (backgroundColor) {
71
+ ctx.fillStyle = floatRGB2HexCode(backgroundColor);
72
+ ctx.fillRect(0, 0, width, height);
73
+ }
74
+
75
+ // Reset context after resize and prepare for rendering
76
+ ctx.imageSmoothingEnabled = true;
77
+ ctx.imageSmoothingQuality = 'high';
78
+ ctx.font = `${fontStyle} ${textSize}px "${fontFamily}"`;
79
+ ctx.fillStyle = floatRGB2HexCode(fontColor);
80
+ ctx.textBaseline = 'middle';
81
+ ctx.textAlign = 'center';
82
+
83
+ // Set shadow
84
+ if (shadowColor) {
85
+ ctx.shadowColor = floatRGB2HexCode(shadowColor);
86
+ ctx.shadowOffsetX = shadowOffset[0];
87
+ ctx.shadowOffsetY = shadowOffset[1];
88
+ ctx.shadowBlur = shadowBlur;
89
+ }
90
+
91
+ // Draw the text
92
+ ctx.fillText(text, width / 2 + hAdjustment, height / 2 + vAdjustment);
93
+
94
+ // Update plane dimensions to match text size
95
+ plane.set({
96
+ point1: [width, 0, 0],
97
+ point2: [0, height, 0]
98
+ });
99
+ return ImageHelper.canvasToImageData(canvas);
100
+ }
101
+ mapper.setInputConnection(plane.getOutputPort());
102
+ publicAPI.setMapper(mapper);
103
+ publicAPI.addTexture(texture);
104
+ model._onInputChanged = (_publicAPI, _model, value) => {
105
+ const image = createImageData(value);
106
+ texture.setInputData(image, 0);
107
+ };
108
+ }
109
+
110
+ // Default property values
111
+ const DEFAULT_VALUES = {
112
+ mapper: null,
113
+ property: null
114
+ };
115
+ function extend(publicAPI, model) {
116
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
117
+ Object.assign(model, DEFAULT_VALUES, initialValues);
118
+
119
+ // Inheritance
120
+ vtkActor2D.extend(publicAPI, model, initialValues);
121
+
122
+ // Build VTK API
123
+ macro.setGet(publicAPI, model, ['input']);
124
+
125
+ // Object methods
126
+ vtkTextActor(publicAPI, model);
127
+ }
128
+ const newInstance = macro.newInstance(extend, 'vtkTextActor');
129
+ var vtkTextActor$1 = {
130
+ newInstance,
131
+ extend
132
+ };
133
+
134
+ export { vtkTextActor$1 as default, extend, newInstance };
@@ -0,0 +1,206 @@
1
+ import { RGBColor } from './../../types';
2
+ import vtkProperty2D, { IProperty2DInitialValues } from './Property2D';
3
+
4
+ export interface ITextPropertyInitialValues extends IProperty2DInitialValues {
5
+ backgroundColor?: RGBColor;
6
+ fillStyle?: string;
7
+ fontColor?: RGBColor;
8
+ fontFamily?: string;
9
+ fontSizeScale?: (resolution: number) => number;
10
+ fontStyle?: string;
11
+ resolution?: number;
12
+ shadowBlur?: number;
13
+ shadowColor?: RGBColor;
14
+ shadowOffset?: [number, number];
15
+ }
16
+
17
+ export interface vtkTextProperty extends vtkProperty2D {
18
+ /**
19
+ * Get the background color.
20
+ */
21
+ getBackgroundColor(): RGBColor;
22
+
23
+ /**
24
+ * Get the background color by reference.
25
+ */
26
+ getBackgroundColorByReference(): RGBColor;
27
+
28
+ /**
29
+ * Get the fill style.
30
+ */
31
+ getFillStyle(): string;
32
+
33
+ /**
34
+ * Get the font color.
35
+ */
36
+ getFontColor(): RGBColor;
37
+
38
+ /**
39
+ * Get the font color by reference.
40
+ */
41
+ getFontColorByReference(): RGBColor;
42
+
43
+ /**
44
+ * Get the font family.
45
+ */
46
+ getFontFamily(): string;
47
+
48
+ /**
49
+ * Get the font size scale.
50
+ */
51
+ getFontSizeScale(): (resolution: number) => number;
52
+
53
+ /**
54
+ * Get the font style.
55
+ */
56
+ getFontStyle(): string;
57
+
58
+ /**
59
+ * Get the resolution.
60
+ */
61
+ getResolution(): number;
62
+
63
+ /**
64
+ * Get the shadow blur radius.
65
+ */
66
+ getShadowBlur(): number;
67
+
68
+ /**
69
+ * Get the shadow color.
70
+ */
71
+ getShadowColor(): RGBColor;
72
+
73
+ /**
74
+ * Get the shadow color by reference.
75
+ */
76
+ getShadowColorByReference(): RGBColor;
77
+
78
+ /**
79
+ * Get the shadow offset.
80
+ */
81
+ getShadowOffset(): [number, number];
82
+
83
+ /**
84
+ * Get the shadow offset by reference.
85
+ */
86
+ getShadowOffsetByReference(): [number, number];
87
+
88
+ /**
89
+ * Set the background color.
90
+ * @param {RGBColor} backgroundColor The background color to set.
91
+ */
92
+ setBackgroundColor(backgroundColor: RGBColor): boolean;
93
+
94
+ /**
95
+ * Set the fill style.
96
+ * @param {string} fillStyle The fill style to set.
97
+ */
98
+ setFillStyle(fillStyle: string): boolean;
99
+
100
+ /**
101
+ * Set the font color from RGB values.
102
+ * @param {number} r Red component (0-255)
103
+ * @param {number} g Green component (0-255)
104
+ * @param {number} b Blue component (0-255)
105
+ */
106
+ setFontColor(r: number, g: number, b: number): boolean;
107
+
108
+ /**
109
+ * Set the font color.
110
+ * @param {RGBColor} fontColor The font color to set.
111
+ */
112
+ setFontColorFrom(fontColor: RGBColor): boolean;
113
+
114
+ /**
115
+ * Set the font family.
116
+ * @param {string} fontFamily The font family to set.
117
+ */
118
+ setFontFamily(fontFamily: string): boolean;
119
+
120
+ /**
121
+ * Set the font size scale.
122
+ * Scales the font size based on the given resolution.
123
+ * Dividing by 1.8 ensures the font size is proportionate and not too large.
124
+ * The value 1.8 is a chosen scaling factor for visual balance.
125
+ * @param {number} resolution The resolution to set.
126
+ */
127
+ setFontSizeScale(resolution: number): number;
128
+
129
+ /**
130
+ * Set the font style.
131
+ * @param {string} fontStyle The font style to set.
132
+ */
133
+ setFontStyle(fontStyle: string): boolean;
134
+
135
+ /**
136
+ * Set the resolution.
137
+ * @param {number} resolution The resolution to set.
138
+ */
139
+ setResolution(resolution: number): boolean;
140
+
141
+ /**
142
+ * Set the shadow blur radius.
143
+ * @param {number} shadowBlur The shadow blur radius to set.
144
+ */
145
+ setShadowBlur(shadowBlur: number): boolean;
146
+
147
+ /**
148
+ * Set the shadow color from RGB values.
149
+ * @param {number} r Red component (0-255)
150
+ * @param {number} g Green component (0-255)
151
+ * @param {number} b Blue component (0-255)
152
+ */
153
+ setShadowColor(r: number, g: number, b: number): boolean;
154
+
155
+ /**
156
+ * Set the shadow color.
157
+ * @param {RGBColor} shadowColor The shadow color to set.
158
+ */
159
+ setShadowColorFrom(shadowColor: RGBColor): boolean;
160
+
161
+ /**
162
+ * Set the shadow offset from x and y values.
163
+ * @param {number} x Horizontal offset
164
+ * @param {number} y Vertical offset
165
+ */
166
+ setShadowOffset(x: number, y: number): boolean;
167
+
168
+ /**
169
+ * Set the shadow offset.
170
+ * @param {Array} shadowOffset The shadow offset to set, as an array of [x, y].
171
+ */
172
+ setShadowOffsetFrom(shadowOffset: [number, number]): boolean;
173
+ }
174
+
175
+ /**
176
+ * Method use to decorate a given object (publicAPI+model) with vtkProperty characteristics.
177
+ *
178
+ * @param publicAPI object on which methods will be bounds (public)
179
+ * @param model object on which data structure will be bounds (protected)
180
+ * @param {ITextPropertyInitialValues} [initialValues] (default: {})
181
+ */
182
+ export function extend(
183
+ publicAPI: object,
184
+ model: object,
185
+ initialValues?: ITextPropertyInitialValues
186
+ ): void;
187
+
188
+ /**
189
+ * Method use to create a new instance of vtkTextProperty.
190
+ * @param {ITextPropertyInitialValues} [initialValues] for pre-setting some of its content
191
+ */
192
+ export function newInstance(
193
+ initialValues?: ITextPropertyInitialValues
194
+ ): vtkTextProperty;
195
+
196
+ /**
197
+ * vtkTextProperty is an object that represents text properties. The primary
198
+ * properties that can be set are color, opacity, font size, font family
199
+ * horizontal and vertical justification, bold/italic/shadow styles.
200
+ */
201
+ export declare const vtkTextProperty: {
202
+ newInstance: typeof newInstance;
203
+ extend: typeof extend;
204
+ };
205
+
206
+ export default vtkTextProperty;
@@ -0,0 +1,61 @@
1
+ import { m as macro } from '../../macros2.js';
2
+ import vtkProperty2D from './Property2D.js';
3
+
4
+ // ----------------------------------------------------------------------------
5
+ // vtkTextProperty methods
6
+ // ----------------------------------------------------------------------------
7
+
8
+ function vtkTextProperty(publicAPI, model) {
9
+ // Set our className
10
+ model.classHierarchy.push('vtkTextProperty');
11
+ }
12
+
13
+ // ----------------------------------------------------------------------------
14
+ // Object factory
15
+ // ----------------------------------------------------------------------------
16
+
17
+ const DEFAULT_VALUES = {
18
+ fontFamily: 'Arial',
19
+ fontColor: [0, 0, 0],
20
+ fontStyle: 'normal',
21
+ // backgroundColor: [1, 1, 1],
22
+ // Scales the font size based on the given resolution.
23
+ // Dividing by 1.8 ensures the font size is proportionate and not too large.
24
+ // The value 1.8 is a chosen scaling factor for visual balance.
25
+ fontSizeScale: resolution => resolution / 1.8,
26
+ resolution: 200
27
+ // shadowColor: [1, 1, 0],
28
+ // shadowOffset: [1, -1],
29
+ // shadowBlur: 0,
30
+ };
31
+
32
+ // ----------------------------------------------------------------------------
33
+ function extend(publicAPI, model) {
34
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35
+ Object.assign(model, DEFAULT_VALUES, initialValues);
36
+
37
+ // Inheritance
38
+ vtkProperty2D.extend(publicAPI, model, initialValues);
39
+
40
+ // Build VTK API
41
+
42
+ macro.setGet(publicAPI, model, ['fontFamily', 'fontStyle', 'fillStyle', 'fontSizeScale', 'resolution', 'shadowBlur']);
43
+ macro.setGetArray(publicAPI, model, ['shadowOffset'], 2);
44
+ macro.setGetArray(publicAPI, model, ['backgroundColor', 'fontColor', 'shadowColor'], 3);
45
+
46
+ // Object methods
47
+ vtkTextProperty(publicAPI, model);
48
+ }
49
+
50
+ // ----------------------------------------------------------------------------
51
+
52
+ const newInstance = macro.newInstance(extend, 'vtkTextProperty');
53
+
54
+ // ----------------------------------------------------------------------------
55
+
56
+ var vtkTextProperty$1 = {
57
+ newInstance,
58
+ extend
59
+ };
60
+
61
+ export { vtkTextProperty$1 as default, extend, newInstance };
package/Rendering/Core.js CHANGED
@@ -38,6 +38,8 @@ import vtkSkybox from './Core/Skybox.js';
38
38
  import vtkSphereMapper from './Core/SphereMapper.js';
39
39
  import vtkStickMapper from './Core/StickMapper.js';
40
40
  import vtkTexture from './Core/Texture.js';
41
+ import vtkTextActor from './Core/TextActor.js';
42
+ import vtkTextProperty from './Core/TextProperty.js';
41
43
  import vtkVector from './Core/VectorText.js';
42
44
  import vtkViewport from './Core/Viewport.js';
43
45
  import vtkVolume from './Core/Volume.js';
@@ -88,6 +90,8 @@ var Core = {
88
90
  vtkSphereMapper,
89
91
  vtkStickMapper,
90
92
  vtkTexture,
93
+ vtkTextActor,
94
+ vtkTextProperty,
91
95
  vtkVector,
92
96
  vtkViewport,
93
97
  vtkVolume,
@@ -3,7 +3,7 @@ import Constants from './Texture/Constants.js';
3
3
  import HalfFloat from '../../Common/Core/HalfFloat.js';
4
4
  import { n as newInstance$1, o as obj, s as set, e as setGet, g as get, i as moveToProtected, a as newTypedArray, c as macro } from '../../macros2.js';
5
5
  import vtkDataArray from '../../Common/Core/DataArray.js';
6
- import { V as isPowerOfTwo, R as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
6
+ import { W as isPowerOfTwo, R as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
7
7
  import vtkViewNode from '../SceneGraph/ViewNode.js';
8
8
  import { registerOverride } from './ViewNodeFactory.js';
9
9
  import supportsNorm16LinearCached from './Texture/supportsNorm16Linear.js';
@@ -3,7 +3,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
3
3
  import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
4
4
  import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
5
5
  import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
6
- import { s as subtract, W as angleBetweenVectors } from '../../Common/Core/Math/index.js';
6
+ import { s as subtract, X as angleBetweenVectors } from '../../Common/Core/Math/index.js';
7
7
  import widgetBehavior from './AngleWidget/behavior.js';
8
8
  import generateState from './AngleWidget/state.js';
9
9
  import { ViewTypes } from '../Core/WidgetManager/Constants.js';
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../../macros2.js';
2
2
  import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
3
3
  import vtkLine from '../../../Common/DataModel/Line.js';
4
- import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, w as multiplyScalar, X as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
4
+ import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, w as multiplyScalar, Y as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
5
5
  import { getLineNames, getOtherLineName, updateState, boundPointOnPlane, getLinePlaneName, getLineInPlaneName, rotateVector } from './helpers.js';
6
6
  import { InteractionMethodsName, ScrollingMethods, planeNameToViewType } from './Constants.js';
7
7
 
@@ -2,7 +2,7 @@ import vtkBoundingBox, { STATIC } from '../../../Common/DataModel/BoundingBox.js
2
2
  import vtkCubeSource from '../../../Filters/Sources/CubeSource.js';
3
3
  import vtkCutter from '../../../Filters/Core/Cutter.js';
4
4
  import vtkPlane from '../../../Common/DataModel/Plane.js';
5
- import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate, X as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
5
+ import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate, Y as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
6
6
  import vtkMatrixBuilder from '../../../Common/Core/MatrixBuilder.js';
7
7
  import { viewTypeToPlaneName, planeNameToViewType, planeNames } from './Constants.js';
8
8
 
package/index.d.ts CHANGED
@@ -205,6 +205,8 @@
205
205
  /// <reference path="./Rendering/Core/Skybox.d.ts" />
206
206
  /// <reference path="./Rendering/Core/SphereMapper.d.ts" />
207
207
  /// <reference path="./Rendering/Core/StickMapper.d.ts" />
208
+ /// <reference path="./Rendering/Core/TextActor.d.ts" />
209
+ /// <reference path="./Rendering/Core/TextProperty.d.ts" />
208
210
  /// <reference path="./Rendering/Core/Texture.d.ts" />
209
211
  /// <reference path="./Rendering/Core/VectorText.d.ts" />
210
212
  /// <reference path="./Rendering/Core/Viewport.d.ts" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "34.2.0",
3
+ "version": "34.3.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",