pixel-data-js 0.34.0 → 0.35.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/dist/index.prod.cjs +31 -25
- package/dist/index.prod.cjs.map +1 -1
- package/dist/index.prod.d.ts +7 -3
- package/dist/index.prod.js +31 -25
- package/dist/index.prod.js.map +1 -1
- package/package.json +1 -1
- package/src/Paint/PaintRect.ts +4 -1
- package/src/Paint/Render/PaintCursorRenderer.ts +31 -28
- package/src/Paint/_paint-types.ts +5 -0
package/dist/index.prod.d.ts
CHANGED
|
@@ -1051,11 +1051,15 @@ interface PaintAlphaMask<T extends PaintMaskOutline = PaintMaskOutline> extends
|
|
|
1051
1051
|
interface PaintBinaryMask<T extends PaintMaskOutline = PaintMaskOutline> extends BasePaintMask<T>, BinaryMask {
|
|
1052
1052
|
}
|
|
1053
1053
|
type PaintMask = PaintAlphaMask<any> | PaintBinaryMask<any>;
|
|
1054
|
+
type PaintBrush = PaintMask | PaintRect;
|
|
1054
1055
|
interface PaintRect {
|
|
1056
|
+
type: null;
|
|
1057
|
+
readonly outlineType: PaintMaskOutline.RECT;
|
|
1055
1058
|
w: number;
|
|
1056
1059
|
h: number;
|
|
1057
1060
|
centerOffsetX: number;
|
|
1058
1061
|
centerOffsetY: number;
|
|
1062
|
+
data: null;
|
|
1059
1063
|
}
|
|
1060
1064
|
|
|
1061
1065
|
/**
|
|
@@ -1804,14 +1808,14 @@ declare function makePaintRect(w: number, h: number): PaintRect;
|
|
|
1804
1808
|
|
|
1805
1809
|
type PaintCursorRenderer = ReturnType<typeof makePaintCursorRenderer>;
|
|
1806
1810
|
declare function makePaintCursorRenderer<T extends HTMLCanvasElement | OffscreenCanvas = OffscreenCanvas>(reusableCanvasFactory?: () => ReusableCanvasFactory<T>): {
|
|
1807
|
-
update: (paintMask?:
|
|
1811
|
+
update: (paintMask?: PaintBrush, scale?: number, color?: Color32, alphaThreshold?: number) => void;
|
|
1808
1812
|
getBounds: (centerX: number, centerY: number) => Rect;
|
|
1809
1813
|
getBoundsScaled: (centerX: number, centerY: number) => Rect;
|
|
1810
1814
|
draw: (drawCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, centerX: number, centerY: number) => void;
|
|
1811
1815
|
getSettings: () => {
|
|
1812
1816
|
color: Color32;
|
|
1813
1817
|
scale: number;
|
|
1814
|
-
|
|
1818
|
+
currentBrush: PaintBrush;
|
|
1815
1819
|
};
|
|
1816
1820
|
};
|
|
1817
1821
|
|
|
@@ -1981,4 +1985,4 @@ declare const makeBinaryMaskTile: TileFactory<BinaryMaskTile>;
|
|
|
1981
1985
|
|
|
1982
1986
|
declare function makePixelTile(id: number, tx: number, ty: number, tileSize: number, tileArea: number): PixelTile;
|
|
1983
1987
|
|
|
1984
|
-
export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BatchedQueue, type BatchedQueueFn, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, ColorPaintBuffer, type ColorPaintBufferCanvasRenderer, type ColorPaintBufferManager, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, _errors as ERRORS, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type ImageDataLike, type IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type MutableAlphaMask, type MutableBinaryMask, type MutableMask, type MutablePixelData32, type NullableBinaryMaskRect, type NullableMaskRect, type PaintAlphaMask, type PaintBinaryMask, type PaintCursorRenderer, type PaintMask, PaintMaskOutline, type PaintRect, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, type PixelCanvas, type PixelData, type PixelData32, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, type PixelTile, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableCanvasFactory, type ReusableImageData, type ReusablePixelData, type SerializedImageData, type Tile, type TileFactory, TilePool, TileType, UnsupportedFormatError, _macro_imageDataToUint32Array, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataMask, blendColorPixelDataPaintAlphaMask, blendColorPixelDataPaintBinaryMask, blendColorPixelDataPaintMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataMask, blendPixelDataPaintBuffer, clearPixelDataFast, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, commitColorPaintBuffer, commitMaskPaintBuffer, copyImageData, copyImageDataLike, copyMask, copyPixelData, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, destinationAtopFast, destinationAtopPerfect, destinationInFast, destinationInPerfect, destinationOutFast, destinationOutPerfect, destinationOverFast, destinationOverPerfect, differenceFast, differencePerfect, divideFast, dividePerfect, eachTileInBounds, exclusionFast, exclusionPerfect, extractImageData, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, getIndexedImageColor, getIndexedImageColorCounts, getRectsBounds, getSupportedPixelFormats, hardLightFast, hardLightPerfect, hardMixFast, hardMixPerfect, imageDataToAlphaMaskBuffer, imageDataToDataUrl, imageDataToImgBlob, imageDataToUint32Array, imgBlobToImageData, indexedImageToAverageColor, indexedImageToImageData, invertAlphaMask, invertBinaryMask, invertImageData, invertPixelData, lerpColor32, lerpColor32Fast, lightenFast, lightenPerfect, lighterFast, lighterPerfect, linearBurnFast, linearBurnPerfect, linearDodgeFast, linearDodgePerfect, linearLightFast, linearLightPerfect, makeAlphaMask, makeAlphaMaskPaintBufferCanvasRenderer, makeAlphaMaskPaintBufferCommitter, makeAlphaMaskPaintBufferManager, makeAlphaMaskTile, makeBatchedQueue, makeBinaryMask, makeBinaryMaskFromAlphaMask, makeBinaryMaskOutline, makeBinaryMaskPaintBufferCanvasRenderer, makeBinaryMaskPaintBufferCommitter, makeBinaryMaskPaintBufferManager, makeBinaryMaskTile, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCanvasPixelDataRenderer, makeCircleBinaryMaskOutline, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeColorPaintBufferCanvasRenderer, makeColorPaintBufferCommitter, makeColorPaintBufferManager, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makeIndexedImage, makeIndexedImageFromImageData, makeIndexedImageFromImageDataRaw, makePaintAlphaMask, makePaintBinaryMask, makePaintCursorRenderer, makePaintRect, makePerfectBlendModeRegistry, makePixelCanvas, makePixelData, makePixelTile, makeRectBinaryMaskOutline, makeRectFalloffPaintAlphaMask, makeRenderQueue, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, makeReusablePixelData, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendColorPaintRect, mutatorBlendMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resamplePixelDataInPlace, resampleUint32Array, resizeImageData, resizePixelData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, setPixelData, softLightFast, softLightPerfect, sourceAtopFast, sourceAtopPerfect, sourceInFast, sourceInPerfect, sourceOutFast, sourceOutPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, uInt32ArrayToPixelData, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelData, writePixelDataBuffer, xorFast, xorPerfect };
|
|
1988
|
+
export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BatchedQueue, type BatchedQueueFn, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, ColorPaintBuffer, type ColorPaintBufferCanvasRenderer, type ColorPaintBufferManager, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, _errors as ERRORS, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type ImageDataLike, type IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type MutableAlphaMask, type MutableBinaryMask, type MutableMask, type MutablePixelData32, type NullableBinaryMaskRect, type NullableMaskRect, type PaintAlphaMask, type PaintBinaryMask, type PaintBrush, type PaintCursorRenderer, type PaintMask, PaintMaskOutline, type PaintRect, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, type PixelCanvas, type PixelData, type PixelData32, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, type PixelTile, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableCanvasFactory, type ReusableImageData, type ReusablePixelData, type SerializedImageData, type Tile, type TileFactory, TilePool, TileType, UnsupportedFormatError, _macro_imageDataToUint32Array, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataMask, blendColorPixelDataPaintAlphaMask, blendColorPixelDataPaintBinaryMask, blendColorPixelDataPaintMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataMask, blendPixelDataPaintBuffer, clearPixelDataFast, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, commitColorPaintBuffer, commitMaskPaintBuffer, copyImageData, copyImageDataLike, copyMask, copyPixelData, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, destinationAtopFast, destinationAtopPerfect, destinationInFast, destinationInPerfect, destinationOutFast, destinationOutPerfect, destinationOverFast, destinationOverPerfect, differenceFast, differencePerfect, divideFast, dividePerfect, eachTileInBounds, exclusionFast, exclusionPerfect, extractImageData, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, getIndexedImageColor, getIndexedImageColorCounts, getRectsBounds, getSupportedPixelFormats, hardLightFast, hardLightPerfect, hardMixFast, hardMixPerfect, imageDataToAlphaMaskBuffer, imageDataToDataUrl, imageDataToImgBlob, imageDataToUint32Array, imgBlobToImageData, indexedImageToAverageColor, indexedImageToImageData, invertAlphaMask, invertBinaryMask, invertImageData, invertPixelData, lerpColor32, lerpColor32Fast, lightenFast, lightenPerfect, lighterFast, lighterPerfect, linearBurnFast, linearBurnPerfect, linearDodgeFast, linearDodgePerfect, linearLightFast, linearLightPerfect, makeAlphaMask, makeAlphaMaskPaintBufferCanvasRenderer, makeAlphaMaskPaintBufferCommitter, makeAlphaMaskPaintBufferManager, makeAlphaMaskTile, makeBatchedQueue, makeBinaryMask, makeBinaryMaskFromAlphaMask, makeBinaryMaskOutline, makeBinaryMaskPaintBufferCanvasRenderer, makeBinaryMaskPaintBufferCommitter, makeBinaryMaskPaintBufferManager, makeBinaryMaskTile, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCanvasPixelDataRenderer, makeCircleBinaryMaskOutline, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeColorPaintBufferCanvasRenderer, makeColorPaintBufferCommitter, makeColorPaintBufferManager, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makeIndexedImage, makeIndexedImageFromImageData, makeIndexedImageFromImageDataRaw, makePaintAlphaMask, makePaintBinaryMask, makePaintCursorRenderer, makePaintRect, makePerfectBlendModeRegistry, makePixelCanvas, makePixelData, makePixelTile, makeRectBinaryMaskOutline, makeRectFalloffPaintAlphaMask, makeRenderQueue, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, makeReusablePixelData, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendColorPaintRect, mutatorBlendMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resamplePixelDataInPlace, resampleUint32Array, resizeImageData, resizePixelData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, setPixelData, softLightFast, softLightPerfect, sourceAtopFast, sourceAtopPerfect, sourceInFast, sourceInPerfect, sourceOutFast, sourceOutPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, uInt32ArrayToPixelData, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelData, writePixelDataBuffer, xorFast, xorPerfect };
|
package/dist/index.prod.js
CHANGED
|
@@ -5896,6 +5896,9 @@ function makeRectFalloffPaintAlphaMask(width, height, fallOff = (d) => d) {
|
|
|
5896
5896
|
// src/Paint/PaintRect.ts
|
|
5897
5897
|
function makePaintRect(w, h) {
|
|
5898
5898
|
return {
|
|
5899
|
+
type: null,
|
|
5900
|
+
outlineType: 2 /* RECT */,
|
|
5901
|
+
data: null,
|
|
5899
5902
|
w,
|
|
5900
5903
|
h,
|
|
5901
5904
|
centerOffsetX: -(w - 1 >> 1),
|
|
@@ -5932,31 +5935,34 @@ function makePaintCursorRenderer(reusableCanvasFactory) {
|
|
|
5932
5935
|
const getPixelData = makeReusablePixelData();
|
|
5933
5936
|
let _color = packColor(0, 255, 255, 255);
|
|
5934
5937
|
let _scale = 1;
|
|
5935
|
-
let
|
|
5936
|
-
type:
|
|
5938
|
+
let currentBrush = {
|
|
5939
|
+
type: null,
|
|
5937
5940
|
outlineType: 2 /* RECT */,
|
|
5938
5941
|
w: 1,
|
|
5939
5942
|
h: 1,
|
|
5940
5943
|
centerOffsetX: -(10 - 1 >> 1),
|
|
5941
|
-
centerOffsetY: -(10 - 1 >> 1)
|
|
5944
|
+
centerOffsetY: -(10 - 1 >> 1),
|
|
5945
|
+
data: null
|
|
5942
5946
|
};
|
|
5943
5947
|
let outline;
|
|
5944
5948
|
function update(paintMask, scale, color, alphaThreshold = 127) {
|
|
5945
|
-
|
|
5949
|
+
currentBrush = paintMask ?? currentBrush;
|
|
5946
5950
|
_scale = scale ?? _scale;
|
|
5947
5951
|
_color = color ?? _color;
|
|
5948
|
-
updateBuffer(
|
|
5949
|
-
if (
|
|
5950
|
-
if (
|
|
5951
|
-
outline = makeCircleBinaryMaskOutline(
|
|
5952
|
-
} else if (
|
|
5953
|
-
outline = makeRectBinaryMaskOutline(
|
|
5954
|
-
} else if (
|
|
5955
|
-
outline = makeBinaryMaskOutline(
|
|
5952
|
+
updateBuffer(currentBrush.w * _scale + 2 * _scale, currentBrush.h * _scale + 2 * _scale);
|
|
5953
|
+
if (currentBrush.type === 1 /* BINARY */) {
|
|
5954
|
+
if (currentBrush.outlineType === 1 /* CIRCLE */) {
|
|
5955
|
+
outline = makeCircleBinaryMaskOutline(currentBrush.w, _scale);
|
|
5956
|
+
} else if (currentBrush.outlineType === 2 /* RECT */) {
|
|
5957
|
+
outline = makeRectBinaryMaskOutline(currentBrush.w, currentBrush.h, _scale);
|
|
5958
|
+
} else if (currentBrush.outlineType === 0 /* MASKED */) {
|
|
5959
|
+
outline = makeBinaryMaskOutline(currentBrush, _scale);
|
|
5956
5960
|
}
|
|
5957
|
-
} else if (
|
|
5958
|
-
const mask = makeBinaryMaskFromAlphaMask(
|
|
5961
|
+
} else if (currentBrush.type === 0 /* ALPHA */) {
|
|
5962
|
+
const mask = makeBinaryMaskFromAlphaMask(currentBrush, alphaThreshold);
|
|
5959
5963
|
outline = makeBinaryMaskOutline(mask, _scale);
|
|
5964
|
+
} else {
|
|
5965
|
+
outline = makeRectBinaryMaskOutline(currentBrush.w, currentBrush.h, _scale);
|
|
5960
5966
|
}
|
|
5961
5967
|
const pixelData = getPixelData(outline.w, outline.h);
|
|
5962
5968
|
fillPixelDataBinaryMask(pixelData, _color, outline);
|
|
@@ -5969,10 +5975,10 @@ function makePaintCursorRenderer(reusableCanvasFactory) {
|
|
|
5969
5975
|
h: 0
|
|
5970
5976
|
};
|
|
5971
5977
|
function getBounds(centerX, centerY) {
|
|
5972
|
-
boundsScratch.x = centerX +
|
|
5973
|
-
boundsScratch.y = centerY +
|
|
5974
|
-
boundsScratch.w =
|
|
5975
|
-
boundsScratch.h =
|
|
5978
|
+
boundsScratch.x = centerX + currentBrush.centerOffsetX;
|
|
5979
|
+
boundsScratch.y = centerY + currentBrush.centerOffsetY;
|
|
5980
|
+
boundsScratch.w = currentBrush.w;
|
|
5981
|
+
boundsScratch.h = currentBrush.h;
|
|
5976
5982
|
return boundsScratch;
|
|
5977
5983
|
}
|
|
5978
5984
|
const boundsScaledScratch = {
|
|
@@ -5982,22 +5988,22 @@ function makePaintCursorRenderer(reusableCanvasFactory) {
|
|
|
5982
5988
|
h: 0
|
|
5983
5989
|
};
|
|
5984
5990
|
function getOutlineBoundsScaled(centerX, centerY) {
|
|
5985
|
-
boundsScaledScratch.x = centerX * _scale +
|
|
5986
|
-
boundsScaledScratch.y = centerY * _scale +
|
|
5987
|
-
boundsScaledScratch.w =
|
|
5988
|
-
boundsScaledScratch.h =
|
|
5991
|
+
boundsScaledScratch.x = centerX * _scale + currentBrush.centerOffsetX * _scale - 1;
|
|
5992
|
+
boundsScaledScratch.y = centerY * _scale + currentBrush.centerOffsetY * _scale - 1;
|
|
5993
|
+
boundsScaledScratch.w = currentBrush.w * _scale;
|
|
5994
|
+
boundsScaledScratch.h = currentBrush.h * _scale;
|
|
5989
5995
|
return boundsScaledScratch;
|
|
5990
5996
|
}
|
|
5991
5997
|
function draw(drawCtx, centerX, centerY) {
|
|
5992
|
-
const dx = centerX * _scale +
|
|
5993
|
-
const dy = centerY * _scale +
|
|
5998
|
+
const dx = centerX * _scale + currentBrush.centerOffsetX * _scale - 1;
|
|
5999
|
+
const dy = centerY * _scale + currentBrush.centerOffsetY * _scale - 1;
|
|
5994
6000
|
drawCtx.drawImage(canvas, Math.floor(dx), Math.floor(dy));
|
|
5995
6001
|
}
|
|
5996
6002
|
function getSettings() {
|
|
5997
6003
|
return {
|
|
5998
6004
|
color: _color,
|
|
5999
6005
|
scale: _scale,
|
|
6000
|
-
|
|
6006
|
+
currentBrush
|
|
6001
6007
|
};
|
|
6002
6008
|
}
|
|
6003
6009
|
return {
|