pixel-data-js 0.20.0 → 0.21.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-data-js",
3
3
  "type": "module",
4
- "version": "0.20.0",
4
+ "version": "0.21.0",
5
5
  "packageManager": "pnpm@10.30.0",
6
6
  "description": "JS Pixel and ImageData operations",
7
7
  "author": {
@@ -1,4 +1,4 @@
1
- import type { Color32, HistoryMutator, Rect } from '../../_types'
1
+ import type { BinaryMaskRect, Color32, HistoryMutator } from '../../_types'
2
2
  import { fillPixelData } from '../../PixelData/fillPixelData'
3
3
  import { PixelWriter } from '../PixelWriter'
4
4
 
@@ -12,16 +12,17 @@ export const mutatorClear = ((writer: PixelWriter<any>, deps: Deps = defaults) =
12
12
 
13
13
  return {
14
14
  clear(
15
- rect: Partial<Rect> = {},
15
+ rect: Partial<BinaryMaskRect> = {},
16
16
  ) {
17
17
  const {
18
18
  x = 0,
19
19
  y = 0,
20
20
  w = writer.target.width,
21
21
  h = writer.target.height,
22
+ mask = undefined,
22
23
  } = rect
23
24
  writer.accumulator.storeRegionBeforeState(x, y, w, h)
24
- fillPixelData(writer.target, 0 as Color32, x, y, w, h)
25
+ fillPixelData(writer.target, 0 as Color32, x, y, w, h, mask)
25
26
  },
26
27
  }
27
28
  }) satisfies HistoryMutator<any, Deps>
@@ -1,4 +1,4 @@
1
- import type { Color32, HistoryMutator, Rect } from '../../_types'
1
+ import type { BinaryMaskRect, Color32, HistoryMutator } from '../../_types'
2
2
  import { fillPixelData } from '../../PixelData/fillPixelData'
3
3
  import { PixelWriter } from '../PixelWriter'
4
4
 
@@ -12,16 +12,17 @@ export const mutatorFill = ((writer: PixelWriter<any>, deps: Deps = defaults) =>
12
12
  return {
13
13
  fill(
14
14
  color: Color32,
15
- rect: Partial<Rect> = {},
15
+ rect: Partial<BinaryMaskRect> = {},
16
16
  ) {
17
17
  const {
18
18
  x = 0,
19
19
  y = 0,
20
20
  w = writer.target.width,
21
21
  h = writer.target.height,
22
+ mask = undefined,
22
23
  } = rect
23
24
  writer.accumulator.storeRegionBeforeState(x, y, w, h)
24
- fillPixelData(writer.target, color, x, y, w, h)
25
+ fillPixelData(writer.target, color, x, y, w, h, mask)
25
26
  },
26
27
  }
27
28
  }) satisfies HistoryMutator<any, Deps>
@@ -1,4 +1,4 @@
1
- import type { Color32, IPixelData, Rect } from '../_types'
1
+ import type { BinaryMaskRect, Color32, IPixelData } from '../_types'
2
2
  import { fillPixelData } from './fillPixelData'
3
3
 
4
4
  /**
@@ -7,7 +7,7 @@ import { fillPixelData } from './fillPixelData'
7
7
  */
8
8
  export function clearPixelData(
9
9
  dst: IPixelData,
10
- rect?: Partial<Rect>,
10
+ rect?: Partial<BinaryMaskRect>,
11
11
  ): void {
12
12
  fillPixelData(dst, 0 as Color32, rect)
13
13
  }