pixel-data-js 0.15.0 → 0.15.1

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.
@@ -66,6 +66,7 @@ __export(src_exports, {
66
66
  exclusionPerfect: () => exclusionPerfect,
67
67
  extractImageDataBuffer: () => extractImageDataBuffer,
68
68
  extractMask: () => extractMask,
69
+ extractPixelData: () => extractPixelData,
69
70
  extractPixelDataBuffer: () => extractPixelDataBuffer,
70
71
  fileInputChangeToImageData: () => fileInputChangeToImageData,
71
72
  fileToImageData: () => fileToImageData,
@@ -2640,6 +2641,15 @@ function extractPixelDataBuffer(source, _x, _y, _w, _h) {
2640
2641
  return dstData;
2641
2642
  }
2642
2643
 
2644
+ // src/PixelData/extractPixelData.ts
2645
+ function extractPixelData(source, _x, _y, _w, _h) {
2646
+ const { x, y, w, h } = typeof _x === "object" ? _x : { x: _x, y: _y, w: _w, h: _h };
2647
+ const result = new PixelData(new ImageData(w, h));
2648
+ const buffer = extractPixelDataBuffer(source, x, y, w, h);
2649
+ result.data32.set(buffer);
2650
+ return result;
2651
+ }
2652
+
2643
2653
  // src/PixelData/invertPixelData.ts
2644
2654
  function invertPixelData(pixelData) {
2645
2655
  const data32 = pixelData.data32;
@@ -2788,6 +2798,7 @@ function rotateSquareInPlace(pixelData) {
2788
2798
  exclusionPerfect,
2789
2799
  extractImageDataBuffer,
2790
2800
  extractMask,
2801
+ extractPixelData,
2791
2802
  extractPixelDataBuffer,
2792
2803
  fileInputChangeToImageData,
2793
2804
  fileToImageData,