pixel-data-js 0.33.0 → 0.34.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.
@@ -170,6 +170,7 @@ __export(src_exports, {
170
170
  makePaintAlphaMask: () => makePaintAlphaMask,
171
171
  makePaintBinaryMask: () => makePaintBinaryMask,
172
172
  makePaintCursorRenderer: () => makePaintCursorRenderer,
173
+ makePaintRect: () => makePaintRect,
173
174
  makePerfectBlendModeRegistry: () => makePerfectBlendModeRegistry,
174
175
  makePixelCanvas: () => makePixelCanvas,
175
176
  makePixelData: () => makePixelData,
@@ -5450,7 +5451,7 @@ var AlphaMaskPaintBuffer = class {
5450
5451
  });
5451
5452
  return changed;
5452
5453
  }
5453
- paintRect(alpha, brushWidth, brushHeight, x0, y0, x1 = x0, y1 = y0) {
5454
+ paintRect(alpha, brush, x0, y0, x1 = x0, y1 = y0) {
5454
5455
  const scratch = this.scratchBounds;
5455
5456
  const lookup = this.lookup;
5456
5457
  const tilePool = this.tilePool;
@@ -5458,8 +5459,10 @@ var AlphaMaskPaintBuffer = class {
5458
5459
  const tileShift = config.tileShift;
5459
5460
  const tileMask = config.tileMask;
5460
5461
  const target = config.target;
5461
- const centerOffsetX = -(brushWidth - 1 >> 1);
5462
- const centerOffsetY = -(brushHeight - 1 >> 1);
5462
+ const brushWidth = brush.w;
5463
+ const brushHeight = brush.h;
5464
+ const centerOffsetX = brush.centerOffsetX;
5465
+ const centerOffsetY = brush.centerOffsetY;
5463
5466
  const trimRectBoundsFn = this.trimRectBoundsFn;
5464
5467
  const eachTileInBoundsFn = this.eachTileInBoundsFn;
5465
5468
  let changed = false;
@@ -5559,7 +5562,7 @@ var BinaryMaskPaintBuffer = class {
5559
5562
  });
5560
5563
  return changed;
5561
5564
  }
5562
- paintRect(brushWidth, brushHeight, x0, y0, x1 = x0, y1 = y0) {
5565
+ paintRect(brush, x0, y0, x1 = x0, y1 = y0) {
5563
5566
  const scratch = this.scratchBounds;
5564
5567
  const lookup = this.lookup;
5565
5568
  const tilePool = this.tilePool;
@@ -5567,8 +5570,10 @@ var BinaryMaskPaintBuffer = class {
5567
5570
  const tileShift = config.tileShift;
5568
5571
  const tileMask = config.tileMask;
5569
5572
  const target = config.target;
5570
- const centerOffsetX = -(brushWidth - 1 >> 1);
5571
- const centerOffsetY = -(brushHeight - 1 >> 1);
5573
+ const brushWidth = brush.w;
5574
+ const brushHeight = brush.h;
5575
+ const centerOffsetX = brush.centerOffsetX;
5576
+ const centerOffsetY = brush.centerOffsetY;
5572
5577
  const trimRectBoundsFn = this.trimRectBoundsFn;
5573
5578
  const eachTileInBoundsFn = this.eachTileInBoundsFn;
5574
5579
  let changed = false;
@@ -5719,7 +5724,7 @@ var ColorPaintBuffer = class {
5719
5724
  });
5720
5725
  return changed;
5721
5726
  }
5722
- paintRect(color, brushWidth, brushHeight, x0, y0, x1 = x0, y1 = y0) {
5727
+ paintRect(color, brush, x0, y0, x1 = x0, y1 = y0) {
5723
5728
  const alphaIsZero = color >>> 24 === 0;
5724
5729
  if (alphaIsZero) return false;
5725
5730
  const scratch = this.scratchBounds;
@@ -5729,8 +5734,10 @@ var ColorPaintBuffer = class {
5729
5734
  const tileShift = config.tileShift;
5730
5735
  const tileMask = config.tileMask;
5731
5736
  const target = config.target;
5732
- const centerOffsetX = -(brushWidth - 1 >> 1);
5733
- const centerOffsetY = -(brushHeight - 1 >> 1);
5737
+ const brushWidth = brush.w;
5738
+ const brushHeight = brush.h;
5739
+ const centerOffsetX = brush.centerOffsetX;
5740
+ const centerOffsetY = brush.centerOffsetY;
5734
5741
  let changed = false;
5735
5742
  forEachLinePoint(x0, y0, x1, y1, (px, py) => {
5736
5743
  const topLeftX = Math.floor(px + centerOffsetX);
@@ -6153,6 +6160,16 @@ function makeRectFalloffPaintAlphaMask(width, height, fallOff = (d) => d) {
6153
6160
  };
6154
6161
  }
6155
6162
 
6163
+ // src/Paint/PaintRect.ts
6164
+ function makePaintRect(w, h) {
6165
+ return {
6166
+ w,
6167
+ h,
6168
+ centerOffsetX: -(w - 1 >> 1),
6169
+ centerOffsetY: -(h - 1 >> 1)
6170
+ };
6171
+ }
6172
+
6156
6173
  // src/PixelData/ReusablePixelData.ts
6157
6174
  function makeReusablePixelData() {
6158
6175
  const pixelData = {
@@ -6902,6 +6919,7 @@ function writePixelData(target, source, x = 0, y = 0) {
6902
6919
  makePaintAlphaMask,
6903
6920
  makePaintBinaryMask,
6904
6921
  makePaintCursorRenderer,
6922
+ makePaintRect,
6905
6923
  makePerfectBlendModeRegistry,
6906
6924
  makePixelCanvas,
6907
6925
  makePixelData,