@pixerate/editor 0.151.0 → 0.152.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.
|
@@ -540,9 +540,13 @@ export declare class PaintEditorController {
|
|
|
540
540
|
private readStrokePaint;
|
|
541
541
|
setSecondaryColor(color: string): string;
|
|
542
542
|
swapColors(): void;
|
|
543
|
-
/**
|
|
543
|
+
/**
|
|
544
|
+
* The colour at a document pixel: of the composite or of one layer. The composite includes the
|
|
545
|
+
* paper unless `paper` is false, so a pick where nothing is painted comes back with alpha 0.
|
|
546
|
+
*/
|
|
544
547
|
pickColor(x: number, y: number, options?: {
|
|
545
548
|
layerId?: string;
|
|
549
|
+
paper?: boolean;
|
|
546
550
|
}): {
|
|
547
551
|
color: string;
|
|
548
552
|
alpha: number;
|
|
@@ -753,10 +757,12 @@ export declare class PaintEditorController {
|
|
|
753
757
|
/**
|
|
754
758
|
* Composites the viewport stack (paper, view-only underlays, layers with the live stroke) tile by
|
|
755
759
|
* tile over `rect`, calling `onTile` with each 256 px tile's RGBA (cached: unchanged tiles come back
|
|
756
|
-
* as the same buffer). Pass `takeDirty()` as `dirty`.
|
|
760
|
+
* as the same buffer). Pass `takeDirty()` as `dirty`. With `paper: false` the paper is left out and
|
|
761
|
+
* unpainted pixels stay transparent, for a host that draws the paint over its own surface.
|
|
757
762
|
*/
|
|
758
763
|
compositeTiles(rect: RasterRect, onTile: (tx: number, ty: number, data: Uint8ClampedArray, changed: boolean) => void, options?: {
|
|
759
764
|
dirty?: RasterRect[] | 'all';
|
|
765
|
+
paper?: boolean;
|
|
760
766
|
}): void;
|
|
761
767
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
762
768
|
compositePixels(options?: RenderOptions): PixelImage;
|
|
@@ -540,9 +540,13 @@ export declare class PaintEditorController {
|
|
|
540
540
|
private readStrokePaint;
|
|
541
541
|
setSecondaryColor(color: string): string;
|
|
542
542
|
swapColors(): void;
|
|
543
|
-
/**
|
|
543
|
+
/**
|
|
544
|
+
* The colour at a document pixel: of the composite or of one layer. The composite includes the
|
|
545
|
+
* paper unless `paper` is false, so a pick where nothing is painted comes back with alpha 0.
|
|
546
|
+
*/
|
|
544
547
|
pickColor(x: number, y: number, options?: {
|
|
545
548
|
layerId?: string;
|
|
549
|
+
paper?: boolean;
|
|
546
550
|
}): {
|
|
547
551
|
color: string;
|
|
548
552
|
alpha: number;
|
|
@@ -753,10 +757,12 @@ export declare class PaintEditorController {
|
|
|
753
757
|
/**
|
|
754
758
|
* Composites the viewport stack (paper, view-only underlays, layers with the live stroke) tile by
|
|
755
759
|
* tile over `rect`, calling `onTile` with each 256 px tile's RGBA (cached: unchanged tiles come back
|
|
756
|
-
* as the same buffer). Pass `takeDirty()` as `dirty`.
|
|
760
|
+
* as the same buffer). Pass `takeDirty()` as `dirty`. With `paper: false` the paper is left out and
|
|
761
|
+
* unpainted pixels stay transparent, for a host that draws the paint over its own surface.
|
|
757
762
|
*/
|
|
758
763
|
compositeTiles(rect: RasterRect, onTile: (tx: number, ty: number, data: Uint8ClampedArray, changed: boolean) => void, options?: {
|
|
759
764
|
dirty?: RasterRect[] | 'all';
|
|
765
|
+
paper?: boolean;
|
|
760
766
|
}): void;
|
|
761
767
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
762
768
|
compositePixels(options?: RenderOptions): PixelImage;
|
|
@@ -4332,7 +4332,10 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4332
4332
|
[this.color, this.secondaryColor] = [this.secondaryColor, this.color];
|
|
4333
4333
|
this.emit([]);
|
|
4334
4334
|
}
|
|
4335
|
-
/**
|
|
4335
|
+
/**
|
|
4336
|
+
* The colour at a document pixel: of the composite or of one layer. The composite includes the
|
|
4337
|
+
* paper unless `paper` is false, so a pick where nothing is painted comes back with alpha 0.
|
|
4338
|
+
*/
|
|
4336
4339
|
pickColor(x, y, options = {}) {
|
|
4337
4340
|
const { width, height } = this.doc.canvas;
|
|
4338
4341
|
const px = Math.floor(x);
|
|
@@ -4344,7 +4347,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4344
4347
|
const [r, g, b, a] = _chunkCWM3CUUXcjs.readPixel.call(void 0, l.surface, px - l.offset.x, py - l.offset.y);
|
|
4345
4348
|
return { color: rgbToHex(r, g, b), alpha: Math.round(a / 255 * 1e3) / 1e3 };
|
|
4346
4349
|
}
|
|
4347
|
-
const d = this.exportCompositor.composite(this.renderLayers({}), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
4350
|
+
const d = this.exportCompositor.composite(this.renderLayers({ paper: options.paper }), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
4348
4351
|
return { color: rgbToHex(d[0], d[1], d[2]), alpha: Math.round(d[3] / 255 * 1e3) / 1e3 };
|
|
4349
4352
|
}
|
|
4350
4353
|
// --- Mixer Brush ---------------------------------------------------------------
|
|
@@ -5075,11 +5078,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5075
5078
|
/**
|
|
5076
5079
|
* Composites the viewport stack (paper, view-only underlays, layers with the live stroke) tile by
|
|
5077
5080
|
* tile over `rect`, calling `onTile` with each 256 px tile's RGBA (cached: unchanged tiles come back
|
|
5078
|
-
* as the same buffer). Pass `takeDirty()` as `dirty`.
|
|
5081
|
+
* as the same buffer). Pass `takeDirty()` as `dirty`. With `paper: false` the paper is left out and
|
|
5082
|
+
* unpainted pixels stay transparent, for a host that draws the paint over its own surface.
|
|
5079
5083
|
*/
|
|
5080
5084
|
compositeTiles(rect, onTile, options = {}) {
|
|
5081
5085
|
const dirty = options.dirty === "all" ? void 0 : options.dirty;
|
|
5082
|
-
this.viewCompositor.compositeTiles(this.renderLayers({}, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _261 => _261.live, 'optionalAccess', _262 => _262.layerId]), () => ( this.doc.activeLayerId)) });
|
|
5086
|
+
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _261 => _261.live, 'optionalAccess', _262 => _262.layerId]), () => ( this.doc.activeLayerId)) });
|
|
5083
5087
|
}
|
|
5084
5088
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
5085
5089
|
compositePixels(options = {}) {
|
|
@@ -4332,7 +4332,10 @@ var PaintEditorController = class _PaintEditorController {
|
|
|
4332
4332
|
[this.color, this.secondaryColor] = [this.secondaryColor, this.color];
|
|
4333
4333
|
this.emit([]);
|
|
4334
4334
|
}
|
|
4335
|
-
/**
|
|
4335
|
+
/**
|
|
4336
|
+
* The colour at a document pixel: of the composite or of one layer. The composite includes the
|
|
4337
|
+
* paper unless `paper` is false, so a pick where nothing is painted comes back with alpha 0.
|
|
4338
|
+
*/
|
|
4336
4339
|
pickColor(x, y, options = {}) {
|
|
4337
4340
|
const { width, height } = this.doc.canvas;
|
|
4338
4341
|
const px = Math.floor(x);
|
|
@@ -4344,7 +4347,7 @@ var PaintEditorController = class _PaintEditorController {
|
|
|
4344
4347
|
const [r, g, b, a] = readPixel(l.surface, px - l.offset.x, py - l.offset.y);
|
|
4345
4348
|
return { color: rgbToHex(r, g, b), alpha: Math.round(a / 255 * 1e3) / 1e3 };
|
|
4346
4349
|
}
|
|
4347
|
-
const d = this.exportCompositor.composite(this.renderLayers({}), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
4350
|
+
const d = this.exportCompositor.composite(this.renderLayers({ paper: options.paper }), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
4348
4351
|
return { color: rgbToHex(d[0], d[1], d[2]), alpha: Math.round(d[3] / 255 * 1e3) / 1e3 };
|
|
4349
4352
|
}
|
|
4350
4353
|
// --- Mixer Brush ---------------------------------------------------------------
|
|
@@ -5075,11 +5078,12 @@ var PaintEditorController = class _PaintEditorController {
|
|
|
5075
5078
|
/**
|
|
5076
5079
|
* Composites the viewport stack (paper, view-only underlays, layers with the live stroke) tile by
|
|
5077
5080
|
* tile over `rect`, calling `onTile` with each 256 px tile's RGBA (cached: unchanged tiles come back
|
|
5078
|
-
* as the same buffer). Pass `takeDirty()` as `dirty`.
|
|
5081
|
+
* as the same buffer). Pass `takeDirty()` as `dirty`. With `paper: false` the paper is left out and
|
|
5082
|
+
* unpainted pixels stay transparent, for a host that draws the paint over its own surface.
|
|
5079
5083
|
*/
|
|
5080
5084
|
compositeTiles(rect, onTile, options = {}) {
|
|
5081
5085
|
const dirty = options.dirty === "all" ? void 0 : options.dirty;
|
|
5082
|
-
this.viewCompositor.compositeTiles(this.renderLayers({}, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: this.live?.layerId ?? this.doc.activeLayerId });
|
|
5086
|
+
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: this.live?.layerId ?? this.doc.activeLayerId });
|
|
5083
5087
|
}
|
|
5084
5088
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
5085
5089
|
compositePixels(options = {}) {
|