@pixerate/editor 0.88.0 → 0.90.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/THIRD_PARTY_NOTICES.md +8 -2
- package/dist/agent/index.cjs +28 -28
- package/dist/agent/index.js +3 -3
- package/dist/canvas/index.cjs +3 -3
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.js +16 -16
- package/dist/{chunk-TYOAJDFD.cjs → chunk-66IMF6OD.cjs} +3 -3
- package/dist/{chunk-TYOAJDFD.cjs.map → chunk-66IMF6OD.cjs.map} +1 -1
- package/dist/chunk-D4ZCU72J.js +604 -0
- package/dist/chunk-D4ZCU72J.js.map +1 -0
- package/dist/{chunk-IMSX4IVG.js → chunk-FWEO3HSL.js} +4 -4
- package/dist/chunk-H543GD6T.cjs +1696 -0
- package/dist/chunk-H543GD6T.cjs.map +1 -0
- package/dist/{chunk-ROXFP2LQ.cjs → chunk-HNDSPZ5T.cjs} +4 -4
- package/dist/{chunk-ROXFP2LQ.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
- package/dist/{chunk-MXF4DP2C.cjs → chunk-J3B45HTA.cjs} +74 -74
- package/dist/{chunk-MXF4DP2C.cjs.map → chunk-J3B45HTA.cjs.map} +1 -1
- package/dist/{chunk-GNO5PEMH.js → chunk-OK7T2LHK.js} +2 -2
- package/dist/chunk-P5TPUNBZ.js +1696 -0
- package/dist/chunk-P5TPUNBZ.js.map +1 -0
- package/dist/chunk-PDCITYBT.cjs +416 -0
- package/dist/chunk-PDCITYBT.cjs.map +1 -0
- package/dist/{chunk-RKJDBXTY.cjs → chunk-T4XWVPJK.cjs} +3 -3
- package/dist/{chunk-RKJDBXTY.cjs.map → chunk-T4XWVPJK.cjs.map} +1 -1
- package/dist/{chunk-ZQNDSUZO.js → chunk-UKI64KUD.js} +6 -6
- package/dist/{chunk-SVW2UNUC.js → chunk-WON34HKM.js} +2 -2
- package/dist/chunk-YLB2WVNA.js +416 -0
- package/dist/chunk-YLB2WVNA.js.map +1 -0
- package/dist/chunk-ZOOEX3WT.cjs +604 -0
- package/dist/chunk-ZOOEX3WT.cjs.map +1 -0
- package/dist/extensions/index.cjs +6 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +5 -5
- package/dist/image-editor/index.cjs +7146 -855
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +2050 -532
- package/dist/image-editor/index.d.ts +2050 -532
- package/dist/image-editor/index.js +8134 -1843
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +27 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -10
- package/dist/paint/index.cjs +38 -0
- package/dist/paint/index.cjs.map +1 -0
- package/dist/paint/index.d.cts +167 -0
- package/dist/paint/index.d.ts +167 -0
- package/dist/paint/index.js +38 -0
- package/dist/paint/index.js.map +1 -0
- package/dist/raster/index.cjs +121 -0
- package/dist/raster/index.cjs.map +1 -0
- package/dist/raster/index.d.cts +365 -0
- package/dist/raster/index.d.ts +365 -0
- package/dist/raster/index.js +121 -0
- package/dist/raster/index.js.map +1 -0
- package/dist/serializers/index.cjs +4 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.js +3 -3
- package/dist/surface-fJhkmNQn.d.cts +181 -0
- package/dist/surface-fJhkmNQn.d.ts +181 -0
- package/package.json +13 -2
- package/skills/pixerate-image-editor/SKILL.md +111 -11
- /package/dist/{chunk-IMSX4IVG.js.map → chunk-FWEO3HSL.js.map} +0 -0
- /package/dist/{chunk-GNO5PEMH.js.map → chunk-OK7T2LHK.js.map} +0 -0
- /package/dist/{chunk-ZQNDSUZO.js.map → chunk-UKI64KUD.js.map} +0 -0
- /package/dist/{chunk-SVW2UNUC.js.map → chunk-WON34HKM.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -174,7 +174,7 @@ import {
|
|
|
174
174
|
updateImageSrc,
|
|
175
175
|
validateFindPattern,
|
|
176
176
|
writeRichClipboard
|
|
177
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-FWEO3HSL.js";
|
|
178
178
|
import {
|
|
179
179
|
compareDocuments,
|
|
180
180
|
compareHtml,
|
|
@@ -255,7 +255,7 @@ import {
|
|
|
255
255
|
tableNestingPluginKey,
|
|
256
256
|
typeAgentText,
|
|
257
257
|
unnestTables
|
|
258
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-OK7T2LHK.js";
|
|
259
259
|
import "./chunk-ZOH6X3VR.js";
|
|
260
260
|
import "./chunk-OEFCLWZ3.js";
|
|
261
261
|
import "./chunk-633QC34G.js";
|
|
@@ -293,7 +293,7 @@ import {
|
|
|
293
293
|
rtfToPlainText,
|
|
294
294
|
sanitizeImportedHtml,
|
|
295
295
|
serializeRichClipboardPayload
|
|
296
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-WON34HKM.js";
|
|
297
297
|
import {
|
|
298
298
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
299
299
|
escapeHtml,
|
|
@@ -311,7 +311,13 @@ import {
|
|
|
311
311
|
sanitizeHtml,
|
|
312
312
|
splitMarkdownMentionParts,
|
|
313
313
|
stripMarkdownCode
|
|
314
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-UKI64KUD.js";
|
|
315
|
+
import {
|
|
316
|
+
MENTION_REGEX,
|
|
317
|
+
findTextMentions,
|
|
318
|
+
formatMentionText,
|
|
319
|
+
setMentionRoleInText
|
|
320
|
+
} from "./chunk-O5RYH2PG.js";
|
|
315
321
|
import {
|
|
316
322
|
BLOCK_CHANGE_ATTRIBUTE,
|
|
317
323
|
CommentStore,
|
|
@@ -341,12 +347,6 @@ import {
|
|
|
341
347
|
trackChangesPluginKey,
|
|
342
348
|
trackedChangeLabel
|
|
343
349
|
} from "./chunk-SWE3NPOU.js";
|
|
344
|
-
import {
|
|
345
|
-
MENTION_REGEX,
|
|
346
|
-
findTextMentions,
|
|
347
|
-
formatMentionText,
|
|
348
|
-
setMentionRoleInText
|
|
349
|
-
} from "./chunk-O5RYH2PG.js";
|
|
350
350
|
import {
|
|
351
351
|
CONDITIONAL_FORMAT_ICON_SETS,
|
|
352
352
|
CONDITIONAL_FORMAT_PRESETS,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkPDCITYBTcjs = require('../chunk-PDCITYBT.cjs');
|
|
19
|
+
require('../chunk-ZOOEX3WT.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.CoverageMap = _chunkPDCITYBTcjs.CoverageMap; exports.DEFAULT_BRUSH = _chunkPDCITYBTcjs.DEFAULT_BRUSH; exports.DabWalker = _chunkPDCITYBTcjs.DabWalker; exports.MAX_BRUSH_SIZE = _chunkPDCITYBTcjs.MAX_BRUSH_SIZE; exports.StrokeCoverage = _chunkPDCITYBTcjs.StrokeCoverage; exports.applyStrokeToTile = _chunkPDCITYBTcjs.applyStrokeToTile; exports.coverageTileCoord = _chunkPDCITYBTcjs.coverageTileCoord; exports.dabCoverage = _chunkPDCITYBTcjs.dabCoverage; exports.dabRect = _chunkPDCITYBTcjs.dabRect; exports.normalizeBrush = _chunkPDCITYBTcjs.normalizeBrush; exports.rasterizeDab = _chunkPDCITYBTcjs.rasterizeDab; exports.smoothPoints = _chunkPDCITYBTcjs.smoothPoints; exports.tipFalloff = _chunkPDCITYBTcjs.tipFalloff; exports.tipReach = _chunkPDCITYBTcjs.tipReach; exports.tipShape = _chunkPDCITYBTcjs.tipShape; exports.walkDabs = _chunkPDCITYBTcjs.walkDabs;
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/paint/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,i2BAAC","file":"/home/runner/work/editor/editor/packages/core/dist/paint/index.cjs"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { B as BlendMode, R as RasterRect, h as TileKey } from '../surface-fJhkmNQn.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The brush engine (a subset of photocraft's `crates/paint`): a computed round tip with size,
|
|
5
|
+
* hardness, angle, roundness and spacing; pressure to size and opacity; smoothing; and Photoshop's
|
|
6
|
+
* opacity-versus-flow build-up. Strokes are data, so one replays the same way for undo, agents
|
|
7
|
+
* and tests.
|
|
8
|
+
*
|
|
9
|
+
* - Points are walked into dabs at `spacing × diameter` (`walkDabs`).
|
|
10
|
+
* - Each dab's coverage (`dabCoverage`, photocraft's measured Photoshop profile) builds up in a
|
|
11
|
+
* stroke coverage map with flow towards the dab's opacity ceiling: `c ← c + v·(ceil − c)`.
|
|
12
|
+
* - The stroke composites once at the stroke opacity over the layer as it was before the stroke,
|
|
13
|
+
* so overlapping dabs never exceed the opacity.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** One input sample. Missing pressure is a mouse (1). */
|
|
17
|
+
interface StrokePoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
/** 0..1 (default 1). */
|
|
21
|
+
pressure?: number;
|
|
22
|
+
/** Milliseconds (optional; kept for replays). */
|
|
23
|
+
t?: number;
|
|
24
|
+
}
|
|
25
|
+
interface BrushSettings {
|
|
26
|
+
/** Diameter in pixels (1..2500, default 20). */
|
|
27
|
+
size: number;
|
|
28
|
+
/** 0 (soft) .. 1 (hard, default). */
|
|
29
|
+
hardness: number;
|
|
30
|
+
/** Dab spacing as a fraction of the diameter (0.01..10, default 0.1). */
|
|
31
|
+
spacing: number;
|
|
32
|
+
/** Tip angle in degrees (default 0). */
|
|
33
|
+
angle: number;
|
|
34
|
+
/** Tip roundness 0.01..1 (default 1). */
|
|
35
|
+
roundness: number;
|
|
36
|
+
/** Stroke opacity ceiling 0..1 (default 1). */
|
|
37
|
+
opacity: number;
|
|
38
|
+
/** Build-up per dab 0..1 (default 1). */
|
|
39
|
+
flow: number;
|
|
40
|
+
/** Input smoothing 0..0.95 (default 0). */
|
|
41
|
+
smoothing: number;
|
|
42
|
+
/** Pressure controls size (default true). */
|
|
43
|
+
pressureSize: boolean;
|
|
44
|
+
/** Pressure controls opacity (default false). */
|
|
45
|
+
pressureOpacity: boolean;
|
|
46
|
+
/** How the stroke paints onto the layer (default normal). */
|
|
47
|
+
blend: BlendMode;
|
|
48
|
+
}
|
|
49
|
+
declare const DEFAULT_BRUSH: Readonly<BrushSettings>;
|
|
50
|
+
declare const MAX_BRUSH_SIZE = 2500;
|
|
51
|
+
/** A brush with every field in range (missing fields from `DEFAULT_BRUSH`). */
|
|
52
|
+
declare function normalizeBrush(raw?: Partial<BrushSettings>): BrushSettings;
|
|
53
|
+
/** The core radius and shoulder width (pixels) of a round tip of `radius` and `hardness`. */
|
|
54
|
+
declare function tipShape(radius: number, hardness: number): [number, number];
|
|
55
|
+
/** Opacity of a round tip at distance `d` from its centre. */
|
|
56
|
+
declare function tipFalloff(d: number, radius: number, hardness: number): number;
|
|
57
|
+
/** How far from its centre a round tip still paints. */
|
|
58
|
+
declare function tipReach(radius: number, hardness: number): number;
|
|
59
|
+
/** Coverage of a round dab at distance `d` from its centre. */
|
|
60
|
+
declare function dabCoverage(d: number, radius: number, hardness: number): number;
|
|
61
|
+
interface Dab {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
radius: number;
|
|
65
|
+
/** Flow (per-dab build-up). */
|
|
66
|
+
alpha: number;
|
|
67
|
+
/** Opacity ceiling this dab builds up to. */
|
|
68
|
+
opacity: number;
|
|
69
|
+
/** Radians. */
|
|
70
|
+
angle: number;
|
|
71
|
+
roundness: number;
|
|
72
|
+
}
|
|
73
|
+
/** Exponential smoothing of input points; the first and last point are kept. */
|
|
74
|
+
declare function smoothPoints(points: readonly StrokePoint[], amount: number): StrokePoint[];
|
|
75
|
+
/**
|
|
76
|
+
* Walks points into dabs (incrementally: feed points in any chunks and get the same dabs). The
|
|
77
|
+
* first point is a dab; then one every `spacing × diameter` along the path.
|
|
78
|
+
*/
|
|
79
|
+
declare class DabWalker {
|
|
80
|
+
readonly brush: BrushSettings;
|
|
81
|
+
private last;
|
|
82
|
+
private nextAt;
|
|
83
|
+
private pendingFirst;
|
|
84
|
+
constructor(brush: BrushSettings);
|
|
85
|
+
private diameter;
|
|
86
|
+
private stepLen;
|
|
87
|
+
private dab;
|
|
88
|
+
push(p: StrokePoint, out: Dab[]): void;
|
|
89
|
+
finish(out: Dab[]): void;
|
|
90
|
+
}
|
|
91
|
+
/** All dabs of a point list (smoothing applied). */
|
|
92
|
+
declare function walkDabs(points: readonly StrokePoint[], brush: BrushSettings): Dab[];
|
|
93
|
+
/** The pixel rectangle a dab can touch. */
|
|
94
|
+
declare function dabRect(d: Dab, hardness: number): RasterRect;
|
|
95
|
+
/**
|
|
96
|
+
* Rasterizes one dab over `rect` into `out` (rect.width × rect.height values, coverage × flow).
|
|
97
|
+
* Small tips (radius below 3 px) take each pixel's covered area from a 4×4 grid.
|
|
98
|
+
*/
|
|
99
|
+
declare function rasterizeDab(d: Dab, hardness: number, rect: RasterRect, out: Float32Array): void;
|
|
100
|
+
/** A stroke's accumulated coverage, in 256 px tiles over document space. */
|
|
101
|
+
declare class CoverageMap {
|
|
102
|
+
readonly tiles: Map<number, Float32Array<ArrayBufferLike>>;
|
|
103
|
+
bounds: RasterRect | null;
|
|
104
|
+
private dirty;
|
|
105
|
+
get(x: number, y: number): number;
|
|
106
|
+
/** Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. */
|
|
107
|
+
accumulate(rect: RasterRect, vals: Float32Array, ceil: number): void;
|
|
108
|
+
/** Tiles changed since the last call. */
|
|
109
|
+
takeDirty(): TileKey[];
|
|
110
|
+
}
|
|
111
|
+
/** Paints a stroke's dabs into a coverage map, incrementally. */
|
|
112
|
+
declare class StrokeCoverage {
|
|
113
|
+
readonly brush: BrushSettings;
|
|
114
|
+
readonly coverage: CoverageMap;
|
|
115
|
+
private walker;
|
|
116
|
+
private smoothing;
|
|
117
|
+
private smoothPos;
|
|
118
|
+
private buf;
|
|
119
|
+
dabCount: number;
|
|
120
|
+
constructor(brush: BrushSettings);
|
|
121
|
+
/** Feeds input points; returns the document rectangles the new dabs touched. */
|
|
122
|
+
push(points: readonly StrokePoint[]): RasterRect[];
|
|
123
|
+
/** Ends the stroke (a single click still paints one dab). */
|
|
124
|
+
finish(last?: StrokePoint): RasterRect[];
|
|
125
|
+
private smooth;
|
|
126
|
+
private paint;
|
|
127
|
+
}
|
|
128
|
+
/** How a stroke changes pixels. */
|
|
129
|
+
interface StrokeApply {
|
|
130
|
+
/** `paint` puts colour down; `erase` removes alpha (or, with transparency locked, paints `background`). */
|
|
131
|
+
mode: 'paint' | 'erase';
|
|
132
|
+
/** RGBA 0..255 (paint colour, or the mask grey in `r`). */
|
|
133
|
+
color: readonly [number, number, number, number];
|
|
134
|
+
/** RGBA 0..255 the eraser paints on a transparency-locked layer (and on masks). */
|
|
135
|
+
background: readonly [number, number, number, number];
|
|
136
|
+
opacity: number;
|
|
137
|
+
blend: BlendMode;
|
|
138
|
+
lockTransparency: boolean;
|
|
139
|
+
/** Selection coverage (document space, canvas-sized), or `null`. */
|
|
140
|
+
selection: {
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
data: ArrayLike<number>;
|
|
144
|
+
} | null;
|
|
145
|
+
/** Layer offset (target pixels are in layer space). */
|
|
146
|
+
offset: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Composites the stroke's coverage over `tileData` (the target's tile (tx, ty) as it was before
|
|
153
|
+
* the stroke, in layer space; RGBA or one byte for masks) and returns the new tile data. With
|
|
154
|
+
* `into` (the tile's previous result) and `region` (document space), only `region` is recomputed
|
|
155
|
+
* and the rest of `into` is kept.
|
|
156
|
+
*/
|
|
157
|
+
declare function applyStrokeToTile(coverage: CoverageMap, tileData: Uint8ClampedArray, channels: 1 | 4, tx: number, ty: number, s: StrokeApply, options?: {
|
|
158
|
+
into?: Uint8ClampedArray;
|
|
159
|
+
region?: RasterRect;
|
|
160
|
+
}): Uint8ClampedArray;
|
|
161
|
+
/** Tile coordinates of coverage tile keys (for callers that track dirty tiles). */
|
|
162
|
+
declare function coverageTileCoord(key: TileKey): {
|
|
163
|
+
tx: number;
|
|
164
|
+
ty: number;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, type Dab, DabWalker, MAX_BRUSH_SIZE, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, coverageTileCoord, dabCoverage, dabRect, normalizeBrush, rasterizeDab, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { B as BlendMode, R as RasterRect, h as TileKey } from '../surface-fJhkmNQn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The brush engine (a subset of photocraft's `crates/paint`): a computed round tip with size,
|
|
5
|
+
* hardness, angle, roundness and spacing; pressure to size and opacity; smoothing; and Photoshop's
|
|
6
|
+
* opacity-versus-flow build-up. Strokes are data, so one replays the same way for undo, agents
|
|
7
|
+
* and tests.
|
|
8
|
+
*
|
|
9
|
+
* - Points are walked into dabs at `spacing × diameter` (`walkDabs`).
|
|
10
|
+
* - Each dab's coverage (`dabCoverage`, photocraft's measured Photoshop profile) builds up in a
|
|
11
|
+
* stroke coverage map with flow towards the dab's opacity ceiling: `c ← c + v·(ceil − c)`.
|
|
12
|
+
* - The stroke composites once at the stroke opacity over the layer as it was before the stroke,
|
|
13
|
+
* so overlapping dabs never exceed the opacity.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** One input sample. Missing pressure is a mouse (1). */
|
|
17
|
+
interface StrokePoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
/** 0..1 (default 1). */
|
|
21
|
+
pressure?: number;
|
|
22
|
+
/** Milliseconds (optional; kept for replays). */
|
|
23
|
+
t?: number;
|
|
24
|
+
}
|
|
25
|
+
interface BrushSettings {
|
|
26
|
+
/** Diameter in pixels (1..2500, default 20). */
|
|
27
|
+
size: number;
|
|
28
|
+
/** 0 (soft) .. 1 (hard, default). */
|
|
29
|
+
hardness: number;
|
|
30
|
+
/** Dab spacing as a fraction of the diameter (0.01..10, default 0.1). */
|
|
31
|
+
spacing: number;
|
|
32
|
+
/** Tip angle in degrees (default 0). */
|
|
33
|
+
angle: number;
|
|
34
|
+
/** Tip roundness 0.01..1 (default 1). */
|
|
35
|
+
roundness: number;
|
|
36
|
+
/** Stroke opacity ceiling 0..1 (default 1). */
|
|
37
|
+
opacity: number;
|
|
38
|
+
/** Build-up per dab 0..1 (default 1). */
|
|
39
|
+
flow: number;
|
|
40
|
+
/** Input smoothing 0..0.95 (default 0). */
|
|
41
|
+
smoothing: number;
|
|
42
|
+
/** Pressure controls size (default true). */
|
|
43
|
+
pressureSize: boolean;
|
|
44
|
+
/** Pressure controls opacity (default false). */
|
|
45
|
+
pressureOpacity: boolean;
|
|
46
|
+
/** How the stroke paints onto the layer (default normal). */
|
|
47
|
+
blend: BlendMode;
|
|
48
|
+
}
|
|
49
|
+
declare const DEFAULT_BRUSH: Readonly<BrushSettings>;
|
|
50
|
+
declare const MAX_BRUSH_SIZE = 2500;
|
|
51
|
+
/** A brush with every field in range (missing fields from `DEFAULT_BRUSH`). */
|
|
52
|
+
declare function normalizeBrush(raw?: Partial<BrushSettings>): BrushSettings;
|
|
53
|
+
/** The core radius and shoulder width (pixels) of a round tip of `radius` and `hardness`. */
|
|
54
|
+
declare function tipShape(radius: number, hardness: number): [number, number];
|
|
55
|
+
/** Opacity of a round tip at distance `d` from its centre. */
|
|
56
|
+
declare function tipFalloff(d: number, radius: number, hardness: number): number;
|
|
57
|
+
/** How far from its centre a round tip still paints. */
|
|
58
|
+
declare function tipReach(radius: number, hardness: number): number;
|
|
59
|
+
/** Coverage of a round dab at distance `d` from its centre. */
|
|
60
|
+
declare function dabCoverage(d: number, radius: number, hardness: number): number;
|
|
61
|
+
interface Dab {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
radius: number;
|
|
65
|
+
/** Flow (per-dab build-up). */
|
|
66
|
+
alpha: number;
|
|
67
|
+
/** Opacity ceiling this dab builds up to. */
|
|
68
|
+
opacity: number;
|
|
69
|
+
/** Radians. */
|
|
70
|
+
angle: number;
|
|
71
|
+
roundness: number;
|
|
72
|
+
}
|
|
73
|
+
/** Exponential smoothing of input points; the first and last point are kept. */
|
|
74
|
+
declare function smoothPoints(points: readonly StrokePoint[], amount: number): StrokePoint[];
|
|
75
|
+
/**
|
|
76
|
+
* Walks points into dabs (incrementally: feed points in any chunks and get the same dabs). The
|
|
77
|
+
* first point is a dab; then one every `spacing × diameter` along the path.
|
|
78
|
+
*/
|
|
79
|
+
declare class DabWalker {
|
|
80
|
+
readonly brush: BrushSettings;
|
|
81
|
+
private last;
|
|
82
|
+
private nextAt;
|
|
83
|
+
private pendingFirst;
|
|
84
|
+
constructor(brush: BrushSettings);
|
|
85
|
+
private diameter;
|
|
86
|
+
private stepLen;
|
|
87
|
+
private dab;
|
|
88
|
+
push(p: StrokePoint, out: Dab[]): void;
|
|
89
|
+
finish(out: Dab[]): void;
|
|
90
|
+
}
|
|
91
|
+
/** All dabs of a point list (smoothing applied). */
|
|
92
|
+
declare function walkDabs(points: readonly StrokePoint[], brush: BrushSettings): Dab[];
|
|
93
|
+
/** The pixel rectangle a dab can touch. */
|
|
94
|
+
declare function dabRect(d: Dab, hardness: number): RasterRect;
|
|
95
|
+
/**
|
|
96
|
+
* Rasterizes one dab over `rect` into `out` (rect.width × rect.height values, coverage × flow).
|
|
97
|
+
* Small tips (radius below 3 px) take each pixel's covered area from a 4×4 grid.
|
|
98
|
+
*/
|
|
99
|
+
declare function rasterizeDab(d: Dab, hardness: number, rect: RasterRect, out: Float32Array): void;
|
|
100
|
+
/** A stroke's accumulated coverage, in 256 px tiles over document space. */
|
|
101
|
+
declare class CoverageMap {
|
|
102
|
+
readonly tiles: Map<number, Float32Array<ArrayBufferLike>>;
|
|
103
|
+
bounds: RasterRect | null;
|
|
104
|
+
private dirty;
|
|
105
|
+
get(x: number, y: number): number;
|
|
106
|
+
/** Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. */
|
|
107
|
+
accumulate(rect: RasterRect, vals: Float32Array, ceil: number): void;
|
|
108
|
+
/** Tiles changed since the last call. */
|
|
109
|
+
takeDirty(): TileKey[];
|
|
110
|
+
}
|
|
111
|
+
/** Paints a stroke's dabs into a coverage map, incrementally. */
|
|
112
|
+
declare class StrokeCoverage {
|
|
113
|
+
readonly brush: BrushSettings;
|
|
114
|
+
readonly coverage: CoverageMap;
|
|
115
|
+
private walker;
|
|
116
|
+
private smoothing;
|
|
117
|
+
private smoothPos;
|
|
118
|
+
private buf;
|
|
119
|
+
dabCount: number;
|
|
120
|
+
constructor(brush: BrushSettings);
|
|
121
|
+
/** Feeds input points; returns the document rectangles the new dabs touched. */
|
|
122
|
+
push(points: readonly StrokePoint[]): RasterRect[];
|
|
123
|
+
/** Ends the stroke (a single click still paints one dab). */
|
|
124
|
+
finish(last?: StrokePoint): RasterRect[];
|
|
125
|
+
private smooth;
|
|
126
|
+
private paint;
|
|
127
|
+
}
|
|
128
|
+
/** How a stroke changes pixels. */
|
|
129
|
+
interface StrokeApply {
|
|
130
|
+
/** `paint` puts colour down; `erase` removes alpha (or, with transparency locked, paints `background`). */
|
|
131
|
+
mode: 'paint' | 'erase';
|
|
132
|
+
/** RGBA 0..255 (paint colour, or the mask grey in `r`). */
|
|
133
|
+
color: readonly [number, number, number, number];
|
|
134
|
+
/** RGBA 0..255 the eraser paints on a transparency-locked layer (and on masks). */
|
|
135
|
+
background: readonly [number, number, number, number];
|
|
136
|
+
opacity: number;
|
|
137
|
+
blend: BlendMode;
|
|
138
|
+
lockTransparency: boolean;
|
|
139
|
+
/** Selection coverage (document space, canvas-sized), or `null`. */
|
|
140
|
+
selection: {
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
data: ArrayLike<number>;
|
|
144
|
+
} | null;
|
|
145
|
+
/** Layer offset (target pixels are in layer space). */
|
|
146
|
+
offset: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Composites the stroke's coverage over `tileData` (the target's tile (tx, ty) as it was before
|
|
153
|
+
* the stroke, in layer space; RGBA or one byte for masks) and returns the new tile data. With
|
|
154
|
+
* `into` (the tile's previous result) and `region` (document space), only `region` is recomputed
|
|
155
|
+
* and the rest of `into` is kept.
|
|
156
|
+
*/
|
|
157
|
+
declare function applyStrokeToTile(coverage: CoverageMap, tileData: Uint8ClampedArray, channels: 1 | 4, tx: number, ty: number, s: StrokeApply, options?: {
|
|
158
|
+
into?: Uint8ClampedArray;
|
|
159
|
+
region?: RasterRect;
|
|
160
|
+
}): Uint8ClampedArray;
|
|
161
|
+
/** Tile coordinates of coverage tile keys (for callers that track dirty tiles). */
|
|
162
|
+
declare function coverageTileCoord(key: TileKey): {
|
|
163
|
+
tx: number;
|
|
164
|
+
ty: number;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, type Dab, DabWalker, MAX_BRUSH_SIZE, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, coverageTileCoord, dabCoverage, dabRect, normalizeBrush, rasterizeDab, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CoverageMap,
|
|
3
|
+
DEFAULT_BRUSH,
|
|
4
|
+
DabWalker,
|
|
5
|
+
MAX_BRUSH_SIZE,
|
|
6
|
+
StrokeCoverage,
|
|
7
|
+
applyStrokeToTile,
|
|
8
|
+
coverageTileCoord,
|
|
9
|
+
dabCoverage,
|
|
10
|
+
dabRect,
|
|
11
|
+
normalizeBrush,
|
|
12
|
+
rasterizeDab,
|
|
13
|
+
smoothPoints,
|
|
14
|
+
tipFalloff,
|
|
15
|
+
tipReach,
|
|
16
|
+
tipShape,
|
|
17
|
+
walkDabs
|
|
18
|
+
} from "../chunk-YLB2WVNA.js";
|
|
19
|
+
import "../chunk-D4ZCU72J.js";
|
|
20
|
+
export {
|
|
21
|
+
CoverageMap,
|
|
22
|
+
DEFAULT_BRUSH,
|
|
23
|
+
DabWalker,
|
|
24
|
+
MAX_BRUSH_SIZE,
|
|
25
|
+
StrokeCoverage,
|
|
26
|
+
applyStrokeToTile,
|
|
27
|
+
coverageTileCoord,
|
|
28
|
+
dabCoverage,
|
|
29
|
+
dabRect,
|
|
30
|
+
normalizeBrush,
|
|
31
|
+
rasterizeDab,
|
|
32
|
+
smoothPoints,
|
|
33
|
+
tipFalloff,
|
|
34
|
+
tipReach,
|
|
35
|
+
tipShape,
|
|
36
|
+
walkDabs
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkH543GD6Tcjs = require('../chunk-H543GD6T.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var _chunkZOOEX3WTcjs = require('../chunk-ZOOEX3WT.cjs');
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
exports.BLEND_MODES = _chunkZOOEX3WTcjs.BLEND_MODES; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkH543GD6Tcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.RasterCompositor = _chunkH543GD6Tcjs.RasterCompositor; exports.SurfaceDraft = _chunkZOOEX3WTcjs.SurfaceDraft; exports.TILE = _chunkZOOEX3WTcjs.TILE; exports.TILE_SHIFT = _chunkZOOEX3WTcjs.TILE_SHIFT; exports.TiledSurface = _chunkZOOEX3WTcjs.TiledSurface; exports.ZlibError = _chunkH543GD6Tcjs.ZlibError; exports.adler32 = _chunkH543GD6Tcjs.adler32; exports.base64ToBytes = _chunkH543GD6Tcjs.base64ToBytes; exports.blendChannel = _chunkZOOEX3WTcjs.blendChannel; exports.blendImageData = _chunkZOOEX3WTcjs.blendImageData; exports.blendLum = _chunkZOOEX3WTcjs.blendLum; exports.blendPixel = _chunkZOOEX3WTcjs.blendPixel; exports.blendRgb = _chunkZOOEX3WTcjs.blendRgb; exports.blendTile = _chunkH543GD6Tcjs.blendTile; exports.bytesToBase64 = _chunkH543GD6Tcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkZOOEX3WTcjs.canvasCompositeOperation; exports.changedTiles = _chunkH543GD6Tcjs.changedTiles; exports.collectTiles = _chunkZOOEX3WTcjs.collectTiles; exports.contentBounds = _chunkZOOEX3WTcjs.contentBounds; exports.decodePng = _chunkH543GD6Tcjs.decodePng; exports.deflate = _chunkH543GD6Tcjs.deflate; exports.deflateRaw = _chunkH543GD6Tcjs.deflateRaw; exports.emptySurface = _chunkZOOEX3WTcjs.emptySurface; exports.encodePng = _chunkH543GD6Tcjs.encodePng; exports.fillRect = _chunkZOOEX3WTcjs.fillRect; exports.findLayer = _chunkH543GD6Tcjs.findLayer; exports.finishTile = _chunkZOOEX3WTcjs.finishTile; exports.flattenLayers = _chunkH543GD6Tcjs.flattenLayers; exports.gaussianBlur = _chunkH543GD6Tcjs.gaussianBlur; exports.inflate = _chunkH543GD6Tcjs.inflate; exports.inflateRaw = _chunkH543GD6Tcjs.inflateRaw; exports.insertLayer = _chunkH543GD6Tcjs.insertLayer; exports.isBlendMode = _chunkZOOEX3WTcjs.isBlendMode; exports.isLayerLocked = _chunkH543GD6Tcjs.isLayerLocked; exports.isPng = _chunkH543GD6Tcjs.isPng; exports.isSeparableBlendMode = _chunkZOOEX3WTcjs.isSeparableBlendMode; exports.mapLayer = _chunkH543GD6Tcjs.mapLayer; exports.normalizeBlendMode = _chunkZOOEX3WTcjs.normalizeBlendMode; exports.packRgba = _chunkZOOEX3WTcjs.packRgba; exports.parseDataUrl = _chunkH543GD6Tcjs.parseDataUrl; exports.pngDataUrl = _chunkH543GD6Tcjs.pngDataUrl; exports.readPixel = _chunkZOOEX3WTcjs.readPixel; exports.readRegion = _chunkZOOEX3WTcjs.readRegion; exports.setLum = _chunkZOOEX3WTcjs.setLum; exports.solidSurface = _chunkZOOEX3WTcjs.solidSurface; exports.surfaceBytes = _chunkZOOEX3WTcjs.surfaceBytes; exports.surfaceFromPixels = _chunkZOOEX3WTcjs.surfaceFromPixels; exports.surfacesEqual = _chunkZOOEX3WTcjs.surfacesEqual; exports.tileCoord = _chunkZOOEX3WTcjs.tileCoord; exports.tileKey = _chunkZOOEX3WTcjs.tileKey; exports.tileRect = _chunkZOOEX3WTcjs.tileRect; exports.tilesInRect = _chunkZOOEX3WTcjs.tilesInRect; exports.translateSurface = _chunkZOOEX3WTcjs.translateSurface; exports.uniformTile = _chunkZOOEX3WTcjs.uniformTile; exports.writeRegion = _chunkZOOEX3WTcjs.writeRegion;
|
|
121
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,k+FAAC","file":"/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"}
|