@pixerate/editor 0.93.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 +3 -0
- package/dist/{chunk-ZOOEX3WT.cjs → chunk-CRMAXIUV.cjs} +369 -7
- package/dist/chunk-CRMAXIUV.cjs.map +1 -0
- package/dist/chunk-E2ILRYTJ.js +3695 -0
- 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-T6H3JDGA.cjs +3695 -0
- 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 +1252 -588
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +164 -34
- package/dist/image-editor/index.d.ts +164 -34
- package/dist/image-editor/index.js +913 -249
- 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 +83 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +99 -348
- package/dist/raster/index.d.ts +99 -348
- package/dist/raster/index.js +83 -3
- package/dist/{surface-fJhkmNQn.d.cts → surface-CgAiXVI3.d.cts} +23 -11
- package/dist/{surface-fJhkmNQn.d.ts → surface-CgAiXVI3.d.ts} +23 -11
- package/dist/zlib-B3LIoxF-.d.cts +796 -0
- package/dist/zlib-eiTEEj1z.d.ts +796 -0
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +82 -7
- package/dist/chunk-4F3YDIWW.cjs.map +0 -1
- package/dist/chunk-D4ZCU72J.js.map +0 -1
- package/dist/chunk-H543GD6T.cjs +0 -1696
- package/dist/chunk-H543GD6T.cjs.map +0 -1
- package/dist/chunk-ISDCJHTO.js.map +0 -1
- package/dist/chunk-P5TPUNBZ.js +0 -1696
- package/dist/chunk-P5TPUNBZ.js.map +0 -1
- package/dist/chunk-ZOOEX3WT.cjs.map +0 -1
|
@@ -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 };
|
|
@@ -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 };
|