@pixerate/editor 0.207.0 → 0.208.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.
Files changed (69) hide show
  1. package/dist/animation-editor/index.cjs +60 -59
  2. package/dist/animation-editor/index.js +6 -5
  3. package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
  4. package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
  5. package/dist/canvas/index.cjs +8 -8
  6. package/dist/canvas/index.js +1 -1
  7. package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
  8. package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
  9. package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
  10. package/dist/chunk-474IQG74.cjs +384 -0
  11. package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
  12. package/dist/chunk-DWYQPL2A.js +2010 -0
  13. package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
  14. package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
  15. package/dist/chunk-HVVR5PZW.js +384 -0
  16. package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
  17. package/dist/chunk-K6PXS6DO.cjs +102 -0
  18. package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
  19. package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
  20. package/dist/chunk-L3G23N5Y.js +763 -0
  21. package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
  22. package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
  23. package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
  24. package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
  25. package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
  26. package/dist/chunk-QYLWG22N.cjs +763 -0
  27. package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
  28. package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
  29. package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
  30. package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
  31. package/dist/chunk-X4LUGTQX.cjs +2010 -0
  32. package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
  33. package/dist/chunk-ZIF4UJJ6.js +102 -0
  34. package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
  35. package/dist/image-editor/controller.d.cts +28 -3
  36. package/dist/image-editor/controller.d.ts +28 -3
  37. package/dist/image-editor/index.cjs +1726 -3359
  38. package/dist/image-editor/index.js +241 -1874
  39. package/dist/image-editor/selection/index.d.cts +1 -0
  40. package/dist/image-editor/selection/index.d.ts +1 -0
  41. package/dist/image-editor/selection/segment/focus.d.cts +2 -0
  42. package/dist/image-editor/selection/segment/focus.d.ts +2 -0
  43. package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
  44. package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
  45. package/dist/image-editor/selection/segment/sky.d.cts +2 -0
  46. package/dist/image-editor/selection/segment/sky.d.ts +2 -0
  47. package/dist/image-editor/selection/segment/subject.d.cts +2 -1
  48. package/dist/image-editor/selection/segment/subject.d.ts +2 -1
  49. package/dist/image-editor/selection/segment/work.d.cts +5 -0
  50. package/dist/image-editor/selection/segment/work.d.ts +5 -0
  51. package/dist/image-editor/selection/select-and-mask.d.cts +12 -2
  52. package/dist/image-editor/selection/select-and-mask.d.ts +12 -2
  53. package/dist/image-editor/selection/worker.d.cts +126 -0
  54. package/dist/image-editor/selection/worker.d.ts +126 -0
  55. package/dist/image-editor/selection-worker.cjs +14 -0
  56. package/dist/image-editor/selection-worker.d.cts +12 -0
  57. package/dist/image-editor/selection-worker.d.ts +12 -0
  58. package/dist/image-editor/selection-worker.js +14 -0
  59. package/dist/image-editor/types.d.cts +8 -0
  60. package/dist/image-editor/types.d.ts +8 -0
  61. package/dist/paint/index.cjs +6 -5
  62. package/dist/paint/index.js +5 -4
  63. package/dist/paint-editor/index.cjs +394 -390
  64. package/dist/paint-editor/index.js +18 -14
  65. package/dist/raster/index.cjs +22 -18
  66. package/dist/raster/index.js +29 -25
  67. package/dist/vector/index.cjs +986 -985
  68. package/dist/vector/index.js +6 -5
  69. package/package.json +11 -1
@@ -1,3 +1,11 @@
1
+ import {
2
+ TILE,
3
+ TiledSurface,
4
+ emptySurface,
5
+ finishTile,
6
+ tileKey,
7
+ tilesInRect
8
+ } from "./chunk-HVVR5PZW.js";
1
9
  import {
2
10
  deflate,
3
11
  inflate
@@ -708,369 +716,10 @@ function blendImageData(backdrop, source, mode, alpha = 1) {
708
716
  }
709
717
  }
710
718
 
711
- // src/raster/surface.ts
712
- var TILE = 256;
713
- var TILE_SHIFT = 8;
714
- var TILE_PIXELS = TILE * TILE;
715
- var KEY_OFFSET = 1 << 15;
716
- var KEY_SPAN = 1 << 16;
717
- function tileKey(tx, ty) {
718
- return (ty + KEY_OFFSET) * KEY_SPAN + (tx + KEY_OFFSET);
719
- }
720
- function tileCoord(key) {
721
- return { tx: key % KEY_SPAN - KEY_OFFSET, ty: Math.floor(key / KEY_SPAN) - KEY_OFFSET };
722
- }
723
- function tileRect(tx, ty) {
724
- return { x: tx * TILE, y: ty * TILE, width: TILE, height: TILE };
725
- }
726
- var nextSurfaceId = 1;
727
- var TiledSurface = class {
728
- constructor(channels, tiles, defaultValue = 0) {
729
- this.channels = channels;
730
- this.tiles = tiles;
731
- this.defaultValue = defaultValue;
732
- }
733
- channels;
734
- tiles;
735
- defaultValue;
736
- /** Unique per instance: a cache key that changes whenever the pixels can have changed. */
737
- id = nextSurfaceId++;
738
- boundsCache;
739
- /** Bounds of the stored (non-default) tiles, tile-aligned; `null` when there are none. */
740
- get bounds() {
741
- if (this.boundsCache === void 0) this.boundsCache = tileUnion(this.tiles.keys());
742
- return this.boundsCache;
743
- }
744
- get tileCount() {
745
- return this.tiles.size;
746
- }
747
- getTile(tx, ty) {
748
- return this.tiles.get(tileKey(tx, ty));
749
- }
750
- };
751
- function tileUnion(keys) {
752
- let x0 = Infinity;
753
- let y0 = Infinity;
754
- let x1 = -Infinity;
755
- let y1 = -Infinity;
756
- for (const key of keys) {
757
- const { tx, ty } = tileCoord(key);
758
- if (tx < x0) x0 = tx;
759
- if (ty < y0) y0 = ty;
760
- if (tx > x1) x1 = tx;
761
- if (ty > y1) y1 = ty;
762
- }
763
- if (x0 === Infinity) return null;
764
- return { x: x0 * TILE, y: y0 * TILE, width: (x1 - x0 + 1) * TILE, height: (y1 - y0 + 1) * TILE };
765
- }
766
- var uniformTiles = /* @__PURE__ */ new Map();
767
- var UNIFORM_LIMIT = 64;
768
- function packPixel(data, offset, channels) {
769
- return channels === 1 ? data[offset] : (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
770
- }
771
- function uniformTile(channels, value) {
772
- const key = `${channels}:${value}`;
773
- let tile = uniformTiles.get(key);
774
- if (tile) return tile;
775
- const data = new Uint8ClampedArray(TILE_PIXELS * channels);
776
- if (channels === 1) data.fill(value);
777
- else if (value !== 0) {
778
- const r = value >>> 24;
779
- const g = value >>> 16 & 255;
780
- const b = value >>> 8 & 255;
781
- const a = value & 255;
782
- for (let i = 0; i < data.length; i += 4) {
783
- data[i] = r;
784
- data[i + 1] = g;
785
- data[i + 2] = b;
786
- data[i + 3] = a;
787
- }
788
- }
789
- tile = { data, uniform: value };
790
- if (uniformTiles.size >= UNIFORM_LIMIT) uniformTiles.delete(uniformTiles.keys().next().value);
791
- uniformTiles.set(key, tile);
792
- return tile;
793
- }
794
- function packRgba(r, g, b, a) {
795
- return (r << 24 | g << 16 | b << 8 | a) >>> 0;
796
- }
797
- function defaultPacked(channels, defaultValue) {
798
- return channels === 1 ? defaultValue : packRgba(defaultValue, defaultValue, defaultValue, defaultValue);
799
- }
800
- function uniformValue(data, channels) {
801
- if (channels === 1) {
802
- const v = data[0];
803
- for (let i = 1; i < data.length; i++) if (data[i] !== v) return null;
804
- return v;
805
- }
806
- const words = new Uint32Array(data.buffer, data.byteOffset, data.length >> 2);
807
- const w = words[0];
808
- for (let i = 1; i < words.length; i++) if (words[i] !== w) return null;
809
- return packPixel(data, 0, 4);
810
- }
811
- function finishTile(data, channels, defaultValue) {
812
- const u = uniformValue(data, channels);
813
- if (u === null) return { data, uniform: null };
814
- if (u === defaultPacked(channels, defaultValue)) return null;
815
- return uniformTile(channels, u);
816
- }
817
- function emptySurface(channels = 4, defaultValue = 0) {
818
- return new TiledSurface(channels, /* @__PURE__ */ new Map(), defaultValue);
819
- }
820
- function solidSurface(channels, rect, value, defaultValue = 0) {
821
- const bytes = new Uint8ClampedArray(channels);
822
- if (channels === 1) bytes[0] = value;
823
- else {
824
- bytes[0] = value >>> 24;
825
- bytes[1] = value >>> 16 & 255;
826
- bytes[2] = value >>> 8 & 255;
827
- bytes[3] = value & 255;
828
- }
829
- return fillRect(emptySurface(channels, defaultValue), rect, bytes);
830
- }
831
- function surfaceFromPixels(pixels, channels = 4, x = 0, y = 0, defaultValue = 0) {
832
- return writeRegion(emptySurface(channels, defaultValue), { x, y, width: pixels.width, height: pixels.height }, pixels.data);
833
- }
834
- function tilesInRect(rect) {
835
- const out = [];
836
- if (rect.width <= 0 || rect.height <= 0) return out;
837
- const tx0 = Math.floor(rect.x / TILE);
838
- const ty0 = Math.floor(rect.y / TILE);
839
- const tx1 = Math.floor((rect.x + rect.width - 1) / TILE);
840
- const ty1 = Math.floor((rect.y + rect.height - 1) / TILE);
841
- for (let ty = ty0; ty <= ty1; ty++) for (let tx = tx0; tx <= tx1; tx++) out.push({ tx, ty });
842
- return out;
843
- }
844
- function readRegion(surface, rect, out) {
845
- const ch = surface.channels;
846
- const w = rect.width;
847
- const h = rect.height;
848
- const dst = out ?? new Uint8ClampedArray(w * h * ch);
849
- if (surface.defaultValue !== 0) dst.fill(surface.defaultValue);
850
- else if (out) dst.fill(0);
851
- for (const { tx, ty } of tilesInRect(rect)) {
852
- const tile = surface.getTile(tx, ty);
853
- if (!tile) continue;
854
- const ox = tx * TILE;
855
- const oy = ty * TILE;
856
- const x0 = Math.max(rect.x, ox);
857
- const y0 = Math.max(rect.y, oy);
858
- const x1 = Math.min(rect.x + w, ox + TILE);
859
- const y1 = Math.min(rect.y + h, oy + TILE);
860
- const span = (x1 - x0) * ch;
861
- for (let yy = y0; yy < y1; yy++) {
862
- const s = ((yy - oy) * TILE + (x0 - ox)) * ch;
863
- const d = ((yy - rect.y) * w + (x0 - rect.x)) * ch;
864
- dst.set(tile.data.subarray(s, s + span), d);
865
- }
866
- }
867
- return dst;
868
- }
869
- function readPixel(surface, x, y) {
870
- const tile = surface.getTile(Math.floor(x / TILE), Math.floor(y / TILE));
871
- const ch = surface.channels;
872
- if (!tile) return new Array(ch).fill(surface.defaultValue);
873
- const i = ((y & TILE - 1) * TILE + (x & TILE - 1)) * ch;
874
- return Array.from(tile.data.subarray(i, i + ch));
875
- }
876
- function contentBounds(surface) {
877
- const ch = surface.channels;
878
- const def = surface.defaultValue;
879
- let x0 = Infinity;
880
- let y0 = Infinity;
881
- let x1 = -Infinity;
882
- let y1 = -Infinity;
883
- for (const [key, tile] of surface.tiles) {
884
- const { tx, ty } = tileCoord(key);
885
- const ox = tx * TILE;
886
- const oy = ty * TILE;
887
- if (tile.uniform !== null) {
888
- if (ox < x0) x0 = ox;
889
- if (oy < y0) y0 = oy;
890
- if (ox + TILE - 1 > x1) x1 = ox + TILE - 1;
891
- if (oy + TILE - 1 > y1) y1 = oy + TILE - 1;
892
- continue;
893
- }
894
- const d = tile.data;
895
- for (let y = 0; y < TILE; y++) {
896
- let first = -1;
897
- let last = -1;
898
- const row = y * TILE * ch;
899
- for (let x = 0; x < TILE; x++) {
900
- const i = row + x * ch;
901
- let differs = false;
902
- for (let c = 0; c < ch; c++) if (d[i + c] !== def) differs = true;
903
- if (differs) {
904
- if (first < 0) first = x;
905
- last = x;
906
- }
907
- }
908
- if (first < 0) continue;
909
- if (ox + first < x0) x0 = ox + first;
910
- if (ox + last > x1) x1 = ox + last;
911
- if (oy + y < y0) y0 = oy + y;
912
- if (oy + y > y1) y1 = oy + y;
913
- }
914
- }
915
- if (x0 === Infinity) return null;
916
- return { x: x0, y: y0, width: x1 - x0 + 1, height: y1 - y0 + 1 };
917
- }
918
- var SurfaceDraft = class {
919
- constructor(base) {
920
- this.base = base;
921
- }
922
- base;
923
- copies = /* @__PURE__ */ new Map();
924
- get channels() {
925
- return this.base.channels;
926
- }
927
- /** The writable data of tile (tx, ty), copied from the base on first use. */
928
- tile(tx, ty) {
929
- const key = tileKey(tx, ty);
930
- let data = this.copies.get(key);
931
- if (data) return data;
932
- const src = this.base.tiles.get(key);
933
- if (src) data = new Uint8ClampedArray(src.data);
934
- else {
935
- data = new Uint8ClampedArray(TILE_PIXELS * this.base.channels);
936
- if (this.base.defaultValue !== 0) data.fill(this.base.defaultValue);
937
- }
938
- this.copies.set(key, data);
939
- return data;
940
- }
941
- /** Replaces a whole tile with `data` (owned by the draft from now on). */
942
- replace(tx, ty, data) {
943
- this.copies.set(tileKey(tx, ty), data);
944
- }
945
- /** The current data of a tile without copying it (base tile, draft copy or `null` for default). */
946
- peek(tx, ty) {
947
- const key = tileKey(tx, ty);
948
- return this.copies.get(key) ?? this.base.tiles.get(key)?.data ?? null;
949
- }
950
- /** Keys of the tiles changed so far. */
951
- get touched() {
952
- return [...this.copies.keys()];
953
- }
954
- /** A new surface with the draft's tiles; the draft must not be used afterwards. */
955
- commit() {
956
- if (!this.copies.size) return this.base;
957
- const tiles = new Map(this.base.tiles);
958
- const { channels, defaultValue } = this.base;
959
- for (const [key, data] of this.copies) {
960
- const tile = finishTile(data, channels, defaultValue);
961
- if (tile) tiles.set(key, tile);
962
- else tiles.delete(key);
963
- }
964
- return new TiledSurface(channels, tiles, defaultValue);
965
- }
966
- };
967
- function writeRegion(surface, rect, data) {
968
- const ch = surface.channels;
969
- const w = rect.width;
970
- const h = rect.height;
971
- if (w <= 0 || h <= 0) return surface;
972
- if (data.length < w * h * ch) throw new Error(`writeRegion: expected ${w * h * ch} bytes, got ${data.length}`);
973
- const draft = new SurfaceDraft(surface);
974
- const src = data;
975
- const canSubarray = typeof src.subarray === "function";
976
- for (const { tx, ty } of tilesInRect(rect)) {
977
- const ox = tx * TILE;
978
- const oy = ty * TILE;
979
- const x0 = Math.max(rect.x, ox);
980
- const y0 = Math.max(rect.y, oy);
981
- const x1 = Math.min(rect.x + w, ox + TILE);
982
- const y1 = Math.min(rect.y + h, oy + TILE);
983
- const full = x0 === ox && y0 === oy && x1 === ox + TILE && y1 === oy + TILE;
984
- const t = full ? new Uint8ClampedArray(TILE_PIXELS * ch) : draft.tile(tx, ty);
985
- const span = (x1 - x0) * ch;
986
- for (let yy = y0; yy < y1; yy++) {
987
- const s = ((yy - rect.y) * w + (x0 - rect.x)) * ch;
988
- const d = ((yy - oy) * TILE + (x0 - ox)) * ch;
989
- if (canSubarray) t.set(src.subarray(s, s + span), d);
990
- else for (let k = 0; k < span; k++) t[d + k] = src[s + k];
991
- }
992
- if (full) draft.replace(tx, ty, t);
993
- }
994
- return draft.commit();
995
- }
996
- function fillRect(surface, rect, bytes) {
997
- const ch = surface.channels;
998
- if (rect.width <= 0 || rect.height <= 0) return surface;
999
- const tiles = new Map(surface.tiles);
1000
- const draft = new SurfaceDraft(surface);
1001
- const value = packPixel(bytes, 0, ch);
1002
- const isDefault = value === defaultPacked(ch, surface.defaultValue);
1003
- for (const { tx, ty } of tilesInRect(rect)) {
1004
- const ox = tx * TILE;
1005
- const oy = ty * TILE;
1006
- const x0 = Math.max(rect.x, ox);
1007
- const y0 = Math.max(rect.y, oy);
1008
- const x1 = Math.min(rect.x + rect.width, ox + TILE);
1009
- const y1 = Math.min(rect.y + rect.height, oy + TILE);
1010
- const key = tileKey(tx, ty);
1011
- if (x0 === ox && y0 === oy && x1 === ox + TILE && y1 === oy + TILE) {
1012
- if (isDefault) tiles.delete(key);
1013
- else tiles.set(key, uniformTile(ch, value));
1014
- continue;
1015
- }
1016
- const t = draft.tile(tx, ty);
1017
- for (let yy = y0; yy < y1; yy++) {
1018
- let d = ((yy - oy) * TILE + (x0 - ox)) * ch;
1019
- for (let xx = x0; xx < x1; xx++, d += ch) for (let c = 0; c < ch; c++) t[d + c] = bytes[c];
1020
- }
1021
- const tile = finishTile(t, ch, surface.defaultValue);
1022
- if (tile) tiles.set(key, tile);
1023
- else tiles.delete(key);
1024
- }
1025
- return new TiledSurface(ch, tiles, surface.defaultValue);
1026
- }
1027
- function translateSurface(surface, dx, dy) {
1028
- dx = Math.round(dx);
1029
- dy = Math.round(dy);
1030
- if (!dx && !dy) return surface;
1031
- if (dx % TILE === 0 && dy % TILE === 0) {
1032
- const tiles = /* @__PURE__ */ new Map();
1033
- for (const [key, tile] of surface.tiles) {
1034
- const { tx, ty } = tileCoord(key);
1035
- tiles.set(tileKey(tx + dx / TILE, ty + dy / TILE), tile);
1036
- }
1037
- return new TiledSurface(surface.channels, tiles, surface.defaultValue);
1038
- }
1039
- const b = surface.bounds;
1040
- if (!b) return surface;
1041
- const data = readRegion(surface, b);
1042
- return writeRegion(emptySurface(surface.channels, surface.defaultValue), { ...b, x: b.x + dx, y: b.y + dy }, data);
1043
- }
1044
- function surfaceBytes(surface) {
1045
- let n = 0;
1046
- for (const tile of surface.tiles.values()) if (tile.uniform === null) n += tile.data.byteLength;
1047
- return n;
1048
- }
1049
- function collectTiles(surface, into) {
1050
- for (const tile of surface.tiles.values()) if (tile.uniform === null) into.add(tile);
1051
- }
1052
- function surfacesEqual(a, b) {
1053
- if (a === b) return true;
1054
- if (a.channels !== b.channels || a.defaultValue !== b.defaultValue || a.tiles.size !== b.tiles.size) return false;
1055
- for (const [key, ta] of a.tiles) {
1056
- const tb = b.tiles.get(key);
1057
- if (!tb) return false;
1058
- if (ta === tb) continue;
1059
- if (ta.uniform !== null || tb.uniform !== null) {
1060
- if (ta.uniform !== tb.uniform) return false;
1061
- continue;
1062
- }
1063
- const x = ta.data;
1064
- const y = tb.data;
1065
- for (let i = 0; i < x.length; i++) if (x[i] !== y[i]) return false;
1066
- }
1067
- return true;
1068
- }
1069
-
1070
719
  // src/raster/deep.ts
1071
720
  var BIT_DEPTHS = [8, 16, 32];
1072
721
  var isBitDepth = (v) => v === 8 || v === 16 || v === 32;
1073
- var TILE_PIXELS2 = TILE * TILE;
722
+ var TILE_PIXELS = TILE * TILE;
1074
723
  function srgbDecode(v) {
1075
724
  return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
1076
725
  }
@@ -1204,17 +853,17 @@ function tileSamples16(tile, channels, defaultValue = 0) {
1204
853
  if (deep instanceof Uint16Array) return deep;
1205
854
  if (deep instanceof Float32Array) return to16From32(deep, channels);
1206
855
  if (tile) return to16From8(tile.data);
1207
- return new Uint16Array(TILE_PIXELS2 * channels).fill(defaultValue * 257);
856
+ return new Uint16Array(TILE_PIXELS * channels).fill(defaultValue * 257);
1208
857
  }
1209
858
  function tileSamples32(tile, channels, defaultValue = 0) {
1210
859
  const deep = tile?.deep;
1211
860
  if (deep instanceof Float32Array) return deep;
1212
861
  if (deep instanceof Uint16Array) return to32From16(deep, channels);
1213
862
  if (tile) return to32From8(tile.data, channels);
1214
- const out = new Float32Array(TILE_PIXELS2 * channels);
863
+ const out = new Float32Array(TILE_PIXELS * channels);
1215
864
  if (defaultValue) {
1216
865
  if (channels === 1) out.fill(defaultValue / 255);
1217
- else to32From8(new Uint8ClampedArray(TILE_PIXELS2 * 4).fill(defaultValue), 4, out);
866
+ else to32From8(new Uint8ClampedArray(TILE_PIXELS * 4).fill(defaultValue), 4, out);
1218
867
  }
1219
868
  return out;
1220
869
  }
@@ -1273,7 +922,7 @@ function writeDeepRegion(surface, rect, samples) {
1273
922
  const y1 = Math.min(rect.y + h, oy + TILE);
1274
923
  const full = x0 === ox && y0 === oy && x1 === ox + TILE && y1 === oy + TILE;
1275
924
  const base = full ? null : tileSamples(surface.tiles.get(key), ch, depth, surface.defaultValue);
1276
- const t = base ? base.slice() : depth === 16 ? new Uint16Array(TILE_PIXELS2 * ch) : new Float32Array(TILE_PIXELS2 * ch);
925
+ const t = base ? base.slice() : depth === 16 ? new Uint16Array(TILE_PIXELS * ch) : new Float32Array(TILE_PIXELS * ch);
1277
926
  const span = (x1 - x0) * ch;
1278
927
  for (let yy = y0; yy < y1; yy++) {
1279
928
  const s = ((yy - rect.y) * w + (x0 - rect.x)) * ch;
@@ -1679,29 +1328,6 @@ export {
1679
1328
  mixPigment8,
1680
1329
  blendPixel,
1681
1330
  blendImageData,
1682
- TILE,
1683
- TILE_SHIFT,
1684
- tileKey,
1685
- tileCoord,
1686
- tileRect,
1687
- TiledSurface,
1688
- uniformTile,
1689
- packRgba,
1690
- finishTile,
1691
- emptySurface,
1692
- solidSurface,
1693
- surfaceFromPixels,
1694
- tilesInRect,
1695
- readRegion,
1696
- readPixel,
1697
- contentBounds,
1698
- SurfaceDraft,
1699
- writeRegion,
1700
- fillRect,
1701
- translateSurface,
1702
- surfaceBytes,
1703
- collectTiles,
1704
- surfacesEqual,
1705
1331
  BIT_DEPTHS,
1706
1332
  isBitDepth,
1707
1333
  srgbDecode,