@mlightcad/mtext-renderer 0.12.0 → 0.12.1
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 +1939 -1916
- package/dist/index.umd.cjs +9 -9
- package/dist/mtext-renderer-worker.js +1845 -1836
- package/lib/renderer/colorUtils.d.ts +24 -4
- package/lib/worker/webWorkerRenderer.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,10 +1,30 @@
|
|
|
1
|
+
import { MTextColor } from '@mlightcad/mtext-parser';
|
|
1
2
|
import { ColorSettings } from './types';
|
|
2
3
|
export declare function resolveMTextColor(colorSettings: ColorSettings): number;
|
|
4
|
+
/** Wire-format for an `MTextColor` carried on worker glyph payloads. */
|
|
5
|
+
export interface SerializedMTextColor {
|
|
6
|
+
aci?: number | null;
|
|
7
|
+
rgbValue?: number | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Serializes an `MTextColor` for worker → main-thread transfer.
|
|
11
|
+
*
|
|
12
|
+
* Prefer this over baking only the resolved RGB: ACI 7 (canvas foreground) and
|
|
13
|
+
* ACI 255 (literal white) both resolve to `0xffffff` on a dark canvas, but only
|
|
14
|
+
* ACI 7 must invert when the background flips.
|
|
15
|
+
*/
|
|
16
|
+
export declare function serializeMTextColor(color: MTextColor): SerializedMTextColor;
|
|
17
|
+
/** Revives a wire-format color into a real `MTextColor` instance. */
|
|
18
|
+
export declare function deserializeMTextColor(serialized?: SerializedMTextColor | null): MTextColor | undefined;
|
|
3
19
|
/**
|
|
4
20
|
* Rebuild ColorSettings for a worker-deserialized glyph material.
|
|
5
21
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
22
|
+
* Prefer {@link serializedColor} when the worker attached the original segment
|
|
23
|
+
* color (ACI / RGB). Falling back to resolved RGB alone cannot distinguish
|
|
24
|
+
* ACI 7 from ACI 255.
|
|
25
|
+
*
|
|
26
|
+
* Without a serialized color, preserve ByLayer / ByBlock / entity ACI when the
|
|
27
|
+
* glyph RGB still matches the entity base resolution; otherwise bake RGB for
|
|
28
|
+
* true inline overrides.
|
|
9
29
|
*/
|
|
10
|
-
export declare function buildWorkerMaterialColorSettings(base: ColorSettings, resolvedColor: number, baseByLayer: boolean): ColorSettings;
|
|
30
|
+
export declare function buildWorkerMaterialColorSettings(base: ColorSettings, resolvedColor: number, baseByLayer: boolean, serializedColor?: SerializedMTextColor | null): ColorSettings;
|
|
@@ -113,6 +113,11 @@ interface SerializedChild {
|
|
|
113
113
|
opacity: number;
|
|
114
114
|
side?: number;
|
|
115
115
|
linewidth?: number;
|
|
116
|
+
/** Original segment colour when the worker preserved ACI/RGB semantics. */
|
|
117
|
+
mtextColor?: {
|
|
118
|
+
aci?: number | null;
|
|
119
|
+
rgbValue?: number | null;
|
|
120
|
+
};
|
|
116
121
|
};
|
|
117
122
|
charBoxType?: CharBox['type'];
|
|
118
123
|
lineLayouts?: Array<{
|