@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.
Files changed (41) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -0
  2. package/dist/{chunk-ZOOEX3WT.cjs → chunk-CRMAXIUV.cjs} +369 -7
  3. package/dist/chunk-CRMAXIUV.cjs.map +1 -0
  4. package/dist/{chunk-747CGOT2.js → chunk-E2ILRYTJ.js} +12 -2
  5. package/dist/chunk-E2ILRYTJ.js.map +1 -0
  6. package/dist/{chunk-D4ZCU72J.js → chunk-HEW6KDNI.js} +366 -4
  7. package/dist/chunk-HEW6KDNI.js.map +1 -0
  8. package/dist/{chunk-ISDCJHTO.js → chunk-IB53LVGV.js} +238 -285
  9. package/dist/chunk-IB53LVGV.js.map +1 -0
  10. package/dist/{chunk-73L6TROJ.cjs → chunk-T6H3JDGA.cjs} +54 -44
  11. package/dist/chunk-T6H3JDGA.cjs.map +1 -0
  12. package/dist/{chunk-4F3YDIWW.cjs → chunk-ZZOTHJ4K.cjs} +264 -311
  13. package/dist/chunk-ZZOTHJ4K.cjs.map +1 -0
  14. package/dist/image-editor/index.cjs +705 -501
  15. package/dist/image-editor/index.cjs.map +1 -1
  16. package/dist/image-editor/index.d.cts +86 -22
  17. package/dist/image-editor/index.d.ts +86 -22
  18. package/dist/image-editor/index.js +383 -179
  19. package/dist/image-editor/index.js.map +1 -1
  20. package/dist/paint/index.cjs +22 -3
  21. package/dist/paint/index.cjs.map +1 -1
  22. package/dist/paint/index.d.cts +117 -2
  23. package/dist/paint/index.d.ts +117 -2
  24. package/dist/paint/index.js +32 -13
  25. package/dist/raster/index.cjs +7 -3
  26. package/dist/raster/index.cjs.map +1 -1
  27. package/dist/raster/index.d.cts +4 -4
  28. package/dist/raster/index.d.ts +4 -4
  29. package/dist/raster/index.js +6 -2
  30. package/dist/{surface-CuBg2c6k.d.cts → surface-CgAiXVI3.d.cts} +23 -11
  31. package/dist/{surface-CuBg2c6k.d.ts → surface-CgAiXVI3.d.ts} +23 -11
  32. package/dist/{zlib-BJ6U7LuB.d.cts → zlib-B3LIoxF-.d.cts} +3 -2
  33. package/dist/{zlib-BjQkpMFi.d.ts → zlib-eiTEEj1z.d.ts} +3 -2
  34. package/package.json +1 -1
  35. package/skills/pixerate-image-editor/SKILL.md +26 -2
  36. package/dist/chunk-4F3YDIWW.cjs.map +0 -1
  37. package/dist/chunk-73L6TROJ.cjs.map +0 -1
  38. package/dist/chunk-747CGOT2.js.map +0 -1
  39. package/dist/chunk-D4ZCU72J.js.map +0 -1
  40. package/dist/chunk-ISDCJHTO.js.map +0 -1
  41. package/dist/chunk-ZOOEX3WT.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/paint/brush.ts","../src/paint/mixer.ts","../src/paint/pigment-tools.ts"],"sourcesContent":["// Portions ported from photocraft/crates/paint/src/lib.rs, dynamics.rs and render.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/**\n * The brush engine (a subset of photocraft's `crates/paint`): a computed round tip with size,\n * hardness, angle, roundness and spacing; pressure to size and opacity; smoothing; and Photoshop's\n * opacity-versus-flow build-up. Strokes are data, so one replays the same way for undo, agents\n * and tests.\n *\n * - Points are walked into dabs at `spacing × diameter` (`walkDabs`).\n * - Each dab's coverage (`dabCoverage`, photocraft's measured Photoshop profile) builds up in a\n * stroke coverage map with flow towards the dab's opacity ceiling: `c ← c + v·(ceil − c)`.\n * - The stroke composites once at the stroke opacity over the layer as it was before the stroke,\n * so overlapping dabs never exceed the opacity.\n */\n\nimport { blendPixel, mixPigment8, type BlendMode } from '../raster/blend';\nimport type { RasterRect as CropBox } from '../raster/surface';\nimport { TILE, tileKey, tileCoord, type TileKey } from '../raster/surface';\n\n/** One input sample. Missing pressure is a mouse (1). */\nexport interface StrokePoint {\n x: number;\n y: number;\n /** 0..1 (default 1). */\n pressure?: number;\n /** Milliseconds (optional; kept for replays). */\n t?: number;\n}\n\nexport interface BrushSettings {\n /** Diameter in pixels (1..2500, default 20). */\n size: number;\n /** 0 (soft) .. 1 (hard, default). */\n hardness: number;\n /** Dab spacing as a fraction of the diameter (0.01..10, default 0.1). */\n spacing: number;\n /** Tip angle in degrees (default 0). */\n angle: number;\n /** Tip roundness 0.01..1 (default 1). */\n roundness: number;\n /** Stroke opacity ceiling 0..1 (default 1). */\n opacity: number;\n /** Build-up per dab 0..1 (default 1). */\n flow: number;\n /** Input smoothing 0..0.95 (default 0). */\n smoothing: number;\n /** Pressure controls size (default true). */\n pressureSize: boolean;\n /** Pressure controls opacity (default false). */\n pressureOpacity: boolean;\n /** How the stroke paints onto the layer (default normal). */\n blend: BlendMode;\n}\n\nexport const DEFAULT_BRUSH: Readonly<BrushSettings> = {\n size: 20,\n hardness: 1,\n spacing: 0.1,\n angle: 0,\n roundness: 1,\n opacity: 1,\n flow: 1,\n smoothing: 0,\n pressureSize: true,\n pressureOpacity: false,\n blend: 'normal',\n};\n\nexport const MAX_BRUSH_SIZE = 2500;\n\n/** A brush with every field in range (missing fields from `DEFAULT_BRUSH`). */\nexport function normalizeBrush(raw: Partial<BrushSettings> = {}): BrushSettings {\n const num = (v: unknown, lo: number, hi: number, d: number) => (typeof v === 'number' && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : d);\n return {\n size: num(raw.size, 1, MAX_BRUSH_SIZE, DEFAULT_BRUSH.size),\n hardness: num(raw.hardness, 0, 1, DEFAULT_BRUSH.hardness),\n spacing: num(raw.spacing, 0.01, 10, DEFAULT_BRUSH.spacing),\n angle: num(raw.angle, -360, 360, DEFAULT_BRUSH.angle),\n roundness: num(raw.roundness, 0.01, 1, DEFAULT_BRUSH.roundness),\n opacity: num(raw.opacity, 0, 1, DEFAULT_BRUSH.opacity),\n flow: num(raw.flow, 0, 1, DEFAULT_BRUSH.flow),\n smoothing: num(raw.smoothing, 0, 0.95, DEFAULT_BRUSH.smoothing),\n pressureSize: typeof raw.pressureSize === 'boolean' ? raw.pressureSize : DEFAULT_BRUSH.pressureSize,\n pressureOpacity: typeof raw.pressureOpacity === 'boolean' ? raw.pressureOpacity : DEFAULT_BRUSH.pressureOpacity,\n blend: raw.blend ?? 'normal',\n };\n}\n\n// ---------------------------------------------------------------------------\n// The round tip (photocraft's measured Photoshop profile)\n// ---------------------------------------------------------------------------\n\n/**\n * Photoshop's round tip, measured by photocraft: a solid core of radius `r0 · R`, then a Gaussian\n * shoulder `exp(-((d − r0) / s)²)` of width `s · R`, both by hardness (0, 0.1, … 1).\n */\nconst TIP_SHAPE: ReadonlyArray<[number, number]> = [\n [0.0, 0.664], [0.14, 0.58], [0.28, 0.5], [0.4, 0.44], [0.52, 0.36], [0.63, 0.29],\n [0.7, 0.24], [0.78, 0.19], [0.84, 0.15], [0.89, 0.11], [1.0, 0.0],\n];\n/** The anti-aliased edge: the shoulder never narrows below this many pixels. */\nconst TIP_EDGE_PX = 1.2;\nconst SMALL_TIP_RADIUS = 3;\nconst SUBPIXEL = [-0.375, -0.125, 0.125, 0.375];\n\n/** The core radius and shoulder width (pixels) of a round tip of `radius` and `hardness`. */\nexport function tipShape(radius: number, hardness: number): [number, number] {\n const h = (Number.isNaN(hardness) ? 0 : Math.min(1, Math.max(0, hardness))) * 10;\n const i = Math.min(9, Math.floor(h));\n const t = h - i;\n const a = TIP_SHAPE[i];\n const b = TIP_SHAPE[i + 1];\n const r0 = a[0] + (b[0] - a[0]) * t;\n const s = a[1] + (b[1] - a[1]) * t;\n const r = Number.isFinite(radius) ? Math.max(0, radius) : 0;\n const edge = Math.max(0.25, Math.min(TIP_EDGE_PX, 0.3 * r));\n return [Math.max(0, Math.min(r0 * r, r - edge)), Math.max(1e-3, s * r, edge)];\n}\n\n/** `exp(-u)` as `(1 − u/64)^64` by six squarings: exactly 0 from u = 64. */\nfunction softExp(u: number): number {\n let g = Math.min(1, Math.max(0, 1 - u / 64));\n for (let k = 0; k < 6; k++) g *= g;\n return g;\n}\n\n/** Opacity of a round tip at distance `d` from its centre. */\nexport function tipFalloff(d: number, radius: number, hardness: number): number {\n const [r0, s] = tipShape(radius, hardness);\n if (d <= r0) return 1;\n const x = (d - r0) / s;\n return softExp(x * x);\n}\n\n/** How far from its centre a round tip still paints. */\nexport function tipReach(radius: number, hardness: number): number {\n const [r0, s] = tipShape(radius, hardness);\n return r0 + 2.6 * s;\n}\n\n/** Coverage of a round dab at distance `d` from its centre. */\nexport function dabCoverage(d: number, radius: number, hardness: number): number {\n if (Number.isNaN(d) || d >= tipReach(radius, hardness) + 0.5) return 0;\n return tipFalloff(d, radius, hardness);\n}\n\n// ---------------------------------------------------------------------------\n// Points → dabs\n// ---------------------------------------------------------------------------\n\nexport interface Dab {\n x: number;\n y: number;\n radius: number;\n /** Flow (per-dab build-up). */\n alpha: number;\n /** Opacity ceiling this dab builds up to. */\n opacity: number;\n /** Radians. */\n angle: number;\n roundness: number;\n}\n\n/** Exponential smoothing of input points; the first and last point are kept. */\nexport function smoothPoints(points: readonly StrokePoint[], amount: number): StrokePoint[] {\n const a = 1 - Math.min(0.95, Math.max(0, amount));\n if (a >= 1 || points.length < 3) return points.slice();\n const out: StrokePoint[] = [];\n let cur: StrokePoint | null = null;\n for (const p of points) {\n const n: StrokePoint = cur ? { ...p, x: cur.x + (p.x - cur.x) * a, y: cur.y + (p.y - cur.y) * a } : p;\n out.push(n);\n cur = n;\n }\n out[out.length - 1] = points[points.length - 1];\n return out;\n}\n\nconst pressureOf = (p: StrokePoint) => (typeof p.pressure === 'number' && Number.isFinite(p.pressure) ? Math.min(1, Math.max(0, p.pressure)) : 1);\n\n/**\n * Walks points into dabs (incrementally: feed points in any chunks and get the same dabs). The\n * first point is a dab; then one every `spacing × diameter` along the path.\n */\nexport class DabWalker {\n private last: StrokePoint | null = null;\n private nextAt = 0;\n private pendingFirst: StrokePoint | null = null;\n\n constructor(readonly brush: BrushSettings) {}\n\n private diameter(p: StrokePoint): number {\n return this.brush.pressureSize ? this.brush.size * pressureOf(p) : this.brush.size;\n }\n\n private stepLen(p: StrokePoint): number {\n return Math.max(0.5, Math.max(1, this.diameter(p)) * Math.max(0.01, this.brush.spacing));\n }\n\n private dab(p: StrokePoint): Dab {\n const b = this.brush;\n return {\n x: p.x,\n y: p.y,\n radius: Math.max(0.5, this.diameter(p) / 2),\n alpha: Math.min(1, Math.max(0, b.flow)),\n opacity: b.pressureOpacity ? pressureOf(p) : 1,\n angle: (b.angle * Math.PI) / 180,\n roundness: Math.min(1, Math.max(0.01, b.roundness)),\n };\n }\n\n push(p: StrokePoint, out: Dab[]): void {\n const a = this.last;\n if (!a) {\n this.last = p;\n this.pendingFirst = p;\n this.nextAt = this.stepLen(p);\n return;\n }\n if (this.pendingFirst) {\n out.push(this.dab(this.pendingFirst));\n this.pendingFirst = null;\n }\n const dx = p.x - a.x;\n const dy = p.y - a.y;\n const len = Math.hypot(dx, dy);\n if (len > 1e-9) {\n while (this.nextAt <= len + 1e-9) {\n const f = Math.min(1, this.nextAt / len);\n const q: StrokePoint = {\n x: a.x + dx * f,\n y: a.y + dy * f,\n pressure: pressureOf(a) + (pressureOf(p) - pressureOf(a)) * f,\n };\n out.push(this.dab(q));\n this.nextAt += this.stepLen(q);\n }\n this.nextAt -= len;\n }\n this.last = p;\n }\n\n finish(out: Dab[]): void {\n if (this.pendingFirst) {\n out.push(this.dab(this.pendingFirst));\n this.pendingFirst = null;\n }\n }\n}\n\n/** All dabs of a point list (smoothing applied). */\nexport function walkDabs(points: readonly StrokePoint[], brush: BrushSettings): Dab[] {\n const w = new DabWalker(brush);\n const out: Dab[] = [];\n for (const p of smoothPoints(points, brush.smoothing)) w.push(p, out);\n w.finish(out);\n return out;\n}\n\n/** The pixel rectangle a dab can touch. */\nexport function dabRect(d: Dab, hardness: number): CropBox {\n // As `rasterizeDab`: the tip reaches `reach` across its minor axis and `reach / roundness` along it.\n const ro = Math.min(1, Math.max(0.5 / d.radius, d.roundness));\n const rm = Math.max(0.5, d.radius * ro);\n const r = Math.max(rm, tipReach(rm, hardness)) / ro + 1.5;\n const x0 = Math.floor(d.x - r);\n const y0 = Math.floor(d.y - r);\n return { x: x0, y: y0, width: Math.ceil(d.x + r) - x0, height: Math.ceil(d.y + r) - y0 };\n}\n\n/**\n * Rasterizes one dab over `rect` into `out` (rect.width × rect.height values, coverage × flow).\n * Small tips (radius below 3 px) take each pixel's covered area from a 4×4 grid.\n */\nexport function rasterizeDab(d: Dab, hardness: number, rect: CropBox, out: Float32Array): void {\n const w = rect.width;\n const h = rect.height;\n out.fill(0, 0, w * h);\n const r = d.radius;\n const ro = Math.min(1, Math.max(0.5 / r, d.roundness));\n const rm = Math.max(0.5, r * ro);\n const reach = Math.max(rm, tipReach(rm, hardness));\n const sn = Math.sin(d.angle);\n const cs = Math.cos(d.angle);\n const toTip = (dx: number, dy: number): [number, number] => {\n const ux = dx;\n const uy = -dy;\n return [ux * cs + uy * sn, -ux * sn + uy * cs];\n };\n const small = rm < SMALL_TIP_RADIUS;\n const reach2 = (reach + (small ? 0.75 : 0.5)) ** 2;\n for (let yy = 0; yy < h; yy++) {\n const dy = rect.y + yy + 0.5 - d.y;\n for (let xx = 0; xx < w; xx++) {\n const dx = rect.x + xx + 0.5 - d.x;\n const [u, v] = toTip(dx, dy);\n const d2 = (u * ro) ** 2 + v * v;\n if (d2 >= reach2) continue;\n let val: number;\n if (small) {\n let sum = 0;\n for (const sy of SUBPIXEL) {\n for (const sx of SUBPIXEL) {\n const [su, sv] = toTip(dx + sx, dy + sy);\n sum += tipFalloff(Math.sqrt((su * ro) ** 2 + sv * sv), rm, hardness);\n }\n }\n val = sum / 16;\n } else {\n val = dabCoverage(Math.sqrt(d2), rm, hardness);\n }\n if (val > 0) out[yy * w + xx] = val * d.alpha;\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Stroke coverage\n// ---------------------------------------------------------------------------\n\nconst TILE_PIXELS = TILE * TILE;\n\n/** A stroke's accumulated coverage, in 256 px tiles over document space. */\nexport class CoverageMap {\n readonly tiles = new Map<TileKey, Float32Array>();\n bounds: CropBox | null = null;\n private dirty = new Set<TileKey>();\n\n get(x: number, y: number): number {\n const tx = Math.floor(x / TILE);\n const ty = Math.floor(y / TILE);\n const t = this.tiles.get(tileKey(tx, ty));\n return t ? t[(y - ty * TILE) * TILE + (x - tx * TILE)] : 0;\n }\n\n /** Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. */\n accumulate(rect: CropBox, vals: Float32Array, ceil: number): void {\n if (rect.width <= 0 || rect.height <= 0) return;\n const w = rect.width;\n const tx0 = Math.floor(rect.x / TILE);\n const ty0 = Math.floor(rect.y / TILE);\n const tx1 = Math.floor((rect.x + rect.width - 1) / TILE);\n const ty1 = Math.floor((rect.y + rect.height - 1) / TILE);\n let touched = false;\n for (let ty = ty0; ty <= ty1; ty++) {\n for (let tx = tx0; tx <= tx1; tx++) {\n const x0 = Math.max(rect.x, tx * TILE);\n const y0 = Math.max(rect.y, ty * TILE);\n const x1 = Math.min(rect.x + rect.width, tx * TILE + TILE);\n const y1 = Math.min(rect.y + rect.height, ty * TILE + TILE);\n let tile: Float32Array | undefined;\n for (let y = y0; y < y1; y++) {\n const row = (y - rect.y) * w;\n const trow = (y - ty * TILE) * TILE;\n for (let x = x0; x < x1; x++) {\n const v = vals[row + (x - rect.x)];\n if (v <= 0) continue;\n if (!tile) {\n const key = tileKey(tx, ty);\n tile = this.tiles.get(key);\n if (!tile) {\n tile = new Float32Array(TILE_PIXELS);\n this.tiles.set(key, tile);\n }\n this.dirty.add(key);\n touched = true;\n }\n const ti = trow + (x - tx * TILE);\n const c = tile[ti];\n if (ceil > c) tile[ti] = c + v * (ceil - c);\n }\n }\n }\n }\n if (touched) this.bounds = unionRect(this.bounds, rect);\n }\n\n /** Tiles changed since the last call. */\n takeDirty(): TileKey[] {\n const out = [...this.dirty];\n this.dirty.clear();\n return out;\n }\n}\n\nfunction unionRect(a: CropBox | null, b: CropBox): CropBox {\n if (!a) return { ...b };\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };\n}\n\n/** Paints a stroke's dabs into a coverage map, incrementally. */\nexport class StrokeCoverage {\n readonly coverage = new CoverageMap();\n private walker: DabWalker;\n private smoothing: number;\n private smoothPos: StrokePoint | null = null;\n private buf = new Float32Array(0);\n dabCount = 0;\n\n constructor(readonly brush: BrushSettings) {\n this.walker = new DabWalker(brush);\n this.smoothing = brush.smoothing;\n }\n\n /** Feeds input points; returns the document rectangles the new dabs touched. */\n push(points: readonly StrokePoint[]): CropBox[] {\n const dabs: Dab[] = [];\n for (const p of points) this.walker.push(this.smooth(p), dabs);\n return this.paint(dabs);\n }\n\n /** Ends the stroke (a single click still paints one dab). */\n finish(last?: StrokePoint): CropBox[] {\n const dabs: Dab[] = [];\n if (last && this.smoothPos && (this.smoothPos.x !== last.x || this.smoothPos.y !== last.y)) this.walker.push(last, dabs);\n this.walker.finish(dabs);\n return this.paint(dabs);\n }\n\n private smooth(p: StrokePoint): StrokePoint {\n const a = 1 - Math.min(0.95, Math.max(0, this.smoothing));\n const cur = this.smoothPos;\n const n = cur && a < 1 ? { ...p, x: cur.x + (p.x - cur.x) * a, y: cur.y + (p.y - cur.y) * a } : p;\n this.smoothPos = n;\n return n;\n }\n\n private paint(dabs: Dab[]): CropBox[] {\n const rects: CropBox[] = [];\n for (const d of dabs) {\n const rect = dabRect(d, this.brush.hardness);\n const n = rect.width * rect.height;\n if (this.buf.length < n) this.buf = new Float32Array(n);\n const vals = this.buf.subarray(0, n);\n rasterizeDab(d, this.brush.hardness, rect, vals);\n this.coverage.accumulate(rect, vals, d.opacity);\n rects.push(rect);\n this.dabCount++;\n }\n return rects;\n }\n}\n\n/** How a stroke changes pixels. */\nexport interface StrokeApply {\n /** `paint` puts colour down; `erase` removes alpha (or, with transparency locked, paints `background`). */\n mode: 'paint' | 'erase';\n /** RGBA 0..255 (paint colour, or the mask grey in `r`). */\n color: readonly [number, number, number, number];\n /** RGBA 0..255 the eraser paints on a transparency-locked layer (and on masks). */\n background: readonly [number, number, number, number];\n opacity: number;\n blend: BlendMode;\n lockTransparency: boolean;\n /** Selection coverage (document space, canvas-sized), or `null`. */\n selection: { width: number; height: number; data: ArrayLike<number> } | null;\n /** Layer offset (target pixels are in layer space). */\n offset: { x: number; y: number };\n}\n\n/**\n * Composites the stroke's coverage over `tileData` (the target's tile (tx, ty) as it was before\n * the stroke, in layer space; RGBA or one byte for masks) and returns the new tile data. With\n * `into` (the tile's previous result) and `region` (document space), only `region` is recomputed\n * and the rest of `into` is kept.\n */\nexport function applyStrokeToTile(\n coverage: CoverageMap,\n tileData: Uint8ClampedArray,\n channels: 1 | 4,\n tx: number,\n ty: number,\n s: StrokeApply,\n options: { into?: Uint8ClampedArray; region?: CropBox } = {}\n): Uint8ClampedArray {\n const out = options.into ? new Uint8ClampedArray(options.into) : new Uint8ClampedArray(tileData);\n const ox = tx * TILE + s.offset.x;\n const oy = ty * TILE + s.offset.y;\n let x0 = 0;\n let y0 = 0;\n let x1 = TILE;\n let y1 = TILE;\n if (options.region) {\n const r = options.region;\n x0 = Math.max(0, Math.floor(r.x) - ox);\n y0 = Math.max(0, Math.floor(r.y) - oy);\n x1 = Math.min(TILE, Math.ceil(r.x + r.width) - ox);\n y1 = Math.min(TILE, Math.ceil(r.y + r.height) - oy);\n if (x1 <= x0 || y1 <= y0) return out;\n // Start the region from the pre-stroke pixels: coverage is cumulative.\n if (options.into) {\n for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * TILE + x0) * channels, (y * TILE + x1) * channels), (y * TILE + x0) * channels);\n }\n }\n const sel = s.selection;\n const cb = [0, 0, 0, 0];\n const cs = [s.color[0] / 255, s.color[1] / 255, s.color[2] / 255, s.color[3] / 255];\n const bg = [s.background[0] / 255, s.background[1] / 255, s.background[2] / 255, s.background[3] / 255];\n // With a tile-aligned offset the layer tile is one coverage tile: read it directly.\n const aligned = s.offset.x % TILE === 0 && s.offset.y % TILE === 0;\n const covTile = aligned ? coverage.tiles.get(tileKey(Math.floor(ox / TILE), Math.floor(oy / TILE))) : undefined;\n if (aligned && !covTile) return out;\n for (let y = y0; y < y1; y++) {\n const dy = oy + y;\n for (let x = x0; x < x1; x++) {\n const dx = ox + x;\n const c = covTile ? covTile[y * TILE + x] : coverage.get(dx, dy);\n if (c <= 0) continue;\n let k = c * s.opacity;\n if (sel) {\n if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;\n k *= sel.data[dy * sel.width + dx] / 255;\n }\n if (k > 1) k = 1;\n if (k <= 0) continue;\n const p = y * TILE + x;\n if (channels === 1) {\n const target = s.mode === 'erase' ? s.background[0] : s.color[0];\n out[p] = Math.round(out[p] + (target - out[p]) * k);\n continue;\n }\n const i = p * 4;\n if (s.mode === 'erase' && !s.lockTransparency) {\n out[i + 3] = Math.round(out[i + 3] * (1 - k));\n continue;\n }\n if (s.lockTransparency && out[i + 3] === 0) continue;\n const src = s.mode === 'erase' ? bg : cs;\n if (s.blend === 'pigment') {\n // `blendPixel`'s paint mix on the 8-bit colours, with their spectra cached.\n const bytes = s.mode === 'erase' ? s.background : s.color;\n const as = src[3] * k;\n if (!(as > 0)) continue;\n const ao = as + (out[i + 3] / 255) * (1 - as);\n mixPigment8(out[i], out[i + 1], out[i + 2], bytes[0], bytes[1], bytes[2], as / ao, cb);\n out[i] = Math.round(cb[0] * 255);\n out[i + 1] = Math.round(cb[1] * 255);\n out[i + 2] = Math.round(cb[2] * 255);\n if (!s.lockTransparency) out[i + 3] = Math.round(ao * 255);\n continue;\n }\n for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / 255;\n const o = blendPixel(s.blend, cb, src, k);\n out[i] = Math.round(o[0] * 255);\n out[i + 1] = Math.round(o[1] * 255);\n out[i + 2] = Math.round(o[2] * 255);\n if (!s.lockTransparency) out[i + 3] = Math.round(o[3] * 255);\n }\n }\n return out;\n}\n\n/** Tile coordinates of coverage tile keys (for callers that track dirty tiles). */\nexport function coverageTileCoord(key: TileKey): { tx: number; ty: number } {\n return tileCoord(key);\n}\n","// Portions ported from photocraft/crates/paint/src/mixer.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/**\n * The Mixer Brush: a reservoir of loaded paint plus a pickup well that takes up colour from the\n * canvas under each dab (photocraft's behavioural model):\n *\n * - Each dab samples the canvas under its footprint (coverage- and alpha-weighted). The pickup\n * colour `P` moves towards that sample by `PICKUP_RATE × wet` (scaled by the sample's coverage).\n * - The dab's paint mixes the reservoir `R` (weight `amount × (1 − mix·wet)`) with the pickup\n * (weight `mix·wet`) and lands at `flow × opacity` times the total weight, over the pixels as\n * they are now, so earlier dabs of the same stroke are picked up again (smearing).\n * - The reservoir drains per dab unless `load` is 1, so low-load strokes run dry. A dry brush\n * (`wet` 0) paints only reservoir colour; an empty, wet brush smears canvas colour.\n *\n * `mixing: 'pigment'` does all three mixes (pickup, paint and deposit) with the Kubelka-Munk model\n * of `./pigment`, so a blue brush dragged through yellow makes green instead of grey. Everything\n * is data in, pixels out: the same canvas, points, settings and load replay identically.\n */\n\nimport { DabWalker, dabRect, rasterizeDab, type BrushSettings, type Dab, type StrokePoint } from './brush';\nimport { createPigment, lerpPigmentInto, setPigmentColor, type Pigment } from './pigment';\nimport type { RasterRect as CropBox } from '../raster/surface';\nimport { TILE } from '../raster/surface';\n\n/** How the Mixer Brush mixes colours: straight sRGB averages, or like paint (Kubelka-Munk). */\nexport type MixingModel = 'rgb' | 'pigment';\n\nexport const MIXING_MODELS: readonly MixingModel[] = ['rgb', 'pigment'];\n\n/** Mixer Brush options. */\nexport interface MixerSettings {\n /** How much colour the brush picks up from the canvas, 0 (dry) .. 1 (default 0.5). */\n wet: number;\n /** How much paint the reservoir holds, 0 .. 1 (default 0.5): below 1 it drains per dab and the stroke runs dry. */\n load: number;\n /** How far each dab's paint moves from the reservoir towards the picked-up colour, 0 .. 1 (default 0.5). */\n mix: number;\n /** Refill the reservoir with the paint colour at the start of each stroke (default true). */\n loadEachStroke: boolean;\n /** Empty the pickup well after each stroke (default true); off keeps the brush dirty for the next stroke. */\n cleanEachStroke: boolean;\n /** `rgb` (default) or `pigment` (blue and yellow make green). */\n mixing: MixingModel;\n}\n\nexport const DEFAULT_MIXER: Readonly<MixerSettings> = {\n wet: 0.5,\n load: 0.5,\n mix: 0.5,\n loadEachStroke: true,\n cleanEachStroke: true,\n mixing: 'rgb',\n};\n\n/** Fraction of the way the pickup colour moves towards the canvas per dab at 100 % wet. */\nexport const MIXER_PICKUP_RATE = 0.25;\n/** Fraction of the reservoir that drains per dab at 0 % load. */\nexport const MIXER_DRAIN = 0.08;\n\n/** Mixer settings with every field in range (missing fields from `DEFAULT_MIXER`). */\nexport function normalizeMixer(raw: Partial<MixerSettings> = {}): MixerSettings {\n const unit = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d);\n const bool = (v: unknown, d: boolean) => (typeof v === 'boolean' ? v : d);\n return {\n wet: unit(raw.wet, DEFAULT_MIXER.wet),\n load: unit(raw.load, DEFAULT_MIXER.load),\n mix: unit(raw.mix, DEFAULT_MIXER.mix),\n loadEachStroke: bool(raw.loadEachStroke, DEFAULT_MIXER.loadEachStroke),\n cleanEachStroke: bool(raw.cleanEachStroke, DEFAULT_MIXER.cleanEachStroke),\n mixing: raw.mixing === 'pigment' ? 'pigment' : 'rgb',\n };\n}\n\n/** What the brush carries between strokes. Colours are straight sRGB, 0..1. */\nexport interface MixerLoad {\n /** Loaded paint, or `null` when the brush is unloaded. */\n readonly reservoir: readonly [number, number, number] | null;\n /** Reservoir left, 0..1. */\n readonly amount: number;\n /** Colour picked up from the canvas, or `null` when the brush is clean. */\n readonly pickup: readonly [number, number, number] | null;\n}\n\nexport const EMPTY_MIXER_LOAD: MixerLoad = { reservoir: null, amount: 0, pickup: null };\n\n/** The brush loaded full with `color` (sRGB 0..1); the pickup well is kept. */\nexport function loadMixer(load: MixerLoad, color: readonly [number, number, number]): MixerLoad {\n const c = (v: number) => Math.min(1, Math.max(0, Number.isFinite(v) ? v : 0));\n return { reservoir: [c(color[0]), c(color[1]), c(color[2])], amount: 1, pickup: load.pickup };\n}\n\n/** The brush with its pickup well emptied; the reservoir is kept. */\nexport function cleanMixer(load: MixerLoad): MixerLoad {\n return { reservoir: load.reservoir, amount: load.amount, pickup: null };\n}\n\n/** The pixels a mixer stroke reads and writes (RGBA tiles in layer space). */\nexport interface MixerTarget {\n /** The tile (TILE × TILE × 4) at (tx, ty) as it is now, or `null` when it is fully transparent. */\n readTile(tx: number, ty: number): Uint8ClampedArray | null;\n /** A writable tile at (tx, ty), returned by `readTile` from then on. */\n writeTile(tx: number, ty: number): Uint8ClampedArray;\n /** Layer offset: layer pixel = document pixel − offset. */\n offset: { x: number; y: number };\n /** Keep alpha and paint only where the layer has pixels. */\n lockTransparency: boolean;\n /** Selection coverage (document space, canvas-sized), or `null`. */\n selection: { width: number; height: number; data: ArrayLike<number> } | null;\n}\n\ntype Rgb = [number, number, number];\n\n/**\n * One Mixer Brush stroke. Feed points with `push` (any chunks give the same dabs), end with\n * `finish`; `load` is the brush load after the dabs so far. Each call returns the document\n * rectangles it touched.\n */\nexport class MixerStroke {\n dabCount = 0;\n bounds: CropBox | null = null;\n private walker: DabWalker;\n private smoothPos: StrokePoint | null = null;\n private buf = new Float32Array(0);\n private readonly settings: MixerSettings;\n private readonly reservoir: Rgb | null;\n private amount: number;\n private pickup: Rgb | null;\n private readonly pig: { res: Pigment; pick: Pigment; paint: Pigment; canvas: Pigment } | null;\n private readonly out: Rgb = [0, 0, 0];\n\n constructor(\n readonly brush: BrushSettings,\n settings: Partial<MixerSettings>,\n load: MixerLoad,\n private readonly target: MixerTarget\n ) {\n this.settings = normalizeMixer(settings);\n this.walker = new DabWalker(brush);\n this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;\n this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;\n this.pickup = load.pickup ? [load.pickup[0], load.pickup[1], load.pickup[2]] : null;\n this.pig =\n this.settings.mixing === 'pigment'\n ? { res: createPigment(this.reservoir ?? [0, 0, 0]), pick: createPigment(this.pickup ?? [0, 0, 0]), paint: createPigment([0, 0, 0]), canvas: createPigment([0, 0, 0]) }\n : null;\n }\n\n /** The brush load after the dabs so far. */\n get load(): MixerLoad {\n return { reservoir: this.reservoir ? [...this.reservoir] : null, amount: this.amount, pickup: this.pickup ? [...this.pickup] : null };\n }\n\n push(points: readonly StrokePoint[]): CropBox[] {\n const dabs: Dab[] = [];\n for (const p of points) this.walker.push(this.smooth(p), dabs);\n return this.paint(dabs);\n }\n\n finish(last?: StrokePoint): CropBox[] {\n const dabs: Dab[] = [];\n if (last && this.smoothPos && (this.smoothPos.x !== last.x || this.smoothPos.y !== last.y)) this.walker.push(last, dabs);\n this.walker.finish(dabs);\n return this.paint(dabs);\n }\n\n private smooth(p: StrokePoint): StrokePoint {\n const a = 1 - Math.min(0.95, Math.max(0, this.brush.smoothing));\n const cur = this.smoothPos;\n const n = cur && a < 1 ? { ...p, x: cur.x + (p.x - cur.x) * a, y: cur.y + (p.y - cur.y) * a } : p;\n this.smoothPos = n;\n return n;\n }\n\n /** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */\n private mix(a: Rgb, pa: Pigment | null, b: Rgb, pb: Pigment | null, t: number): Rgb {\n const o = this.out;\n if (pa && pb) lerpPigmentInto(pa, pb, t, o, 0);\n else for (let c = 0; c < 3; c++) o[c] = a[c] + (b[c] - a[c]) * t;\n return o;\n }\n\n private paint(dabs: Dab[]): CropBox[] {\n const rects: CropBox[] = [];\n for (const d of dabs) {\n const rect = dabRect(d, this.brush.hardness);\n const n = rect.width * rect.height;\n if (this.buf.length < n) this.buf = new Float32Array(n);\n const cov = this.buf.subarray(0, n);\n // Pure tip coverage: flow scales the deposit, not the sampling weights.\n rasterizeDab({ ...d, alpha: 1 }, this.brush.hardness, rect, cov);\n this.dab(d, rect, cov);\n rects.push(rect);\n this.bounds = union(this.bounds, rect);\n this.dabCount++;\n }\n return rects;\n }\n\n // The tile last looked up by `locate` (and whether it came from `writeTile`).\n private tx = NaN;\n private ty = NaN;\n private tile: Uint8ClampedArray | null = null;\n private writable = false;\n\n /** Index of document pixel (dx, dy) in `this.tile`, or -1 when reading an empty tile. */\n private locate(dx: number, dy: number, write: boolean): number {\n const t = this.target;\n const lx = dx - t.offset.x;\n const ly = dy - t.offset.y;\n const tx = Math.floor(lx / TILE);\n const ty = Math.floor(ly / TILE);\n if (tx !== this.tx || ty !== this.ty || (write && !this.writable)) {\n this.tx = tx;\n this.ty = ty;\n this.tile = write ? t.writeTile(tx, ty) : t.readTile(tx, ty);\n this.writable = write;\n }\n return this.tile ? ((ly - ty * TILE) * TILE + (lx - tx * TILE)) * 4 : -1;\n }\n\n private dab(d: Dab, rect: CropBox, cov: Float32Array): void {\n const { wet, mix, load } = this.settings;\n const pig = this.pig;\n const w = rect.width;\n this.tx = NaN;\n\n // 1. Sample the canvas under the dab.\n let ar = 0;\n let ag = 0;\n let ab = 0;\n let wsum = 0;\n let asum = 0;\n for (let yy = 0; yy < rect.height; yy++) {\n for (let xx = 0; xx < w; xx++) {\n const k = cov[yy * w + xx];\n if (k <= 0) continue;\n wsum += k;\n const i = this.locate(rect.x + xx, rect.y + yy, false);\n if (i < 0) continue;\n const px = this.tile!;\n const al = px[i + 3] / 255;\n if (al <= 0) continue;\n const ka = k * al;\n ar += (px[i] / 255) * ka;\n ag += (px[i + 1] / 255) * ka;\n ab += (px[i + 2] / 255) * ka;\n asum += ka;\n }\n }\n if (asum > 1e-6 && wet > 0) {\n const canvas: Rgb = [ar / asum, ag / asum, ab / asum];\n if (!this.pickup) this.pickup = canvas;\n else {\n if (pig) setPigmentColor(pig.canvas, canvas[0], canvas[1], canvas[2]);\n const o = this.mix(this.pickup, pig?.pick ?? null, canvas, pig?.canvas ?? null, MIXER_PICKUP_RATE * wet * (asum / Math.max(1e-6, wsum)));\n this.pickup = [o[0], o[1], o[2]];\n }\n if (pig) setPigmentColor(pig.pick, this.pickup[0], this.pickup[1], this.pickup[2]);\n }\n\n // 2. The dab's paint: the reservoir mixed with the pickup.\n const res = this.reservoir;\n const wr = res ? this.amount * (1 - mix * wet) : 0;\n const wp = this.pickup ? mix * wet : 0;\n const total = wr + wp;\n if (total > 1e-6) {\n const paint: Rgb = res && this.pickup ? [...this.mix(res, pig?.res ?? null, this.pickup, pig?.pick ?? null, wp / total)] : [...(res ?? this.pickup!)];\n if (pig) setPigmentColor(pig.paint, paint[0], paint[1], paint[2]);\n const dep = Math.min(1, total) * this.brush.flow * this.brush.opacity * d.opacity;\n if (dep > 0) this.deposit(rect, cov, paint, dep);\n }\n\n // 3. The reservoir drains unless the load is full.\n this.amount *= 1 - MIXER_DRAIN * (1 - load);\n }\n\n /** Lays `paint` over the pixels under the dab at `dep` × coverage (× selection). */\n private deposit(rect: CropBox, cov: Float32Array, paint: Rgb, dep: number): void {\n const t = this.target;\n const sel = t.selection;\n const pig = this.pig;\n const w = rect.width;\n const o = this.out;\n // Pigment mode keeps the last canvas colour's spectrum: runs of equal pixels are common.\n let lastKey = -1;\n for (let yy = 0; yy < rect.height; yy++) {\n const dy = rect.y + yy;\n for (let xx = 0; xx < w; xx++) {\n let k = cov[yy * w + xx] * dep;\n if (k <= 0) continue;\n const dx = rect.x + xx;\n if (sel) {\n if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;\n k *= sel.data[dy * sel.width + dx] / 255;\n if (k <= 0) continue;\n }\n if (k > 1) k = 1;\n // A locked layer keeps its transparent pixels (and leaves their tiles unwritten).\n if (t.lockTransparency) {\n const ri = this.locate(dx, dy, false);\n if (ri < 0 || this.tile![ri + 3] === 0) continue;\n }\n const i = this.locate(dx, dy, true);\n const px = this.tile!;\n const a = px[i + 3] / 255;\n const na = t.lockTransparency ? a : a + (1 - a) * k;\n // The new paint's share of the result (source-over); a locked layer mixes by `k` alone.\n const share = t.lockTransparency ? k : na > 0 ? k / na : 1;\n if (a <= 0 || share >= 1) {\n o[0] = paint[0];\n o[1] = paint[1];\n o[2] = paint[2];\n } else if (pig) {\n const key = (px[i] << 16) | (px[i + 1] << 8) | px[i + 2];\n if (key !== lastKey) {\n setPigmentColor(pig.canvas, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);\n lastKey = key;\n }\n lerpPigmentInto(pig.canvas, pig.paint, share, o, 0);\n } else {\n for (let c = 0; c < 3; c++) o[c] = px[i + c] / 255 + (paint[c] - px[i + c] / 255) * share;\n }\n px[i] = Math.round(o[0] * 255);\n px[i + 1] = Math.round(o[1] * 255);\n px[i + 2] = Math.round(o[2] * 255);\n px[i + 3] = Math.round(na * 255);\n }\n }\n }\n}\n\nfunction union(a: CropBox | null, b: CropBox): CropBox {\n if (!a) return { ...b };\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };\n}\n","import type { AgentTool } from '../tools/registry.js';\nimport { createPigment, mixPigments, type Pigment } from './pigment';\n\nconst HEX = /^#?([0-9a-f]{6})$/i;\n\nfunction parseHex(value: unknown, index: number): [number, number, number] {\n const m = typeof value === 'string' ? HEX.exec(value.trim()) : null;\n if (!m) throw new Error(`colors[${index}].color is ${JSON.stringify(value)}; use #rrggbb, e.g. \"#1e40af\".`);\n const n = parseInt(m[1], 16);\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n}\n\nfunction toHex(rgb: readonly number[]): string {\n return '#' + rgb.map((v) => Math.round(Math.min(1, Math.max(0, v)) * 255).toString(16).padStart(2, '0')).join('');\n}\n\n/**\n * Agent tools for pigment mixing (`@pixerate/editor/paint`). `mix_colors` is read-only: it\n * predicts what paints mixed in given amounts look like, for choosing a brush or fill colour.\n */\nexport function createPigmentTools(): AgentTool[] {\n const mixColors: AgentTool = {\n name: 'mix_colors',\n title: 'Mix colours like paint',\n description:\n 'Mixes colours as paint would (Kubelka-Munk pigment mixing over reflectance spectra), so blue and yellow make green and white lightens a colour into a tint instead of greying it. Changes nothing. Returns the mixed colour as #rrggbb, the plain RGB average (rgbLerp) for comparison, and the normalised weights.',\n inputSchema: {\n type: 'object',\n properties: {\n colors: {\n type: 'array',\n minItems: 1,\n maxItems: 16,\n description: 'The paints to mix (1 to 16).',\n items: {\n type: 'object',\n properties: {\n color: { type: 'string', description: 'Paint colour #rrggbb.' },\n weight: { type: 'number', minimum: 0, description: 'Parts of this paint, any scale (e.g. 1 and 3 for a 1:3 mix). At least one weight must be above 0.' },\n strength: {\n type: 'number',\n exclusiveMinimum: 0,\n maximum: 100,\n description: 'Tinting strength (default 1): each part counts as this many, so a strong dark paint (e.g. 4) tints a lot of white.',\n },\n },\n required: ['color', 'weight'],\n additionalProperties: false,\n },\n },\n },\n required: ['colors'],\n additionalProperties: false,\n },\n annotations: { title: 'Mix colours like paint', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n handler: (args) => {\n const items = args.colors as { color: string; weight: number; strength?: number }[];\n const rgbs = items.map((item, i) => parseHex(item.color, i));\n const total = items.reduce((sum, item) => sum + item.weight, 0);\n if (!(total > 0)) throw new Error('Every weight is 0; give at least one colour a weight above 0.');\n const pigments: Pigment[] = rgbs.map((rgb, i) => createPigment(rgb, { strength: items[i].strength }));\n const mixed = mixPigments(pigments, items.map((item) => item.weight));\n const lerp = [0, 1, 2].map((c) => rgbs.reduce((sum, rgb, i) => sum + rgb[c] * items[i].weight, 0) / total);\n return {\n mixed: toHex(mixed),\n rgbLerp: toHex(lerp),\n weights: items.map((item) => item.weight / total),\n model: 'kubelka-munk',\n };\n },\n };\n return [mixColors];\n}\n"],"mappings":";;;;;;;;;;;;;AAsDO,IAAM,gBAAyC;AAAA,EACpD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AA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I,CAAC,SAAS,KAAK,SAAS,KAAK;AAAA,QAChD,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO,CAAC,SAAS;AACnB;","names":[]}
@@ -9,7 +9,8 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkZOOEX3WTcjs = require('./chunk-ZOOEX3WT.cjs');
12
+
13
+ var _chunkCRMAXIUVcjs = require('./chunk-CRMAXIUV.cjs');
13
14
 
14
15
  // src/raster/blur.ts
15
16
  function gaussianKernel(sigma) {
@@ -370,7 +371,7 @@ function oneOf(r, key, path, values) {
370
371
  if (typeof r[key] !== "string" || !values.includes(r[key])) fail(`${path}.${key}`, `must be one of ${values.join(", ")}.`);
371
372
  }
372
373
  function blend(r, key, path) {
373
- if (!_chunkZOOEX3WTcjs.isBlendMode.call(void 0, r[key])) fail(`${path}.${key}`, `must be a blend mode such as normal, multiply or screen (got ${JSON.stringify(r[key])}).`);
374
+ if (!_chunkCRMAXIUVcjs.isBlendMode.call(void 0, r[key])) fail(`${path}.${key}`, `must be a blend mode such as normal, multiply or screen (got ${JSON.stringify(r[key])}).`);
374
375
  }
375
376
  function contour(v, path) {
376
377
  if (v === void 0) return;
@@ -1470,9 +1471,9 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
1470
1471
  m1 = sg;
1471
1472
  m2 = sb;
1472
1473
  } else if (separable) {
1473
- m0 = _chunkZOOEX3WTcjs.blendChannel.call(void 0, mode, b0, sr);
1474
- m1 = _chunkZOOEX3WTcjs.blendChannel.call(void 0, mode, b1, sg);
1475
- m2 = _chunkZOOEX3WTcjs.blendChannel.call(void 0, mode, b2, sb);
1474
+ m0 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b0, sr);
1475
+ m1 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b1, sg);
1476
+ m2 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b2, sb);
1476
1477
  } else {
1477
1478
  rgbScratchB[0] = b0;
1478
1479
  rgbScratchB[1] = b1;
@@ -1480,7 +1481,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
1480
1481
  rgbScratchS[0] = sr;
1481
1482
  rgbScratchS[1] = sg;
1482
1483
  rgbScratchS[2] = sb;
1483
- const m = _chunkZOOEX3WTcjs.blendRgb.call(void 0, mode, rgbScratchB, rgbScratchS);
1484
+ const m = _chunkCRMAXIUVcjs.blendRgb.call(void 0, mode, rgbScratchB, rgbScratchS);
1484
1485
  m0 = m[0];
1485
1486
  m1 = m[1];
1486
1487
  m2 = m[2];
@@ -1494,7 +1495,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
1494
1495
  dst[i + 3] = ao;
1495
1496
  }
1496
1497
  function paint(dst, m, color2, mode, opacity) {
1497
- const sep = mode !== "normal" && _chunkZOOEX3WTcjs.isSeparableBlendMode.call(void 0, mode);
1498
+ const sep = mode !== "normal" && _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode);
1498
1499
  const c = [0, 0, 0, 1];
1499
1500
  const n = m.length;
1500
1501
  for (let i = 0; i < n; i++) {
@@ -1746,7 +1747,7 @@ function compositeLayerEffects(input) {
1746
1747
  }
1747
1748
  const premerge = !normalLike;
1748
1749
  if (premerge) {
1749
- const sep2 = _chunkZOOEX3WTcjs.isSeparableBlendMode.call(void 0, input.blend);
1750
+ const sep2 = _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, input.blend);
1750
1751
  for (let i = 0; i < n; i++) {
1751
1752
  const p = i * 4;
1752
1753
  const sr = lay[p];
@@ -1866,7 +1867,7 @@ function compositeLayerEffects(input) {
1866
1867
  paintColor(work, fx(i, 1), e.shadowColor, e.shadowBlend, e.shadowOpacity);
1867
1868
  }
1868
1869
  const mode = premerge ? "normal" : input.blend;
1869
- const sep = _chunkZOOEX3WTcjs.isSeparableBlendMode.call(void 0, mode);
1870
+ const sep = _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode);
1870
1871
  for (let i = 0; i < n; i++) {
1871
1872
  const p = i * 4;
1872
1873
  if (lay[p + 3] > 0) compositeAt(work, p, mode, sep, lay[p], lay[p + 1], lay[p + 2], lay[p + 3]);
@@ -1911,7 +1912,7 @@ function renderLayerEffects(effects, layer, backdrop, canvas, ctx) {
1911
1912
  }
1912
1913
 
1913
1914
  // src/raster/compositor.ts
1914
- var TILE_PIXELS = _chunkZOOEX3WTcjs.TILE * _chunkZOOEX3WTcjs.TILE;
1915
+ var TILE_PIXELS = _chunkCRMAXIUVcjs.TILE * _chunkCRMAXIUVcjs.TILE;
1915
1916
  var TILE_BYTES = TILE_PIXELS * 4;
1916
1917
  function sameSig(a, b) {
1917
1918
  if (!a || a.key !== b.key || a.refs.length !== b.refs.length) return false;
@@ -1923,13 +1924,13 @@ function dirtyInTile(rects, tx, ty) {
1923
1924
  let y0 = Infinity;
1924
1925
  let x1 = -Infinity;
1925
1926
  let y1 = -Infinity;
1926
- const ox = tx * _chunkZOOEX3WTcjs.TILE;
1927
- const oy = ty * _chunkZOOEX3WTcjs.TILE;
1927
+ const ox = tx * _chunkCRMAXIUVcjs.TILE;
1928
+ const oy = ty * _chunkCRMAXIUVcjs.TILE;
1928
1929
  for (const r of rects) {
1929
1930
  const a = Math.max(ox, Math.floor(r.x));
1930
1931
  const b = Math.max(oy, Math.floor(r.y));
1931
- const c = Math.min(ox + _chunkZOOEX3WTcjs.TILE, Math.ceil(r.x + r.width));
1932
- const d = Math.min(oy + _chunkZOOEX3WTcjs.TILE, Math.ceil(r.y + r.height));
1932
+ const c = Math.min(ox + _chunkCRMAXIUVcjs.TILE, Math.ceil(r.x + r.width));
1933
+ const d = Math.min(oy + _chunkCRMAXIUVcjs.TILE, Math.ceil(r.y + r.height));
1933
1934
  if (c <= a || d <= b) continue;
1934
1935
  x0 = Math.min(x0, a);
1935
1936
  y0 = Math.min(y0, b);
@@ -1941,7 +1942,8 @@ function dirtyInTile(rects, tx, ty) {
1941
1942
  function blendTile(dst, src, mode, alpha, coverage) {
1942
1943
  if (!(alpha > 0)) return;
1943
1944
  const normal = mode === "normal";
1944
- const lut = !normal && _chunkZOOEX3WTcjs.isSeparableBlendMode.call(void 0, mode) ? separableLut(mode) : null;
1945
+ const pigment = mode === "pigment";
1946
+ const lut = !normal && _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode) ? separableLut(mode) : null;
1945
1947
  const cb = [0, 0, 0];
1946
1948
  const cs = [0, 0, 0];
1947
1949
  const n = dst.length;
@@ -1967,6 +1969,14 @@ function blendTile(dst, src, mode, alpha, coverage) {
1967
1969
  const d0 = dst[i];
1968
1970
  const d1 = dst[i + 1];
1969
1971
  const d2 = dst[i + 2];
1972
+ if (pigment) {
1973
+ _chunkCRMAXIUVcjs.mixPigment8.call(void 0, d0, d1, d2, src[i], src[i + 1], src[i + 2], as / ao, cb);
1974
+ dst[i] = Math.round(cb[0] * 255);
1975
+ dst[i + 1] = Math.round(cb[1] * 255);
1976
+ dst[i + 2] = Math.round(cb[2] * 255);
1977
+ dst[i + 3] = Math.round(ao * 255);
1978
+ continue;
1979
+ }
1970
1980
  const b0 = d0 / 255;
1971
1981
  const b1 = d1 / 255;
1972
1982
  const b2 = d2 / 255;
@@ -1991,7 +2001,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
1991
2001
  cs[0] = s0;
1992
2002
  cs[1] = s1;
1993
2003
  cs[2] = s2;
1994
- const m = _chunkZOOEX3WTcjs.blendRgb.call(void 0, mode, cb, cs);
2004
+ const m = _chunkCRMAXIUVcjs.blendRgb.call(void 0, mode, cb, cs);
1995
2005
  m0 = m[0];
1996
2006
  m1 = m[1];
1997
2007
  m2 = m[2];
@@ -2010,7 +2020,7 @@ function separableLut(mode) {
2010
2020
  let lut = separableLuts.get(mode);
2011
2021
  if (!lut) {
2012
2022
  lut = new Float64Array(65536);
2013
- for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] = _chunkZOOEX3WTcjs.blendChannel.call(void 0, mode, b / 255, c / 255);
2023
+ for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b / 255, c / 255);
2014
2024
  separableLuts.set(mode, lut);
2015
2025
  }
2016
2026
  return lut;
@@ -2082,15 +2092,15 @@ var RasterCompositor = (_class = class {
2082
2092
  composite(layers, rect, sources, options = {}) {
2083
2093
  const out = new Uint8ClampedArray(Math.max(0, rect.width * rect.height * 4));
2084
2094
  this.compositeTiles(layers, rect, sources, (tx, ty, data) => {
2085
- const ox = tx * _chunkZOOEX3WTcjs.TILE;
2086
- const oy = ty * _chunkZOOEX3WTcjs.TILE;
2095
+ const ox = tx * _chunkCRMAXIUVcjs.TILE;
2096
+ const oy = ty * _chunkCRMAXIUVcjs.TILE;
2087
2097
  const x0 = Math.max(rect.x, ox);
2088
2098
  const y0 = Math.max(rect.y, oy);
2089
- const x1 = Math.min(rect.x + rect.width, ox + _chunkZOOEX3WTcjs.TILE);
2090
- const y1 = Math.min(rect.y + rect.height, oy + _chunkZOOEX3WTcjs.TILE);
2099
+ const x1 = Math.min(rect.x + rect.width, ox + _chunkCRMAXIUVcjs.TILE);
2100
+ const y1 = Math.min(rect.y + rect.height, oy + _chunkCRMAXIUVcjs.TILE);
2091
2101
  const span = (x1 - x0) * 4;
2092
2102
  for (let y = y0; y < y1; y++) {
2093
- const s = ((y - oy) * _chunkZOOEX3WTcjs.TILE + (x0 - ox)) * 4;
2103
+ const s = ((y - oy) * _chunkCRMAXIUVcjs.TILE + (x0 - ox)) * 4;
2094
2104
  out.set(data.subarray(s, s + span), ((y - rect.y) * rect.width + (x0 - rect.x)) * 4);
2095
2105
  }
2096
2106
  }, options);
@@ -2109,9 +2119,9 @@ var RasterCompositor = (_class = class {
2109
2119
  const stats = { tiles: 0, cached: 0, stepsRun: 0 };
2110
2120
  const grow = options.dirty ? this.effectsReach(layers) : 0;
2111
2121
  const dirty = grow > 0 ? options.dirty.map((d) => inflateRect(d, grow)) : options.dirty;
2112
- for (const { tx, ty } of _chunkZOOEX3WTcjs.tilesInRect.call(void 0, rect)) {
2122
+ for (const { tx, ty } of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, rect)) {
2113
2123
  stats.tiles++;
2114
- const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(_chunkZOOEX3WTcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _9 => _9.result]);
2124
+ const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(_chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _9 => _9.result]);
2115
2125
  const data = this.compositeTile(layers, steps, tx, ty, stats, dirty ? dirtyInTile(dirty, tx, ty) : null);
2116
2126
  onTile(tx, ty, data, data !== before);
2117
2127
  }
@@ -2187,7 +2197,7 @@ var RasterCompositor = (_class = class {
2187
2197
  return key;
2188
2198
  }
2189
2199
  compositeTile(root, steps, tx, ty, stats, dirty = null) {
2190
- const key = _chunkZOOEX3WTcjs.tileKey.call(void 0, tx, ty);
2200
+ const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty);
2191
2201
  const entry = this.tiles.get(key);
2192
2202
  const sigs = steps.map((s) => this.stepSig(s, tx, ty));
2193
2203
  let first = 0;
@@ -2209,20 +2219,20 @@ var RasterCompositor = (_class = class {
2209
2219
  }
2210
2220
  }
2211
2221
  }
2212
- const tileRect = { x: tx * _chunkZOOEX3WTcjs.TILE, y: ty * _chunkZOOEX3WTcjs.TILE, width: _chunkZOOEX3WTcjs.TILE, height: _chunkZOOEX3WTcjs.TILE };
2222
+ const tileRect = { x: tx * _chunkCRMAXIUVcjs.TILE, y: ty * _chunkCRMAXIUVcjs.TILE, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
2213
2223
  const hint = this.hint;
2214
2224
  const checkpoints = /* @__PURE__ */ new Map();
2215
2225
  if (entry) {
2216
2226
  for (const [index, cp] of entry.checkpoints) if (index <= start) checkpoints.set(index, cp);
2217
2227
  }
2218
2228
  let result;
2219
- if (entry && dirty && (dirty.width < _chunkZOOEX3WTcjs.TILE || dirty.height < _chunkZOOEX3WTcjs.TILE)) {
2229
+ if (entry && dirty && (dirty.width < _chunkCRMAXIUVcjs.TILE || dirty.height < _chunkCRMAXIUVcjs.TILE)) {
2220
2230
  const r = dirty;
2221
2231
  const sub = (data) => {
2222
2232
  const out = new Uint8ClampedArray(r.width * r.height * 4);
2223
2233
  if (!data) return out;
2224
2234
  for (let y = 0; y < r.height; y++) {
2225
- const s = ((r.y - tileRect.y + y) * _chunkZOOEX3WTcjs.TILE + (r.x - tileRect.x)) * 4;
2235
+ const s = ((r.y - tileRect.y + y) * _chunkCRMAXIUVcjs.TILE + (r.x - tileRect.x)) * 4;
2226
2236
  out.set(data.subarray(s, s + r.width * 4), y * r.width * 4);
2227
2237
  }
2228
2238
  return out;
@@ -2235,7 +2245,7 @@ var RasterCompositor = (_class = class {
2235
2245
  }
2236
2246
  result = new Uint8ClampedArray(entry.result);
2237
2247
  for (let y = 0; y < r.height; y++) {
2238
- result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) * _chunkZOOEX3WTcjs.TILE + (r.x - tileRect.x)) * 4);
2248
+ result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) * _chunkCRMAXIUVcjs.TILE + (r.x - tileRect.x)) * 4);
2239
2249
  }
2240
2250
  } else {
2241
2251
  const acc = base ? new Uint8ClampedArray(base.data) : new Uint8ClampedArray(TILE_BYTES);
@@ -2330,8 +2340,8 @@ var RasterCompositor = (_class = class {
2330
2340
  if (!isPixel(layer)) return { key, refs: this.maskRefs(layer, tx, ty, 0, 0) };
2331
2341
  const { surface, dx, dy } = this.layerPixels(layer);
2332
2342
  const refs = [surface.defaultValue];
2333
- const r = { x: tx * _chunkZOOEX3WTcjs.TILE - dx, y: ty * _chunkZOOEX3WTcjs.TILE - dy, width: _chunkZOOEX3WTcjs.TILE, height: _chunkZOOEX3WTcjs.TILE };
2334
- for (const t of _chunkZOOEX3WTcjs.tilesInRect.call(void 0, r)) refs.push(_nullishCoalesce(surface.getTile(t.tx, t.ty), () => ( null)));
2343
+ const r = { x: tx * _chunkCRMAXIUVcjs.TILE - dx, y: ty * _chunkCRMAXIUVcjs.TILE - dy, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
2344
+ for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, r)) refs.push(_nullishCoalesce(surface.getTile(t.tx, t.ty), () => ( null)));
2335
2345
  refs.push(...this.maskRefs(layer, tx, ty, _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.offset, 'optionalAccess', _21 => _21.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.offset, 'optionalAccess', _23 => _23.y]), () => ( 0))));
2336
2346
  return { key, refs };
2337
2347
  }
@@ -2392,7 +2402,7 @@ var RasterCompositor = (_class = class {
2392
2402
  shapeRefs(layer, region) {
2393
2403
  const refs = [];
2394
2404
  if (region.width <= 0 || region.height <= 0) return refs;
2395
- for (const t of _chunkZOOEX3WTcjs.tilesInRect.call(void 0, region)) {
2405
+ for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, region)) {
2396
2406
  const sig = isGroup(layer) ? this.plainGroupSig(layer, this.buildSteps(_nullishCoalesce(layer.children, () => ( []))), t.tx, t.ty) : this.plainContentSig(layer, t.tx, t.ty);
2397
2407
  for (const r of sig.refs) refs.push(r);
2398
2408
  }
@@ -2412,7 +2422,7 @@ var RasterCompositor = (_class = class {
2412
2422
  const region = this.effectRegion(layer);
2413
2423
  const m = effectsMargin(layer.effects);
2414
2424
  if (effectsAreLocal(activeEffectItems(layer.effects))) {
2415
- return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx * _chunkZOOEX3WTcjs.TILE - m, y: ty * _chunkZOOEX3WTcjs.TILE - m, width: _chunkZOOEX3WTcjs.TILE + 2 * m, height: _chunkZOOEX3WTcjs.TILE + 2 * m }, region)) };
2425
+ return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx * _chunkCRMAXIUVcjs.TILE - m, y: ty * _chunkCRMAXIUVcjs.TILE - m, width: _chunkCRMAXIUVcjs.TILE + 2 * m, height: _chunkCRMAXIUVcjs.TILE + 2 * m }, region)) };
2416
2426
  }
2417
2427
  return { key, refs: [`${region.x},${region.y},${region.width},${region.height}`, ...this.shapeRefs(layer, region)] };
2418
2428
  }
@@ -2516,7 +2526,7 @@ var RasterCompositor = (_class = class {
2516
2526
  if (!mask || mask.enabled === false) return [];
2517
2527
  if (mask.source || (_nullishCoalesce(mask.feather, () => ( 0))) > 0) return [this.planeFor(mask, ox, oy)];
2518
2528
  const refs = [];
2519
- for (const t of _chunkZOOEX3WTcjs.tilesInRect.call(void 0, { x: tx * _chunkZOOEX3WTcjs.TILE - ox, y: ty * _chunkZOOEX3WTcjs.TILE - oy, width: _chunkZOOEX3WTcjs.TILE, height: _chunkZOOEX3WTcjs.TILE })) {
2529
+ for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, { x: tx * _chunkCRMAXIUVcjs.TILE - ox, y: ty * _chunkCRMAXIUVcjs.TILE - oy, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE })) {
2520
2530
  refs.push(_nullishCoalesce(mask.surface.getTile(t.tx, t.ty), () => ( null)));
2521
2531
  }
2522
2532
  return refs;
@@ -2551,12 +2561,12 @@ var RasterCompositor = (_class = class {
2551
2561
  if (!isPixel(layer)) return _nullishCoalesce(_optionalChain([this, 'access', _34 => _34.profile, 'access', _35 => _35.contentTile, 'optionalCall', _36 => _36(layer, r, this.sources)]), () => ( null));
2552
2562
  const { surface, dx, dy, perPixel } = this.layerPixels(layer);
2553
2563
  const src = { x: r.x - dx, y: r.y - dy, width: r.width, height: r.height };
2554
- const covered = _chunkZOOEX3WTcjs.tilesInRect.call(void 0, src).map((t) => surface.getTile(t.tx, t.ty));
2564
+ const covered = _chunkCRMAXIUVcjs.tilesInRect.call(void 0, src).map((t) => surface.getTile(t.tx, t.ty));
2555
2565
  if (surface.defaultValue === 0 && covered.every((t) => !t)) return null;
2556
- const aligned = r.width === _chunkZOOEX3WTcjs.TILE && r.height === _chunkZOOEX3WTcjs.TILE && src.x % _chunkZOOEX3WTcjs.TILE === 0 && src.y % _chunkZOOEX3WTcjs.TILE === 0;
2566
+ const aligned = r.width === _chunkCRMAXIUVcjs.TILE && r.height === _chunkCRMAXIUVcjs.TILE && src.x % _chunkCRMAXIUVcjs.TILE === 0 && src.y % _chunkCRMAXIUVcjs.TILE === 0;
2557
2567
  if (!perPixel) {
2558
2568
  if (aligned && covered[0]) return covered[0].data;
2559
- return _chunkZOOEX3WTcjs.readRegion.call(void 0, surface, src);
2569
+ return _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
2560
2570
  }
2561
2571
  const fkey = `${dx},${dy}:${perPixel.key}`;
2562
2572
  const anchor = _nullishCoalesce(covered.find(Boolean), () => ( surface));
@@ -2566,7 +2576,7 @@ var RasterCompositor = (_class = class {
2566
2576
  const hit = _optionalChain([byKey, 'optionalAccess', _37 => _37.get, 'call', _38 => _38(refsKey)]);
2567
2577
  if (hit) return hit;
2568
2578
  }
2569
- const data = _chunkZOOEX3WTcjs.readRegion.call(void 0, surface, src);
2579
+ const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
2570
2580
  perPixel.apply(data, r.width, r.height);
2571
2581
  if (aligned) {
2572
2582
  if (!byKey) {
@@ -2605,7 +2615,7 @@ var RasterCompositor = (_class = class {
2605
2615
  if (!generated || generated.length !== W * H) v.fill(1);
2606
2616
  else v.set(generated);
2607
2617
  } else {
2608
- const bytes = _chunkZOOEX3WTcjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width: W, height: H });
2618
+ const bytes = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width: W, height: H });
2609
2619
  for (let i = 0; i < v.length; i++) v[i] = bytes[i] / 255;
2610
2620
  }
2611
2621
  const feather = _nullishCoalesce(mask.feather, () => ( 0));
@@ -2641,7 +2651,7 @@ var RasterCompositor = (_class = class {
2641
2651
  for (let x = x0; x < x1; x++) out[d + x] = plane.data[s + x];
2642
2652
  }
2643
2653
  } else {
2644
- const bytes = _chunkZOOEX3WTcjs.readRegion.call(void 0, mask.surface, { x: r.x - ox, y: r.y - oy, width: r.width, height: r.height });
2654
+ const bytes = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, { x: r.x - ox, y: r.y - oy, width: r.width, height: r.height });
2645
2655
  let all = true;
2646
2656
  for (let i = 0; i < n; i++) {
2647
2657
  out[i] = bytes[i] / 255;
@@ -2753,10 +2763,10 @@ var RasterCompositor = (_class = class {
2753
2763
  }
2754
2764
  }, _class);
2755
2765
  function filterOverCanvas(surface, ox, oy, filters, width, height) {
2756
- if (width <= 0 || height <= 0) return _chunkZOOEX3WTcjs.emptySurface.call(void 0, 4);
2757
- const data = _chunkZOOEX3WTcjs.readRegion.call(void 0, surface, { x: -ox, y: -oy, width, height });
2766
+ if (width <= 0 || height <= 0) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
2767
+ const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, { x: -ox, y: -oy, width, height });
2758
2768
  filters.apply(data, width, height);
2759
- return _chunkZOOEX3WTcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, 0, 0);
2769
+ return _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, 0, 0);
2760
2770
  }
2761
2771
  function copyRect(data, r, a) {
2762
2772
  const out = new Uint8ClampedArray(a.width * a.height * 4);
@@ -3682,4 +3692,4 @@ function pngDataUrl(width, height, data, channels = 4) {
3682
3692
 
3683
3693
 
3684
3694
  exports.DIRECT_GAUSSIAN_MAX_SIGMA = DIRECT_GAUSSIAN_MAX_SIGMA; exports.gaussianBlur = gaussianBlur; exports.flattenLayers = flattenLayers; exports.findLayer = findLayer; exports.mapLayer = mapLayer; exports.insertLayer = insertLayer; exports.isLayerLocked = isLayerLocked; exports.DEFAULT_GLOBAL_LIGHT = DEFAULT_GLOBAL_LIGHT; exports.LAYER_EFFECT_KINDS = LAYER_EFFECT_KINDS; exports.layerEffectLabel = layerEffectLabel; exports.isLayerEffectKind = isLayerEffectKind; exports.defaultEffectGradient = defaultEffectGradient; exports.newEffectId = newEffectId; exports.defaultLayerEffect = defaultLayerEffect; exports.hasActiveEffects = hasActiveEffects; exports.MAX_EFFECT_REACH = MAX_EFFECT_REACH; exports.effectReach = effectReach; exports.effectsMargin = effectsMargin; exports.effectsScale = effectsScale; exports.scaleLayerEffect = scaleLayerEffect; exports.parseEffectColor = parseEffectColor; exports.effectColorHex = effectColorHex; exports.LayerEffectError = LayerEffectError; exports.validateEffectGradient = validateEffectGradient; exports.layerEffectFields = layerEffectFields; exports.validateLayerEffect = validateLayerEffect; exports.mergeLayerEffect = mergeLayerEffect; exports.validateLayerEffects = validateLayerEffects; exports.normalizeLayerEffects = normalizeLayerEffects; exports.effectsFingerprint = effectsFingerprint; exports.PatternTile = PatternTile; exports.PatternPlacement = PatternPlacement; exports.builtinPatternIds = builtinPatternIds; exports.builtinPattern = builtinPattern; exports.hashNoise = hashNoise; exports.CURVE_LUT_SIZE = CURVE_LUT_SIZE; exports.curveLut = curveLut; exports.STROKE_CHAMFER_MAX = STROKE_CHAMFER_MAX; exports.contourLut = contourLut; exports.activeEffectItems = activeEffectItems; exports.effectsAreLocal = effectsAreLocal; exports.buildEffectMaps = buildEffectMaps; exports.gradientT = gradientT; exports.compositeLayerEffects = compositeLayerEffects; exports.renderLayerEffects = renderLayerEffects; exports.blendTile = blendTile; exports.RasterCompositor = RasterCompositor; exports.changedTiles = changedTiles; exports.ZlibError = ZlibError; exports.inflateRaw = inflateRaw; exports.adler32 = adler32; exports.inflate = inflate; exports.deflateRaw = deflateRaw; exports.deflate = deflate; exports.encodePng = encodePng; exports.isPng = isPng; exports.decodePng = decodePng; exports.bytesToBase64 = bytesToBase64; exports.base64ToBytes = base64ToBytes; exports.parseDataUrl = parseDataUrl; exports.pngDataUrl = pngDataUrl;
3685
- //# sourceMappingURL=chunk-73L6TROJ.cjs.map
3695
+ //# sourceMappingURL=chunk-T6H3JDGA.cjs.map