@pixerate/editor 0.94.0 → 0.95.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 +1 -0
- package/dist/{chunk-ZOOEX3WT.cjs → chunk-CRMAXIUV.cjs} +369 -7
- package/dist/chunk-CRMAXIUV.cjs.map +1 -0
- package/dist/{chunk-747CGOT2.js → chunk-E2ILRYTJ.js} +12 -2
- package/dist/chunk-E2ILRYTJ.js.map +1 -0
- package/dist/{chunk-D4ZCU72J.js → chunk-HEW6KDNI.js} +366 -4
- package/dist/chunk-HEW6KDNI.js.map +1 -0
- package/dist/{chunk-ISDCJHTO.js → chunk-IB53LVGV.js} +238 -285
- package/dist/chunk-IB53LVGV.js.map +1 -0
- package/dist/{chunk-73L6TROJ.cjs → chunk-T6H3JDGA.cjs} +54 -44
- package/dist/chunk-T6H3JDGA.cjs.map +1 -0
- package/dist/{chunk-4F3YDIWW.cjs → chunk-ZZOTHJ4K.cjs} +264 -311
- package/dist/chunk-ZZOTHJ4K.cjs.map +1 -0
- package/dist/image-editor/index.cjs +705 -501
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +86 -22
- package/dist/image-editor/index.d.ts +86 -22
- package/dist/image-editor/index.js +383 -179
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +22 -3
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +117 -2
- package/dist/paint/index.d.ts +117 -2
- package/dist/paint/index.js +32 -13
- package/dist/raster/index.cjs +7 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +4 -4
- package/dist/raster/index.d.ts +4 -4
- package/dist/raster/index.js +6 -2
- package/dist/{surface-CuBg2c6k.d.cts → surface-CgAiXVI3.d.cts} +23 -11
- package/dist/{surface-CuBg2c6k.d.ts → surface-CgAiXVI3.d.ts} +23 -11
- package/dist/{zlib-BJ6U7LuB.d.cts → zlib-B3LIoxF-.d.cts} +3 -2
- package/dist/{zlib-BjQkpMFi.d.ts → zlib-eiTEEj1z.d.ts} +3 -2
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +26 -2
- package/dist/chunk-4F3YDIWW.cjs.map +0 -1
- package/dist/chunk-73L6TROJ.cjs.map +0 -1
- package/dist/chunk-747CGOT2.js.map +0 -1
- package/dist/chunk-D4ZCU72J.js.map +0 -1
- package/dist/chunk-ISDCJHTO.js.map +0 -1
- package/dist/chunk-ZOOEX3WT.cjs.map +0 -1
package/dist/paint/index.cjs
CHANGED
|
@@ -25,10 +25,9 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
var _chunkZZOTHJ4Kcjs = require('../chunk-ZZOTHJ4K.cjs');
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
var _chunk4F3YDIWWcjs = require('../chunk-4F3YDIWW.cjs');
|
|
31
|
-
require('../chunk-ZOOEX3WT.cjs');
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
|
|
@@ -39,6 +38,7 @@ require('../chunk-ZOOEX3WT.cjs');
|
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
|
|
41
|
+
var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -58,5 +58,24 @@ require('../chunk-ZOOEX3WT.cjs');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
exports.CoverageMap = _chunkZZOTHJ4Kcjs.CoverageMap; exports.DEFAULT_BRUSH = _chunkZZOTHJ4Kcjs.DEFAULT_BRUSH; exports.DEFAULT_MIXER = _chunkZZOTHJ4Kcjs.DEFAULT_MIXER; exports.DabWalker = _chunkZZOTHJ4Kcjs.DabWalker; exports.EMPTY_MIXER_LOAD = _chunkZZOTHJ4Kcjs.EMPTY_MIXER_LOAD; exports.MAX_BRUSH_SIZE = _chunkZZOTHJ4Kcjs.MAX_BRUSH_SIZE; exports.MIXER_DRAIN = _chunkZZOTHJ4Kcjs.MIXER_DRAIN; exports.MIXER_PICKUP_RATE = _chunkZZOTHJ4Kcjs.MIXER_PICKUP_RATE; exports.MIXING_MODELS = _chunkZZOTHJ4Kcjs.MIXING_MODELS; exports.MixerStroke = _chunkZZOTHJ4Kcjs.MixerStroke; exports.PIGMENT_BANDS = _chunkCRMAXIUVcjs.PIGMENT_BANDS; exports.PIGMENT_LAMBDA_MIN = _chunkCRMAXIUVcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunkCRMAXIUVcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_WAVELENGTHS = _chunkCRMAXIUVcjs.PIGMENT_WAVELENGTHS; exports.StrokeCoverage = _chunkZZOTHJ4Kcjs.StrokeCoverage; exports.applyStrokeToTile = _chunkZZOTHJ4Kcjs.applyStrokeToTile; exports.cleanMixer = _chunkZZOTHJ4Kcjs.cleanMixer; exports.coverageTileCoord = _chunkZZOTHJ4Kcjs.coverageTileCoord; exports.createPigment = _chunkCRMAXIUVcjs.createPigment; exports.createPigmentTools = _chunkZZOTHJ4Kcjs.createPigmentTools; exports.dabCoverage = _chunkZZOTHJ4Kcjs.dabCoverage; exports.dabRect = _chunkZZOTHJ4Kcjs.dabRect; exports.lerpPigment = _chunkCRMAXIUVcjs.lerpPigment; exports.lerpPigmentInto = _chunkCRMAXIUVcjs.lerpPigmentInto; exports.loadMixer = _chunkZZOTHJ4Kcjs.loadMixer; exports.mixPigments = _chunkCRMAXIUVcjs.mixPigments; exports.normalizeBrush = _chunkZZOTHJ4Kcjs.normalizeBrush; exports.normalizeMixer = _chunkZZOTHJ4Kcjs.normalizeMixer; exports.rasterizeDab = _chunkZZOTHJ4Kcjs.rasterizeDab; exports.reflectanceToRgb = _chunkCRMAXIUVcjs.reflectanceToRgb; exports.rgbToReflectance = _chunkCRMAXIUVcjs.rgbToReflectance; exports.setPigmentColor = _chunkCRMAXIUVcjs.setPigmentColor; exports.smoothPoints = _chunkZZOTHJ4Kcjs.smoothPoints; exports.tipFalloff = _chunkZZOTHJ4Kcjs.tipFalloff; exports.tipReach = _chunkZZOTHJ4Kcjs.tipReach; exports.tipShape = _chunkZZOTHJ4Kcjs.tipShape; exports.walkDabs = _chunkZZOTHJ4Kcjs.walkDabs;
|
|
62
81
|
//# sourceMappingURL=index.cjs.map
|
package/dist/paint/index.cjs.map
CHANGED
|
@@ -1 +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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B
|
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;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;AACF,gkEAAC","file":"/home/runner/work/editor/editor/packages/core/dist/paint/index.cjs"}
|
package/dist/paint/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode, R as RasterRect, g as TileKey } from '../surface-
|
|
1
|
+
import { B as BlendMode, R as RasterRect, g as TileKey } from '../surface-CgAiXVI3.cjs';
|
|
2
2
|
import { A as AgentTool } from '../registry-BqA1AZt0.cjs';
|
|
3
3
|
import '../schema-Di0CS6Pe.cjs';
|
|
4
4
|
|
|
@@ -166,6 +166,121 @@ declare function coverageTileCoord(key: TileKey): {
|
|
|
166
166
|
ty: number;
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* The Mixer Brush: a reservoir of loaded paint plus a pickup well that takes up colour from the
|
|
171
|
+
* canvas under each dab (photocraft's behavioural model):
|
|
172
|
+
*
|
|
173
|
+
* - Each dab samples the canvas under its footprint (coverage- and alpha-weighted). The pickup
|
|
174
|
+
* colour `P` moves towards that sample by `PICKUP_RATE × wet` (scaled by the sample's coverage).
|
|
175
|
+
* - The dab's paint mixes the reservoir `R` (weight `amount × (1 − mix·wet)`) with the pickup
|
|
176
|
+
* (weight `mix·wet`) and lands at `flow × opacity` times the total weight, over the pixels as
|
|
177
|
+
* they are now, so earlier dabs of the same stroke are picked up again (smearing).
|
|
178
|
+
* - The reservoir drains per dab unless `load` is 1, so low-load strokes run dry. A dry brush
|
|
179
|
+
* (`wet` 0) paints only reservoir colour; an empty, wet brush smears canvas colour.
|
|
180
|
+
*
|
|
181
|
+
* `mixing: 'pigment'` does all three mixes (pickup, paint and deposit) with the Kubelka-Munk model
|
|
182
|
+
* of `./pigment`, so a blue brush dragged through yellow makes green instead of grey. Everything
|
|
183
|
+
* is data in, pixels out: the same canvas, points, settings and load replay identically.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/** How the Mixer Brush mixes colours: straight sRGB averages, or like paint (Kubelka-Munk). */
|
|
187
|
+
type MixingModel = 'rgb' | 'pigment';
|
|
188
|
+
declare const MIXING_MODELS: readonly MixingModel[];
|
|
189
|
+
/** Mixer Brush options. */
|
|
190
|
+
interface MixerSettings {
|
|
191
|
+
/** How much colour the brush picks up from the canvas, 0 (dry) .. 1 (default 0.5). */
|
|
192
|
+
wet: number;
|
|
193
|
+
/** How much paint the reservoir holds, 0 .. 1 (default 0.5): below 1 it drains per dab and the stroke runs dry. */
|
|
194
|
+
load: number;
|
|
195
|
+
/** How far each dab's paint moves from the reservoir towards the picked-up colour, 0 .. 1 (default 0.5). */
|
|
196
|
+
mix: number;
|
|
197
|
+
/** Refill the reservoir with the paint colour at the start of each stroke (default true). */
|
|
198
|
+
loadEachStroke: boolean;
|
|
199
|
+
/** Empty the pickup well after each stroke (default true); off keeps the brush dirty for the next stroke. */
|
|
200
|
+
cleanEachStroke: boolean;
|
|
201
|
+
/** `rgb` (default) or `pigment` (blue and yellow make green). */
|
|
202
|
+
mixing: MixingModel;
|
|
203
|
+
}
|
|
204
|
+
declare const DEFAULT_MIXER: Readonly<MixerSettings>;
|
|
205
|
+
/** Fraction of the way the pickup colour moves towards the canvas per dab at 100 % wet. */
|
|
206
|
+
declare const MIXER_PICKUP_RATE = 0.25;
|
|
207
|
+
/** Fraction of the reservoir that drains per dab at 0 % load. */
|
|
208
|
+
declare const MIXER_DRAIN = 0.08;
|
|
209
|
+
/** Mixer settings with every field in range (missing fields from `DEFAULT_MIXER`). */
|
|
210
|
+
declare function normalizeMixer(raw?: Partial<MixerSettings>): MixerSettings;
|
|
211
|
+
/** What the brush carries between strokes. Colours are straight sRGB, 0..1. */
|
|
212
|
+
interface MixerLoad {
|
|
213
|
+
/** Loaded paint, or `null` when the brush is unloaded. */
|
|
214
|
+
readonly reservoir: readonly [number, number, number] | null;
|
|
215
|
+
/** Reservoir left, 0..1. */
|
|
216
|
+
readonly amount: number;
|
|
217
|
+
/** Colour picked up from the canvas, or `null` when the brush is clean. */
|
|
218
|
+
readonly pickup: readonly [number, number, number] | null;
|
|
219
|
+
}
|
|
220
|
+
declare const EMPTY_MIXER_LOAD: MixerLoad;
|
|
221
|
+
/** The brush loaded full with `color` (sRGB 0..1); the pickup well is kept. */
|
|
222
|
+
declare function loadMixer(load: MixerLoad, color: readonly [number, number, number]): MixerLoad;
|
|
223
|
+
/** The brush with its pickup well emptied; the reservoir is kept. */
|
|
224
|
+
declare function cleanMixer(load: MixerLoad): MixerLoad;
|
|
225
|
+
/** The pixels a mixer stroke reads and writes (RGBA tiles in layer space). */
|
|
226
|
+
interface MixerTarget {
|
|
227
|
+
/** The tile (TILE × TILE × 4) at (tx, ty) as it is now, or `null` when it is fully transparent. */
|
|
228
|
+
readTile(tx: number, ty: number): Uint8ClampedArray | null;
|
|
229
|
+
/** A writable tile at (tx, ty), returned by `readTile` from then on. */
|
|
230
|
+
writeTile(tx: number, ty: number): Uint8ClampedArray;
|
|
231
|
+
/** Layer offset: layer pixel = document pixel − offset. */
|
|
232
|
+
offset: {
|
|
233
|
+
x: number;
|
|
234
|
+
y: number;
|
|
235
|
+
};
|
|
236
|
+
/** Keep alpha and paint only where the layer has pixels. */
|
|
237
|
+
lockTransparency: boolean;
|
|
238
|
+
/** Selection coverage (document space, canvas-sized), or `null`. */
|
|
239
|
+
selection: {
|
|
240
|
+
width: number;
|
|
241
|
+
height: number;
|
|
242
|
+
data: ArrayLike<number>;
|
|
243
|
+
} | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* One Mixer Brush stroke. Feed points with `push` (any chunks give the same dabs), end with
|
|
247
|
+
* `finish`; `load` is the brush load after the dabs so far. Each call returns the document
|
|
248
|
+
* rectangles it touched.
|
|
249
|
+
*/
|
|
250
|
+
declare class MixerStroke {
|
|
251
|
+
readonly brush: BrushSettings;
|
|
252
|
+
private readonly target;
|
|
253
|
+
dabCount: number;
|
|
254
|
+
bounds: RasterRect | null;
|
|
255
|
+
private walker;
|
|
256
|
+
private smoothPos;
|
|
257
|
+
private buf;
|
|
258
|
+
private readonly settings;
|
|
259
|
+
private readonly reservoir;
|
|
260
|
+
private amount;
|
|
261
|
+
private pickup;
|
|
262
|
+
private readonly pig;
|
|
263
|
+
private readonly out;
|
|
264
|
+
constructor(brush: BrushSettings, settings: Partial<MixerSettings>, load: MixerLoad, target: MixerTarget);
|
|
265
|
+
/** The brush load after the dabs so far. */
|
|
266
|
+
get load(): MixerLoad;
|
|
267
|
+
push(points: readonly StrokePoint[]): RasterRect[];
|
|
268
|
+
finish(last?: StrokePoint): RasterRect[];
|
|
269
|
+
private smooth;
|
|
270
|
+
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
271
|
+
private mix;
|
|
272
|
+
private paint;
|
|
273
|
+
private tx;
|
|
274
|
+
private ty;
|
|
275
|
+
private tile;
|
|
276
|
+
private writable;
|
|
277
|
+
/** Index of document pixel (dx, dy) in `this.tile`, or -1 when reading an empty tile. */
|
|
278
|
+
private locate;
|
|
279
|
+
private dab;
|
|
280
|
+
/** Lays `paint` over the pixels under the dab at `dep` × coverage (× selection). */
|
|
281
|
+
private deposit;
|
|
282
|
+
}
|
|
283
|
+
|
|
169
284
|
/**
|
|
170
285
|
* Pigment-like colour mixing: blue and yellow make green, red and white make pink, as paint does.
|
|
171
286
|
*
|
|
@@ -258,4 +373,4 @@ declare function lerpPigmentInto(a: Pigment, b: Pigment, t: number, out: {
|
|
|
258
373
|
*/
|
|
259
374
|
declare function createPigmentTools(): AgentTool[];
|
|
260
375
|
|
|
261
|
-
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, type Dab, DabWalker, MAX_BRUSH_SIZE, PIGMENT_BANDS, PIGMENT_LAMBDA_MIN, PIGMENT_LAMBDA_STEP, PIGMENT_WAVELENGTHS, type Pigment, type PigmentOptions, type PigmentRgb, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, coverageTileCoord, createPigment, createPigmentTools, dabCoverage, dabRect, lerpPigment, lerpPigmentInto, mixPigments, normalizeBrush, rasterizeDab, reflectanceToRgb, rgbToReflectance, setPigmentColor, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
|
376
|
+
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, DEFAULT_MIXER, type Dab, DabWalker, EMPTY_MIXER_LOAD, MAX_BRUSH_SIZE, MIXER_DRAIN, MIXER_PICKUP_RATE, MIXING_MODELS, type MixerLoad, type MixerSettings, MixerStroke, type MixerTarget, type MixingModel, PIGMENT_BANDS, PIGMENT_LAMBDA_MIN, PIGMENT_LAMBDA_STEP, PIGMENT_WAVELENGTHS, type Pigment, type PigmentOptions, type PigmentRgb, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, cleanMixer, coverageTileCoord, createPigment, createPigmentTools, dabCoverage, dabRect, lerpPigment, lerpPigmentInto, loadMixer, mixPigments, normalizeBrush, normalizeMixer, rasterizeDab, reflectanceToRgb, rgbToReflectance, setPigmentColor, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
package/dist/paint/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode, R as RasterRect, g as TileKey } from '../surface-
|
|
1
|
+
import { B as BlendMode, R as RasterRect, g as TileKey } from '../surface-CgAiXVI3.js';
|
|
2
2
|
import { A as AgentTool } from '../registry-D-4fit9C.js';
|
|
3
3
|
import '../schema-Di0CS6Pe.js';
|
|
4
4
|
|
|
@@ -166,6 +166,121 @@ declare function coverageTileCoord(key: TileKey): {
|
|
|
166
166
|
ty: number;
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* The Mixer Brush: a reservoir of loaded paint plus a pickup well that takes up colour from the
|
|
171
|
+
* canvas under each dab (photocraft's behavioural model):
|
|
172
|
+
*
|
|
173
|
+
* - Each dab samples the canvas under its footprint (coverage- and alpha-weighted). The pickup
|
|
174
|
+
* colour `P` moves towards that sample by `PICKUP_RATE × wet` (scaled by the sample's coverage).
|
|
175
|
+
* - The dab's paint mixes the reservoir `R` (weight `amount × (1 − mix·wet)`) with the pickup
|
|
176
|
+
* (weight `mix·wet`) and lands at `flow × opacity` times the total weight, over the pixels as
|
|
177
|
+
* they are now, so earlier dabs of the same stroke are picked up again (smearing).
|
|
178
|
+
* - The reservoir drains per dab unless `load` is 1, so low-load strokes run dry. A dry brush
|
|
179
|
+
* (`wet` 0) paints only reservoir colour; an empty, wet brush smears canvas colour.
|
|
180
|
+
*
|
|
181
|
+
* `mixing: 'pigment'` does all three mixes (pickup, paint and deposit) with the Kubelka-Munk model
|
|
182
|
+
* of `./pigment`, so a blue brush dragged through yellow makes green instead of grey. Everything
|
|
183
|
+
* is data in, pixels out: the same canvas, points, settings and load replay identically.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/** How the Mixer Brush mixes colours: straight sRGB averages, or like paint (Kubelka-Munk). */
|
|
187
|
+
type MixingModel = 'rgb' | 'pigment';
|
|
188
|
+
declare const MIXING_MODELS: readonly MixingModel[];
|
|
189
|
+
/** Mixer Brush options. */
|
|
190
|
+
interface MixerSettings {
|
|
191
|
+
/** How much colour the brush picks up from the canvas, 0 (dry) .. 1 (default 0.5). */
|
|
192
|
+
wet: number;
|
|
193
|
+
/** How much paint the reservoir holds, 0 .. 1 (default 0.5): below 1 it drains per dab and the stroke runs dry. */
|
|
194
|
+
load: number;
|
|
195
|
+
/** How far each dab's paint moves from the reservoir towards the picked-up colour, 0 .. 1 (default 0.5). */
|
|
196
|
+
mix: number;
|
|
197
|
+
/** Refill the reservoir with the paint colour at the start of each stroke (default true). */
|
|
198
|
+
loadEachStroke: boolean;
|
|
199
|
+
/** Empty the pickup well after each stroke (default true); off keeps the brush dirty for the next stroke. */
|
|
200
|
+
cleanEachStroke: boolean;
|
|
201
|
+
/** `rgb` (default) or `pigment` (blue and yellow make green). */
|
|
202
|
+
mixing: MixingModel;
|
|
203
|
+
}
|
|
204
|
+
declare const DEFAULT_MIXER: Readonly<MixerSettings>;
|
|
205
|
+
/** Fraction of the way the pickup colour moves towards the canvas per dab at 100 % wet. */
|
|
206
|
+
declare const MIXER_PICKUP_RATE = 0.25;
|
|
207
|
+
/** Fraction of the reservoir that drains per dab at 0 % load. */
|
|
208
|
+
declare const MIXER_DRAIN = 0.08;
|
|
209
|
+
/** Mixer settings with every field in range (missing fields from `DEFAULT_MIXER`). */
|
|
210
|
+
declare function normalizeMixer(raw?: Partial<MixerSettings>): MixerSettings;
|
|
211
|
+
/** What the brush carries between strokes. Colours are straight sRGB, 0..1. */
|
|
212
|
+
interface MixerLoad {
|
|
213
|
+
/** Loaded paint, or `null` when the brush is unloaded. */
|
|
214
|
+
readonly reservoir: readonly [number, number, number] | null;
|
|
215
|
+
/** Reservoir left, 0..1. */
|
|
216
|
+
readonly amount: number;
|
|
217
|
+
/** Colour picked up from the canvas, or `null` when the brush is clean. */
|
|
218
|
+
readonly pickup: readonly [number, number, number] | null;
|
|
219
|
+
}
|
|
220
|
+
declare const EMPTY_MIXER_LOAD: MixerLoad;
|
|
221
|
+
/** The brush loaded full with `color` (sRGB 0..1); the pickup well is kept. */
|
|
222
|
+
declare function loadMixer(load: MixerLoad, color: readonly [number, number, number]): MixerLoad;
|
|
223
|
+
/** The brush with its pickup well emptied; the reservoir is kept. */
|
|
224
|
+
declare function cleanMixer(load: MixerLoad): MixerLoad;
|
|
225
|
+
/** The pixels a mixer stroke reads and writes (RGBA tiles in layer space). */
|
|
226
|
+
interface MixerTarget {
|
|
227
|
+
/** The tile (TILE × TILE × 4) at (tx, ty) as it is now, or `null` when it is fully transparent. */
|
|
228
|
+
readTile(tx: number, ty: number): Uint8ClampedArray | null;
|
|
229
|
+
/** A writable tile at (tx, ty), returned by `readTile` from then on. */
|
|
230
|
+
writeTile(tx: number, ty: number): Uint8ClampedArray;
|
|
231
|
+
/** Layer offset: layer pixel = document pixel − offset. */
|
|
232
|
+
offset: {
|
|
233
|
+
x: number;
|
|
234
|
+
y: number;
|
|
235
|
+
};
|
|
236
|
+
/** Keep alpha and paint only where the layer has pixels. */
|
|
237
|
+
lockTransparency: boolean;
|
|
238
|
+
/** Selection coverage (document space, canvas-sized), or `null`. */
|
|
239
|
+
selection: {
|
|
240
|
+
width: number;
|
|
241
|
+
height: number;
|
|
242
|
+
data: ArrayLike<number>;
|
|
243
|
+
} | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* One Mixer Brush stroke. Feed points with `push` (any chunks give the same dabs), end with
|
|
247
|
+
* `finish`; `load` is the brush load after the dabs so far. Each call returns the document
|
|
248
|
+
* rectangles it touched.
|
|
249
|
+
*/
|
|
250
|
+
declare class MixerStroke {
|
|
251
|
+
readonly brush: BrushSettings;
|
|
252
|
+
private readonly target;
|
|
253
|
+
dabCount: number;
|
|
254
|
+
bounds: RasterRect | null;
|
|
255
|
+
private walker;
|
|
256
|
+
private smoothPos;
|
|
257
|
+
private buf;
|
|
258
|
+
private readonly settings;
|
|
259
|
+
private readonly reservoir;
|
|
260
|
+
private amount;
|
|
261
|
+
private pickup;
|
|
262
|
+
private readonly pig;
|
|
263
|
+
private readonly out;
|
|
264
|
+
constructor(brush: BrushSettings, settings: Partial<MixerSettings>, load: MixerLoad, target: MixerTarget);
|
|
265
|
+
/** The brush load after the dabs so far. */
|
|
266
|
+
get load(): MixerLoad;
|
|
267
|
+
push(points: readonly StrokePoint[]): RasterRect[];
|
|
268
|
+
finish(last?: StrokePoint): RasterRect[];
|
|
269
|
+
private smooth;
|
|
270
|
+
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
271
|
+
private mix;
|
|
272
|
+
private paint;
|
|
273
|
+
private tx;
|
|
274
|
+
private ty;
|
|
275
|
+
private tile;
|
|
276
|
+
private writable;
|
|
277
|
+
/** Index of document pixel (dx, dy) in `this.tile`, or -1 when reading an empty tile. */
|
|
278
|
+
private locate;
|
|
279
|
+
private dab;
|
|
280
|
+
/** Lays `paint` over the pixels under the dab at `dep` × coverage (× selection). */
|
|
281
|
+
private deposit;
|
|
282
|
+
}
|
|
283
|
+
|
|
169
284
|
/**
|
|
170
285
|
* Pigment-like colour mixing: blue and yellow make green, red and white make pink, as paint does.
|
|
171
286
|
*
|
|
@@ -258,4 +373,4 @@ declare function lerpPigmentInto(a: Pigment, b: Pigment, t: number, out: {
|
|
|
258
373
|
*/
|
|
259
374
|
declare function createPigmentTools(): AgentTool[];
|
|
260
375
|
|
|
261
|
-
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, type Dab, DabWalker, MAX_BRUSH_SIZE, PIGMENT_BANDS, PIGMENT_LAMBDA_MIN, PIGMENT_LAMBDA_STEP, PIGMENT_WAVELENGTHS, type Pigment, type PigmentOptions, type PigmentRgb, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, coverageTileCoord, createPigment, createPigmentTools, dabCoverage, dabRect, lerpPigment, lerpPigmentInto, mixPigments, normalizeBrush, rasterizeDab, reflectanceToRgb, rgbToReflectance, setPigmentColor, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
|
376
|
+
export { type BrushSettings, CoverageMap, DEFAULT_BRUSH, DEFAULT_MIXER, type Dab, DabWalker, EMPTY_MIXER_LOAD, MAX_BRUSH_SIZE, MIXER_DRAIN, MIXER_PICKUP_RATE, MIXING_MODELS, type MixerLoad, type MixerSettings, MixerStroke, type MixerTarget, type MixingModel, PIGMENT_BANDS, PIGMENT_LAMBDA_MIN, PIGMENT_LAMBDA_STEP, PIGMENT_WAVELENGTHS, type Pigment, type PigmentOptions, type PigmentRgb, type StrokeApply, StrokeCoverage, type StrokePoint, applyStrokeToTile, cleanMixer, coverageTileCoord, createPigment, createPigmentTools, dabCoverage, dabRect, lerpPigment, lerpPigmentInto, loadMixer, mixPigments, normalizeBrush, normalizeMixer, rasterizeDab, reflectanceToRgb, rgbToReflectance, setPigmentColor, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs };
|
package/dist/paint/index.js
CHANGED
|
@@ -1,45 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CoverageMap,
|
|
3
3
|
DEFAULT_BRUSH,
|
|
4
|
+
DEFAULT_MIXER,
|
|
4
5
|
DabWalker,
|
|
6
|
+
EMPTY_MIXER_LOAD,
|
|
5
7
|
MAX_BRUSH_SIZE,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
MIXER_DRAIN,
|
|
9
|
+
MIXER_PICKUP_RATE,
|
|
10
|
+
MIXING_MODELS,
|
|
11
|
+
MixerStroke,
|
|
10
12
|
StrokeCoverage,
|
|
11
13
|
applyStrokeToTile,
|
|
14
|
+
cleanMixer,
|
|
12
15
|
coverageTileCoord,
|
|
13
|
-
createPigment,
|
|
14
16
|
createPigmentTools,
|
|
15
17
|
dabCoverage,
|
|
16
18
|
dabRect,
|
|
17
|
-
|
|
18
|
-
lerpPigmentInto,
|
|
19
|
-
mixPigments,
|
|
19
|
+
loadMixer,
|
|
20
20
|
normalizeBrush,
|
|
21
|
+
normalizeMixer,
|
|
21
22
|
rasterizeDab,
|
|
22
|
-
reflectanceToRgb,
|
|
23
|
-
rgbToReflectance,
|
|
24
|
-
setPigmentColor,
|
|
25
23
|
smoothPoints,
|
|
26
24
|
tipFalloff,
|
|
27
25
|
tipReach,
|
|
28
26
|
tipShape,
|
|
29
27
|
walkDabs
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import
|
|
28
|
+
} from "../chunk-IB53LVGV.js";
|
|
29
|
+
import {
|
|
30
|
+
PIGMENT_BANDS,
|
|
31
|
+
PIGMENT_LAMBDA_MIN,
|
|
32
|
+
PIGMENT_LAMBDA_STEP,
|
|
33
|
+
PIGMENT_WAVELENGTHS,
|
|
34
|
+
createPigment,
|
|
35
|
+
lerpPigment,
|
|
36
|
+
lerpPigmentInto,
|
|
37
|
+
mixPigments,
|
|
38
|
+
reflectanceToRgb,
|
|
39
|
+
rgbToReflectance,
|
|
40
|
+
setPigmentColor
|
|
41
|
+
} from "../chunk-HEW6KDNI.js";
|
|
32
42
|
export {
|
|
33
43
|
CoverageMap,
|
|
34
44
|
DEFAULT_BRUSH,
|
|
45
|
+
DEFAULT_MIXER,
|
|
35
46
|
DabWalker,
|
|
47
|
+
EMPTY_MIXER_LOAD,
|
|
36
48
|
MAX_BRUSH_SIZE,
|
|
49
|
+
MIXER_DRAIN,
|
|
50
|
+
MIXER_PICKUP_RATE,
|
|
51
|
+
MIXING_MODELS,
|
|
52
|
+
MixerStroke,
|
|
37
53
|
PIGMENT_BANDS,
|
|
38
54
|
PIGMENT_LAMBDA_MIN,
|
|
39
55
|
PIGMENT_LAMBDA_STEP,
|
|
40
56
|
PIGMENT_WAVELENGTHS,
|
|
41
57
|
StrokeCoverage,
|
|
42
58
|
applyStrokeToTile,
|
|
59
|
+
cleanMixer,
|
|
43
60
|
coverageTileCoord,
|
|
44
61
|
createPigment,
|
|
45
62
|
createPigmentTools,
|
|
@@ -47,8 +64,10 @@ export {
|
|
|
47
64
|
dabRect,
|
|
48
65
|
lerpPigment,
|
|
49
66
|
lerpPigmentInto,
|
|
67
|
+
loadMixer,
|
|
50
68
|
mixPigments,
|
|
51
69
|
normalizeBrush,
|
|
70
|
+
normalizeMixer,
|
|
52
71
|
rasterizeDab,
|
|
53
72
|
reflectanceToRgb,
|
|
54
73
|
rgbToReflectance,
|
package/dist/raster/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkT6H3JDGAcjs = require('../chunk-T6H3JDGA.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -96,9 +96,9 @@ var _chunk73L6TROJcjs = require('../chunk-73L6TROJ.cjs');
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
var _chunkZOOEX3WTcjs = require('../chunk-ZOOEX3WT.cjs');
|
|
100
99
|
|
|
101
100
|
|
|
101
|
+
var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
|
|
@@ -193,5 +193,9 @@ var _chunkZOOEX3WTcjs = require('../chunk-ZOOEX3WT.cjs');
|
|
|
193
193
|
|
|
194
194
|
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkT6H3JDGAcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkT6H3JDGAcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkT6H3JDGAcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.LAYER_EFFECT_KINDS = _chunkT6H3JDGAcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkT6H3JDGAcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkT6H3JDGAcjs.MAX_EFFECT_REACH; exports.PatternPlacement = _chunkT6H3JDGAcjs.PatternPlacement; exports.PatternTile = _chunkT6H3JDGAcjs.PatternTile; exports.RasterCompositor = _chunkT6H3JDGAcjs.RasterCompositor; exports.STROKE_CHAMFER_MAX = _chunkT6H3JDGAcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunkCRMAXIUVcjs.SurfaceDraft; exports.TILE = _chunkCRMAXIUVcjs.TILE; exports.TILE_SHIFT = _chunkCRMAXIUVcjs.TILE_SHIFT; exports.TiledSurface = _chunkCRMAXIUVcjs.TiledSurface; exports.ZlibError = _chunkT6H3JDGAcjs.ZlibError; exports.activeEffectItems = _chunkT6H3JDGAcjs.activeEffectItems; exports.adler32 = _chunkT6H3JDGAcjs.adler32; exports.base64ToBytes = _chunkT6H3JDGAcjs.base64ToBytes; exports.blendChannel = _chunkCRMAXIUVcjs.blendChannel; exports.blendImageData = _chunkCRMAXIUVcjs.blendImageData; exports.blendLum = _chunkCRMAXIUVcjs.blendLum; exports.blendPixel = _chunkCRMAXIUVcjs.blendPixel; exports.blendRgb = _chunkCRMAXIUVcjs.blendRgb; exports.blendTile = _chunkT6H3JDGAcjs.blendTile; exports.buildEffectMaps = _chunkT6H3JDGAcjs.buildEffectMaps; exports.builtinPattern = _chunkT6H3JDGAcjs.builtinPattern; exports.builtinPatternIds = _chunkT6H3JDGAcjs.builtinPatternIds; exports.bytesToBase64 = _chunkT6H3JDGAcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkCRMAXIUVcjs.canvasCompositeOperation; exports.changedTiles = _chunkT6H3JDGAcjs.changedTiles; exports.collectTiles = _chunkCRMAXIUVcjs.collectTiles; exports.compositeLayerEffects = _chunkT6H3JDGAcjs.compositeLayerEffects; exports.contentBounds = _chunkCRMAXIUVcjs.contentBounds; exports.contourLut = _chunkT6H3JDGAcjs.contourLut; exports.curveLut = _chunkT6H3JDGAcjs.curveLut; exports.decodePng = _chunkT6H3JDGAcjs.decodePng; exports.defaultEffectGradient = _chunkT6H3JDGAcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkT6H3JDGAcjs.defaultLayerEffect; exports.deflate = _chunkT6H3JDGAcjs.deflate; exports.deflateRaw = _chunkT6H3JDGAcjs.deflateRaw; exports.effectColorHex = _chunkT6H3JDGAcjs.effectColorHex; exports.effectReach = _chunkT6H3JDGAcjs.effectReach; exports.effectsAreLocal = _chunkT6H3JDGAcjs.effectsAreLocal; exports.effectsFingerprint = _chunkT6H3JDGAcjs.effectsFingerprint; exports.effectsMargin = _chunkT6H3JDGAcjs.effectsMargin; exports.effectsScale = _chunkT6H3JDGAcjs.effectsScale; exports.emptySurface = _chunkCRMAXIUVcjs.emptySurface; exports.encodePng = _chunkT6H3JDGAcjs.encodePng; exports.fillRect = _chunkCRMAXIUVcjs.fillRect; exports.findLayer = _chunkT6H3JDGAcjs.findLayer; exports.finishTile = _chunkCRMAXIUVcjs.finishTile; exports.flattenLayers = _chunkT6H3JDGAcjs.flattenLayers; exports.gaussianBlur = _chunkT6H3JDGAcjs.gaussianBlur; exports.gradientT = _chunkT6H3JDGAcjs.gradientT; exports.hasActiveEffects = _chunkT6H3JDGAcjs.hasActiveEffects; exports.hashNoise = _chunkT6H3JDGAcjs.hashNoise; exports.inflate = _chunkT6H3JDGAcjs.inflate; exports.inflateRaw = _chunkT6H3JDGAcjs.inflateRaw; exports.insertLayer = _chunkT6H3JDGAcjs.insertLayer; exports.isBlendMode = _chunkCRMAXIUVcjs.isBlendMode; exports.isLayerEffectKind = _chunkT6H3JDGAcjs.isLayerEffectKind; exports.isLayerLocked = _chunkT6H3JDGAcjs.isLayerLocked; exports.isPng = _chunkT6H3JDGAcjs.isPng; exports.isSeparableBlendMode = _chunkCRMAXIUVcjs.isSeparableBlendMode; exports.layerEffectFields = _chunkT6H3JDGAcjs.layerEffectFields; exports.layerEffectLabel = _chunkT6H3JDGAcjs.layerEffectLabel; exports.mapLayer = _chunkT6H3JDGAcjs.mapLayer; exports.mergeLayerEffect = _chunkT6H3JDGAcjs.mergeLayerEffect; exports.mixPigment8 = _chunkCRMAXIUVcjs.mixPigment8; exports.mixPigmentRgb = _chunkCRMAXIUVcjs.mixPigmentRgb; exports.newEffectId = _chunkT6H3JDGAcjs.newEffectId; exports.normalizeBlendMode = _chunkCRMAXIUVcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkT6H3JDGAcjs.normalizeLayerEffects; exports.packRgba = _chunkCRMAXIUVcjs.packRgba; exports.parseDataUrl = _chunkT6H3JDGAcjs.parseDataUrl; exports.parseEffectColor = _chunkT6H3JDGAcjs.parseEffectColor; exports.pngDataUrl = _chunkT6H3JDGAcjs.pngDataUrl; exports.readPixel = _chunkCRMAXIUVcjs.readPixel; exports.readRegion = _chunkCRMAXIUVcjs.readRegion; exports.renderLayerEffects = _chunkT6H3JDGAcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkT6H3JDGAcjs.scaleLayerEffect; exports.setLum = _chunkCRMAXIUVcjs.setLum; exports.solidSurface = _chunkCRMAXIUVcjs.solidSurface; exports.surfaceBytes = _chunkCRMAXIUVcjs.surfaceBytes; exports.surfaceFromPixels = _chunkCRMAXIUVcjs.surfaceFromPixels; exports.surfacesEqual = _chunkCRMAXIUVcjs.surfacesEqual; exports.tileCoord = _chunkCRMAXIUVcjs.tileCoord; exports.tileKey = _chunkCRMAXIUVcjs.tileKey; exports.tileRect = _chunkCRMAXIUVcjs.tileRect; exports.tilesInRect = _chunkCRMAXIUVcjs.tilesInRect; exports.translateSurface = _chunkCRMAXIUVcjs.translateSurface; exports.uniformTile = _chunkCRMAXIUVcjs.uniformTile; exports.validateEffectGradient = _chunkT6H3JDGAcjs.validateEffectGradient; exports.validateLayerEffect = _chunkT6H3JDGAcjs.validateLayerEffect; exports.validateLayerEffects = _chunkT6H3JDGAcjs.validateLayerEffects; exports.writeRegion = _chunkCRMAXIUVcjs.writeRegion;
|
|
197
201
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +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;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,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;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,
|
|
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;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,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;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;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,k5KAAC","file":"/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"}
|
package/dist/raster/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BlendMode } from '../surface-
|
|
2
|
-
export { a as BLEND_MODES, b as BlendModeInfo, M as MaskSurface, P as PixelSurface, R as RasterRect, c as Rgb, d as Rgba, S as SurfaceDraft, T as TILE, e as TILE_SHIFT, f as Tile, g as TileKey, h as TiledSurface, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as
|
|
3
|
-
import { L as LayerEffect, G as GlobalLight, P as PatternTile, a as LayerEffects, E as EffectContour, b as GradientStyle } from '../zlib-
|
|
4
|
-
export { B as BevelContour, c as BevelEmbossEffect, d as BevelStyle, e as BevelTechnique, f as BevelTexture, g as BlurEdge, C as CURVE_LUT_SIZE, h as ColorOverlayEffect, i as CompositeCallOptions, j as CompositeStats, k as CompositorLayer, l as CompositorOptions, m as CompositorProfile, n as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, o as DIRECT_GAUSSIAN_MAX_SIGMA, p as DecodedPng, q as DropShadowEffect, r as EffectFill, s as EffectGradient, t as EffectPattern, u as EffectPatternRef, v as GlowTechnique, w as GradientColorStop, x as GradientOpacityStop, y as GradientOverlayEffect, z as GroupBlendMode, A as GroupIn, I as InnerGlowEffect, F as InnerShadowEffect, H as LAYER_EFFECT_KINDS, J as LayerEffectError, K as LayerEffectKind, M as LayerLocation, N as LayerLocks, O as MAX_EFFECT_REACH, Q as OuterGlowEffect, R as PatternOverlayEffect, S as PatternPlacement, T as PixelFilterSpec, U as RasterCompositor, V as RasterGroupLayer, W as RasterLayer, X as RasterLayerBase, Y as RasterMask, Z as RasterNode, _ as RasterPixelLayer, $ as RasterSources, a0 as SatinEffect, a1 as StrokeEffect, a2 as StrokePosition, a3 as ZlibError, a4 as adler32, a5 as base64ToBytes, a6 as blendTile, a7 as builtinPattern, a8 as builtinPatternIds, a9 as bytesToBase64, aa as changedTiles, ab as curveLut, ac as decodePng, ad as defaultEffectGradient, ae as defaultLayerEffect, af as deflate, ag as deflateRaw, ah as effectColorHex, ai as effectReach, aj as effectsFingerprint, ak as effectsMargin, al as effectsScale, am as encodePng, an as findLayer, ao as flattenLayers, ap as gaussianBlur, aq as hasActiveEffects, ar as hashNoise, as as inflate, at as inflateRaw, au as insertLayer, av as isLayerEffectKind, aw as isLayerLocked, ax as isPng, ay as layerEffectFields, az as layerEffectLabel, aA as mapLayer, aB as mergeLayerEffect, aC as newEffectId, aD as normalizeLayerEffects, aE as parseDataUrl, aF as parseEffectColor, aG as pngDataUrl, aH as scaleLayerEffect, aI as validateEffectGradient, aJ as validateLayerEffect, aK as validateLayerEffects } from '../zlib-
|
|
1
|
+
import { B as BlendMode } from '../surface-CgAiXVI3.cjs';
|
|
2
|
+
export { a as BLEND_MODES, b as BlendModeInfo, M as MaskSurface, P as PixelSurface, R as RasterRect, c as Rgb, d as Rgba, S as SurfaceDraft, T as TILE, e as TILE_SHIFT, f as Tile, g as TileKey, h as TiledSurface, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as mixPigment8, w as mixPigmentRgb, x as normalizeBlendMode, y as packRgba, z as readPixel, A as readRegion, C as setLum, D as solidSurface, E as surfaceBytes, F as surfaceFromPixels, G as surfacesEqual, H as tileCoord, I as tileKey, J as tileRect, K as tilesInRect, L as translateSurface, N as uniformTile, O as writeRegion } from '../surface-CgAiXVI3.cjs';
|
|
3
|
+
import { L as LayerEffect, G as GlobalLight, P as PatternTile, a as LayerEffects, E as EffectContour, b as GradientStyle } from '../zlib-B3LIoxF-.cjs';
|
|
4
|
+
export { B as BevelContour, c as BevelEmbossEffect, d as BevelStyle, e as BevelTechnique, f as BevelTexture, g as BlurEdge, C as CURVE_LUT_SIZE, h as ColorOverlayEffect, i as CompositeCallOptions, j as CompositeStats, k as CompositorLayer, l as CompositorOptions, m as CompositorProfile, n as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, o as DIRECT_GAUSSIAN_MAX_SIGMA, p as DecodedPng, q as DropShadowEffect, r as EffectFill, s as EffectGradient, t as EffectPattern, u as EffectPatternRef, v as GlowTechnique, w as GradientColorStop, x as GradientOpacityStop, y as GradientOverlayEffect, z as GroupBlendMode, A as GroupIn, I as InnerGlowEffect, F as InnerShadowEffect, H as LAYER_EFFECT_KINDS, J as LayerEffectError, K as LayerEffectKind, M as LayerLocation, N as LayerLocks, O as MAX_EFFECT_REACH, Q as OuterGlowEffect, R as PatternOverlayEffect, S as PatternPlacement, T as PixelFilterSpec, U as RasterCompositor, V as RasterGroupLayer, W as RasterLayer, X as RasterLayerBase, Y as RasterMask, Z as RasterNode, _ as RasterPixelLayer, $ as RasterSources, a0 as SatinEffect, a1 as StrokeEffect, a2 as StrokePosition, a3 as ZlibError, a4 as adler32, a5 as base64ToBytes, a6 as blendTile, a7 as builtinPattern, a8 as builtinPatternIds, a9 as bytesToBase64, aa as changedTiles, ab as curveLut, ac as decodePng, ad as defaultEffectGradient, ae as defaultLayerEffect, af as deflate, ag as deflateRaw, ah as effectColorHex, ai as effectReach, aj as effectsFingerprint, ak as effectsMargin, al as effectsScale, am as encodePng, an as findLayer, ao as flattenLayers, ap as gaussianBlur, aq as hasActiveEffects, ar as hashNoise, as as inflate, at as inflateRaw, au as insertLayer, av as isLayerEffectKind, aw as isLayerLocked, ax as isPng, ay as layerEffectFields, az as layerEffectLabel, aA as mapLayer, aB as mergeLayerEffect, aC as newEffectId, aD as normalizeLayerEffects, aE as parseDataUrl, aF as parseEffectColor, aG as pngDataUrl, aH as scaleLayerEffect, aI as validateEffectGradient, aJ as validateLayerEffect, aK as validateLayerEffects } from '../zlib-B3LIoxF-.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* CPU renderer for layer effects.
|
package/dist/raster/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BlendMode } from '../surface-
|
|
2
|
-
export { a as BLEND_MODES, b as BlendModeInfo, M as MaskSurface, P as PixelSurface, R as RasterRect, c as Rgb, d as Rgba, S as SurfaceDraft, T as TILE, e as TILE_SHIFT, f as Tile, g as TileKey, h as TiledSurface, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as
|
|
3
|
-
import { L as LayerEffect, G as GlobalLight, P as PatternTile, a as LayerEffects, E as EffectContour, b as GradientStyle } from '../zlib-
|
|
4
|
-
export { B as BevelContour, c as BevelEmbossEffect, d as BevelStyle, e as BevelTechnique, f as BevelTexture, g as BlurEdge, C as CURVE_LUT_SIZE, h as ColorOverlayEffect, i as CompositeCallOptions, j as CompositeStats, k as CompositorLayer, l as CompositorOptions, m as CompositorProfile, n as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, o as DIRECT_GAUSSIAN_MAX_SIGMA, p as DecodedPng, q as DropShadowEffect, r as EffectFill, s as EffectGradient, t as EffectPattern, u as EffectPatternRef, v as GlowTechnique, w as GradientColorStop, x as GradientOpacityStop, y as GradientOverlayEffect, z as GroupBlendMode, A as GroupIn, I as InnerGlowEffect, F as InnerShadowEffect, H as LAYER_EFFECT_KINDS, J as LayerEffectError, K as LayerEffectKind, M as LayerLocation, N as LayerLocks, O as MAX_EFFECT_REACH, Q as OuterGlowEffect, R as PatternOverlayEffect, S as PatternPlacement, T as PixelFilterSpec, U as RasterCompositor, V as RasterGroupLayer, W as RasterLayer, X as RasterLayerBase, Y as RasterMask, Z as RasterNode, _ as RasterPixelLayer, $ as RasterSources, a0 as SatinEffect, a1 as StrokeEffect, a2 as StrokePosition, a3 as ZlibError, a4 as adler32, a5 as base64ToBytes, a6 as blendTile, a7 as builtinPattern, a8 as builtinPatternIds, a9 as bytesToBase64, aa as changedTiles, ab as curveLut, ac as decodePng, ad as defaultEffectGradient, ae as defaultLayerEffect, af as deflate, ag as deflateRaw, ah as effectColorHex, ai as effectReach, aj as effectsFingerprint, ak as effectsMargin, al as effectsScale, am as encodePng, an as findLayer, ao as flattenLayers, ap as gaussianBlur, aq as hasActiveEffects, ar as hashNoise, as as inflate, at as inflateRaw, au as insertLayer, av as isLayerEffectKind, aw as isLayerLocked, ax as isPng, ay as layerEffectFields, az as layerEffectLabel, aA as mapLayer, aB as mergeLayerEffect, aC as newEffectId, aD as normalizeLayerEffects, aE as parseDataUrl, aF as parseEffectColor, aG as pngDataUrl, aH as scaleLayerEffect, aI as validateEffectGradient, aJ as validateLayerEffect, aK as validateLayerEffects } from '../zlib-
|
|
1
|
+
import { B as BlendMode } from '../surface-CgAiXVI3.js';
|
|
2
|
+
export { a as BLEND_MODES, b as BlendModeInfo, M as MaskSurface, P as PixelSurface, R as RasterRect, c as Rgb, d as Rgba, S as SurfaceDraft, T as TILE, e as TILE_SHIFT, f as Tile, g as TileKey, h as TiledSurface, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as mixPigment8, w as mixPigmentRgb, x as normalizeBlendMode, y as packRgba, z as readPixel, A as readRegion, C as setLum, D as solidSurface, E as surfaceBytes, F as surfaceFromPixels, G as surfacesEqual, H as tileCoord, I as tileKey, J as tileRect, K as tilesInRect, L as translateSurface, N as uniformTile, O as writeRegion } from '../surface-CgAiXVI3.js';
|
|
3
|
+
import { L as LayerEffect, G as GlobalLight, P as PatternTile, a as LayerEffects, E as EffectContour, b as GradientStyle } from '../zlib-eiTEEj1z.js';
|
|
4
|
+
export { B as BevelContour, c as BevelEmbossEffect, d as BevelStyle, e as BevelTechnique, f as BevelTexture, g as BlurEdge, C as CURVE_LUT_SIZE, h as ColorOverlayEffect, i as CompositeCallOptions, j as CompositeStats, k as CompositorLayer, l as CompositorOptions, m as CompositorProfile, n as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, o as DIRECT_GAUSSIAN_MAX_SIGMA, p as DecodedPng, q as DropShadowEffect, r as EffectFill, s as EffectGradient, t as EffectPattern, u as EffectPatternRef, v as GlowTechnique, w as GradientColorStop, x as GradientOpacityStop, y as GradientOverlayEffect, z as GroupBlendMode, A as GroupIn, I as InnerGlowEffect, F as InnerShadowEffect, H as LAYER_EFFECT_KINDS, J as LayerEffectError, K as LayerEffectKind, M as LayerLocation, N as LayerLocks, O as MAX_EFFECT_REACH, Q as OuterGlowEffect, R as PatternOverlayEffect, S as PatternPlacement, T as PixelFilterSpec, U as RasterCompositor, V as RasterGroupLayer, W as RasterLayer, X as RasterLayerBase, Y as RasterMask, Z as RasterNode, _ as RasterPixelLayer, $ as RasterSources, a0 as SatinEffect, a1 as StrokeEffect, a2 as StrokePosition, a3 as ZlibError, a4 as adler32, a5 as base64ToBytes, a6 as blendTile, a7 as builtinPattern, a8 as builtinPatternIds, a9 as bytesToBase64, aa as changedTiles, ab as curveLut, ac as decodePng, ad as defaultEffectGradient, ae as defaultLayerEffect, af as deflate, ag as deflateRaw, ah as effectColorHex, ai as effectReach, aj as effectsFingerprint, ak as effectsMargin, al as effectsScale, am as encodePng, an as findLayer, ao as flattenLayers, ap as gaussianBlur, aq as hasActiveEffects, ar as hashNoise, as as inflate, at as inflateRaw, au as insertLayer, av as isLayerEffectKind, aw as isLayerLocked, ax as isPng, ay as layerEffectFields, az as layerEffectLabel, aA as mapLayer, aB as mergeLayerEffect, aC as newEffectId, aD as normalizeLayerEffects, aE as parseDataUrl, aF as parseEffectColor, aG as pngDataUrl, aH as scaleLayerEffect, aI as validateEffectGradient, aJ as validateLayerEffect, aK as validateLayerEffects } from '../zlib-eiTEEj1z.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* CPU renderer for layer effects.
|
package/dist/raster/index.js
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
validateEffectGradient,
|
|
61
61
|
validateLayerEffect,
|
|
62
62
|
validateLayerEffects
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-E2ILRYTJ.js";
|
|
64
64
|
import {
|
|
65
65
|
BLEND_MODES,
|
|
66
66
|
SurfaceDraft,
|
|
@@ -80,6 +80,8 @@ import {
|
|
|
80
80
|
finishTile,
|
|
81
81
|
isBlendMode,
|
|
82
82
|
isSeparableBlendMode,
|
|
83
|
+
mixPigment8,
|
|
84
|
+
mixPigmentRgb,
|
|
83
85
|
normalizeBlendMode,
|
|
84
86
|
packRgba,
|
|
85
87
|
readPixel,
|
|
@@ -96,7 +98,7 @@ import {
|
|
|
96
98
|
translateSurface,
|
|
97
99
|
uniformTile,
|
|
98
100
|
writeRegion
|
|
99
|
-
} from "../chunk-
|
|
101
|
+
} from "../chunk-HEW6KDNI.js";
|
|
100
102
|
export {
|
|
101
103
|
BLEND_MODES,
|
|
102
104
|
CURVE_LUT_SIZE,
|
|
@@ -167,6 +169,8 @@ export {
|
|
|
167
169
|
layerEffectLabel,
|
|
168
170
|
mapLayer,
|
|
169
171
|
mergeLayerEffect,
|
|
172
|
+
mixPigment8,
|
|
173
|
+
mixPigmentRgb,
|
|
170
174
|
newEffectId,
|
|
171
175
|
normalizeBlendMode,
|
|
172
176
|
normalizeLayerEffects,
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Photoshop blend modes on straight (non-premultiplied) 0..1 colours.
|
|
3
|
-
*
|
|
4
|
-
* Formulas follow the W3C Compositing / ISO 32000 definitions, with Photoshop's variants where
|
|
5
|
-
* they differ (Soft Light, Vivid / Linear / Pin Light, Hard Mix, Linear Burn / Dodge, Subtract,
|
|
6
|
-
* Divide, Darker / Lighter Color), and the hardened `ClipColor` for the non-separable modes.
|
|
7
|
-
*/
|
|
8
|
-
type BlendMode = 'normal' | 'darken' | 'multiply' | 'color-burn' | 'linear-burn' | 'darker-color' | 'lighten' | 'screen' | 'color-dodge' | 'linear-dodge' | 'lighter-color' | 'overlay' | 'soft-light' | 'hard-light' | 'vivid-light' | 'linear-light' | 'pin-light' | 'hard-mix' | 'difference' | 'exclusion' | 'subtract' | 'divide' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
1
|
+
type BlendMode = 'normal' | 'darken' | 'multiply' | 'color-burn' | 'linear-burn' | 'darker-color' | 'lighten' | 'screen' | 'color-dodge' | 'linear-dodge' | 'lighter-color' | 'overlay' | 'soft-light' | 'hard-light' | 'vivid-light' | 'linear-light' | 'pin-light' | 'hard-mix' | 'difference' | 'exclusion' | 'subtract' | 'divide' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'pigment';
|
|
9
2
|
interface BlendModeInfo {
|
|
10
3
|
id: BlendMode;
|
|
11
4
|
label: string;
|
|
@@ -22,7 +15,10 @@ declare function normalizeBlendMode(value: unknown): BlendMode;
|
|
|
22
15
|
* none (draw through {@link blendImageData} instead).
|
|
23
16
|
*/
|
|
24
17
|
declare function canvasCompositeOperation(mode: BlendMode | undefined): GlobalCompositeOperation | null;
|
|
25
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Whether a mode works channel by channel. The non-separable ones work on whole colours (hue,
|
|
20
|
+
* saturation, colour, luminosity, darker / lighter colour, pigment).
|
|
21
|
+
*/
|
|
26
22
|
declare function isSeparableBlendMode(mode: BlendMode): boolean;
|
|
27
23
|
/** Separable blend function `B(cb, cs)` of one channel. Non-separable modes return `cs`. */
|
|
28
24
|
declare function blendChannel(mode: BlendMode, cb: number, cs: number): number;
|
|
@@ -32,12 +28,28 @@ type Rgba = [number, number, number, number];
|
|
|
32
28
|
declare function blendLum(c: readonly number[]): number;
|
|
33
29
|
/** `c` with its luminosity moved to `l`, clipped back into gamut towards grey (SetLum + ClipColor). */
|
|
34
30
|
declare function setLum(c: readonly number[], l: number): Rgb;
|
|
35
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* `B(Cb, Cs)` of a whole colour, including the non-separable modes. `pigment` has no `B` and
|
|
33
|
+
* returns `Cs`; composite it with {@link blendPixel} or {@link mixPigmentRgb}.
|
|
34
|
+
*/
|
|
36
35
|
declare function blendRgb(mode: BlendMode, cb: readonly number[], cs: readonly number[]): Rgb;
|
|
36
|
+
/**
|
|
37
|
+
* The `pigment` mode's colour: `t` of `cs` mixed into `cb` like paint (`lerpPigment`), written to
|
|
38
|
+
* `out[0..2]`. `t ≥ 1` (or equal colours) is `cs` exactly. Colours are 0..1.
|
|
39
|
+
*/
|
|
40
|
+
declare function mixPigmentRgb(cb: readonly number[], cs: readonly number[], t: number, out?: number[]): number[];
|
|
41
|
+
/**
|
|
42
|
+
* {@link mixPigmentRgb} on 8-bit channels, with each colour's spectrum cached: writes the 0..1
|
|
43
|
+
* result to `out[0..2]`. The compositor's and {@link blendImageData}'s per-pixel path.
|
|
44
|
+
*/
|
|
45
|
+
declare function mixPigment8(b0: number, b1: number, b2: number, s0: number, s1: number, s2: number, t: number, out: number[]): void;
|
|
37
46
|
/**
|
|
38
47
|
* Composites a straight-alpha `source` over a straight-alpha `backdrop` (both RGBA in 0..1) with a
|
|
39
48
|
* blend mode and an extra `alpha` (opacity), using the W3C general formula:
|
|
40
49
|
* `αo = αs + αb(1 − αs)`, `αo·Co = (1 − αs)·αb·Cb + (1 − αb)·αs·Cs + αs·αb·B(Cb, Cs)`.
|
|
50
|
+
*
|
|
51
|
+
* `pigment` mixes the colours like paint instead, by amount: `Co = lerpPigment(Cb, Cs, αs / αo)`
|
|
52
|
+
* (over an opaque backdrop that is `lerpPigment(Cb, Cs, αs)`), with the same `αo`.
|
|
41
53
|
*/
|
|
42
54
|
declare function blendPixel(mode: BlendMode, backdrop: readonly number[], source: readonly number[], alpha?: number): Rgba;
|
|
43
55
|
/**
|
|
@@ -178,4 +190,4 @@ declare function collectTiles(surface: TiledSurface, into: Set<Tile>): void;
|
|
|
178
190
|
/** True when two surfaces hold the same pixels (cheap when they share tiles). */
|
|
179
191
|
declare function surfacesEqual(a: TiledSurface, b: TiledSurface): boolean;
|
|
180
192
|
|
|
181
|
-
export {
|
|
193
|
+
export { readRegion as A, type BlendMode as B, setLum as C, solidSurface as D, surfaceBytes as E, surfaceFromPixels as F, surfacesEqual as G, tileCoord as H, tileKey as I, tileRect as J, tilesInRect as K, translateSurface as L, type MaskSurface as M, uniformTile as N, writeRegion as O, type PixelSurface as P, type RasterRect as R, SurfaceDraft as S, TILE as T, BLEND_MODES as a, type BlendModeInfo as b, type Rgb as c, type Rgba as d, TILE_SHIFT as e, type Tile as f, type TileKey as g, TiledSurface as h, blendChannel as i, blendImageData as j, blendLum as k, blendPixel as l, blendRgb as m, canvasCompositeOperation as n, collectTiles as o, contentBounds as p, emptySurface as q, fillRect as r, finishTile as s, isBlendMode as t, isSeparableBlendMode as u, mixPigment8 as v, mixPigmentRgb as w, normalizeBlendMode as x, packRgba as y, readPixel as z };
|