pxt-arcade 1.8.10 → 1.8.14

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.
@@ -1007,8 +1007,8 @@ declare namespace pxsim.ImageMethods {
1007
1007
  function _fillCircle(img: RefImage, cxy: number, r: number, c: number): void;
1008
1008
  function _blitRow(img: RefImage, xy: number, from: RefImage, xh: number): void;
1009
1009
  function blitRow(img: RefImage, x: number, y: number, from: RefImage, fromX: number, fromH: number): void;
1010
- function _blit(img: RefImage, src: RefImage, args: RefCollection): void;
1011
- function blit(dst: RefImage, src: RefImage, args: RefCollection): void;
1010
+ function _blit(img: RefImage, src: RefImage, args: RefCollection): boolean;
1011
+ function blit(dst: RefImage, src: RefImage, args: RefCollection): boolean;
1012
1012
  }
1013
1013
  declare namespace pxsim.image {
1014
1014
  function byteHeight(h: number, bpp: number): number;
@@ -3905,7 +3905,7 @@ var pxsim;
3905
3905
  }
3906
3906
  ImageMethods.blitRow = blitRow;
3907
3907
  function _blit(img, src, args) {
3908
- blit(img, src, args);
3908
+ return blit(img, src, args);
3909
3909
  }
3910
3910
  ImageMethods._blit = _blit;
3911
3911
  function blit(dst, src, args) {
@@ -3918,6 +3918,7 @@ var pxsim;
3918
3918
  const wSrc = args.getAt(6);
3919
3919
  const hSrc = args.getAt(7);
3920
3920
  const transparent = args.getAt(8);
3921
+ const check = args.getAt(9);
3921
3922
  const xSrcStep = ((wSrc << 16) / wDst) | 0;
3922
3923
  const ySrcStep = ((hSrc << 16) / hDst) | 0;
3923
3924
  const xDstClip = Math.abs(Math.min(0, xDst));
@@ -3930,16 +3931,26 @@ var pxsim;
3930
3931
  const ySrcStart = Math.max(0, (ySrc << 16) + yDstClip * ySrcStep);
3931
3932
  const xSrcEnd = Math.min(src._width, xSrc + wSrc) << 16;
3932
3933
  const ySrcEnd = Math.min(src._height, ySrc + hSrc) << 16;
3934
+ if (!check)
3935
+ dst.makeWritable();
3933
3936
  for (let yDstCur = yDstStart, ySrcCur = ySrcStart; yDstCur < yDstEnd && ySrcCur < ySrcEnd; ++yDstCur, ySrcCur += ySrcStep) {
3934
3937
  const ySrcCurI = ySrcCur >> 16;
3935
3938
  for (let xDstCur = xDstStart, xSrcCur = xSrcStart; xDstCur < xDstEnd && xSrcCur < xSrcEnd; ++xDstCur, xSrcCur += xSrcStep) {
3936
3939
  const xSrcCurI = xSrcCur >> 16;
3937
3940
  const cSrc = getPixel(src, xSrcCurI, ySrcCurI);
3941
+ if (check && cSrc) {
3942
+ const cDst = getPixel(dst, xDstCur, yDstCur);
3943
+ if (cDst) {
3944
+ return true;
3945
+ }
3946
+ continue;
3947
+ }
3938
3948
  if (!transparent || cSrc) {
3939
3949
  setPixel(dst, xDstCur, yDstCur, cSrc);
3940
3950
  }
3941
3951
  }
3942
3952
  }
3953
+ return false;
3943
3954
  }
3944
3955
  ImageMethods.blit = blit;
3945
3956
  })(ImageMethods = pxsim.ImageMethods || (pxsim.ImageMethods = {}));
package/built/sim.js CHANGED
@@ -1787,7 +1787,7 @@ var pxsim;
1787
1787
  }
1788
1788
  ImageMethods.blitRow = blitRow;
1789
1789
  function _blit(img, src, args) {
1790
- blit(img, src, args);
1790
+ return blit(img, src, args);
1791
1791
  }
1792
1792
  ImageMethods._blit = _blit;
1793
1793
  function blit(dst, src, args) {
@@ -1800,6 +1800,7 @@ var pxsim;
1800
1800
  const wSrc = args.getAt(6);
1801
1801
  const hSrc = args.getAt(7);
1802
1802
  const transparent = args.getAt(8);
1803
+ const check = args.getAt(9);
1803
1804
  const xSrcStep = ((wSrc << 16) / wDst) | 0;
1804
1805
  const ySrcStep = ((hSrc << 16) / hDst) | 0;
1805
1806
  const xDstClip = Math.abs(Math.min(0, xDst));
@@ -1812,16 +1813,26 @@ var pxsim;
1812
1813
  const ySrcStart = Math.max(0, (ySrc << 16) + yDstClip * ySrcStep);
1813
1814
  const xSrcEnd = Math.min(src._width, xSrc + wSrc) << 16;
1814
1815
  const ySrcEnd = Math.min(src._height, ySrc + hSrc) << 16;
1816
+ if (!check)
1817
+ dst.makeWritable();
1815
1818
  for (let yDstCur = yDstStart, ySrcCur = ySrcStart; yDstCur < yDstEnd && ySrcCur < ySrcEnd; ++yDstCur, ySrcCur += ySrcStep) {
1816
1819
  const ySrcCurI = ySrcCur >> 16;
1817
1820
  for (let xDstCur = xDstStart, xSrcCur = xSrcStart; xDstCur < xDstEnd && xSrcCur < xSrcEnd; ++xDstCur, xSrcCur += xSrcStep) {
1818
1821
  const xSrcCurI = xSrcCur >> 16;
1819
1822
  const cSrc = getPixel(src, xSrcCurI, ySrcCurI);
1823
+ if (check && cSrc) {
1824
+ const cDst = getPixel(dst, xDstCur, yDstCur);
1825
+ if (cDst) {
1826
+ return true;
1827
+ }
1828
+ continue;
1829
+ }
1820
1830
  if (!transparent || cSrc) {
1821
1831
  setPixel(dst, xDstCur, yDstCur, cSrc);
1822
1832
  }
1823
1833
  }
1824
1834
  }
1835
+ return false;
1825
1836
  }
1826
1837
  ImageMethods.blit = blit;
1827
1838
  })(ImageMethods = pxsim.ImageMethods || (pxsim.ImageMethods = {}));
@@ -6,6 +6,7 @@
6
6
  "A sprite with path projection": "A sprite with path projection",
7
7
  "A thermometer driver": "A thermometer driver",
8
8
  "Adafruit Feather pinout": "Adafruit Feather pinout",
9
+ "Additional scaling blocks for sprites": "Additional scaling blocks for sprites",
9
10
  "Adds new blocks for message communication in the radio category": "Adds new blocks for message communication in the radio category",
10
11
  "Advanced Livestream": "Advanced Livestream",
11
12
  "Advanced state based animations for sprites": "Advanced state based animations for sprites",