pxt-common-packages 9.3.9 → 9.3.13

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 (39) hide show
  1. package/built/common-sim.d.ts +2 -0
  2. package/built/common-sim.js +38 -0
  3. package/libs/azureiot/azureiot.ts +4 -4
  4. package/libs/azureiot/built/debug/binary.js +469 -464
  5. package/libs/color/built/debug/binary.js +8 -8
  6. package/libs/color-sensor/built/debug/binary.js +8 -8
  7. package/libs/controller/built/debug/binary.js +6551 -6551
  8. package/libs/controller---none/built/debug/binary.js +6531 -6531
  9. package/libs/core---vm/vm.cpp +75 -2
  10. package/libs/datalogger/built/debug/binary.js +63 -63
  11. package/libs/edge-connector/built/debug/binary.js +8 -8
  12. package/libs/esp32/built/debug/binary.js +470 -465
  13. package/libs/game/built/debug/binary.js +6470 -6470
  14. package/libs/lcd/built/debug/binary.js +8 -8
  15. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  16. package/libs/lora/built/debug/binary.js +8 -8
  17. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  18. package/libs/mqtt/built/debug/binary.js +176 -176
  19. package/libs/mqtt/mqtt.ts +9 -2
  20. package/libs/net/built/debug/binary.js +176 -176
  21. package/libs/net/controller.ts +15 -1
  22. package/libs/net-game/built/debug/binary.js +8236 -8171
  23. package/libs/palette/built/debug/binary.js +6469 -6469
  24. package/libs/pixel/built/debug/binary.js +8 -8
  25. package/libs/power/built/debug/binary.js +8 -8
  26. package/libs/proximity/built/debug/binary.js +8 -8
  27. package/libs/radio/built/debug/binary.js +8 -8
  28. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  29. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  30. package/libs/screen/_locales/screen-jsdoc-strings.json +1 -0
  31. package/libs/screen/built/debug/binary.js +50 -50
  32. package/libs/screen/image.cpp +45 -0
  33. package/libs/screen/image.ts +26 -0
  34. package/libs/screen/sim/image.ts +42 -0
  35. package/libs/servo/built/debug/binary.js +8 -8
  36. package/libs/storyboard/built/debug/binary.js +6469 -6469
  37. package/libs/wifi---esp32/controller.ts +2 -3
  38. package/libs/wifi---esp32/socket.cpp +4 -2
  39. package/package.json +1 -1
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P55805(s) {
59
+ function _main___P55813(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___56046 = (undefined);
70
- globals._pollEventQueue___56059 = (undefined);
69
+ globals._intervals___56054 = (undefined);
70
+ globals._pollEventQueue___56067 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P55805.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"pxt_modules/light/neopixel.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P55805.continuations = [ ]
75
+ _main___P55813.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"pxt_modules/light/neopixel.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P55813.continuations = [ ]
77
77
 
78
- function _main___P55805_mk(s) {
78
+ function _main___P55813_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P55805, depth: s.depth + 1,
81
+ parent: s, fn: _main___P55813, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P55805_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P55805
91
+ return _main___P55813
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P62647(s) {
59
+ function _main___P62655(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___62888 = (undefined);
70
- globals._pollEventQueue___62901 = (undefined);
69
+ globals._intervals___62896 = (undefined);
70
+ globals._pollEventQueue___62909 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P62647.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"power.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P62647.continuations = [ ]
75
+ _main___P62655.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"power.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P62655.continuations = [ ]
77
77
 
78
- function _main___P62647_mk(s) {
78
+ function _main___P62655_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P62647, depth: s.depth + 1,
81
+ parent: s, fn: _main___P62655, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P62647_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P62647
91
+ return _main___P62655
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P99797(s) {
59
+ function _main___P99813(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___100038 = (undefined);
70
- globals._pollEventQueue___100051 = (undefined);
69
+ globals._intervals___100054 = (undefined);
70
+ globals._pollEventQueue___100067 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P99797.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"vl53l0x.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P99797.continuations = [ ]
75
+ _main___P99813.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"vl53l0x.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P99813.continuations = [ ]
77
77
 
78
- function _main___P99797_mk(s) {
78
+ function _main___P99813_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P99797, depth: s.depth + 1,
81
+ parent: s, fn: _main___P99813, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P99797_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P99797
91
+ return _main___P99813
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P181409(s) {
59
+ function _main___P181498(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___181650 = (undefined);
70
- globals._pollEventQueue___181663 = (undefined);
69
+ globals._intervals___181739 = (undefined);
70
+ globals._pollEventQueue___181752 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P181409.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"targetoverrides.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P181409.continuations = [ ]
75
+ _main___P181498.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"targetoverrides.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P181498.continuations = [ ]
77
77
 
78
- function _main___P181409_mk(s) {
78
+ function _main___P181498_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P181409, depth: s.depth + 1,
81
+ parent: s, fn: _main___P181498, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P181409_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P181409
91
+ return _main___P181498
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P183229(s) {
59
+ function _main___P183318(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___183470 = (undefined);
70
- globals._pollEventQueue___183483 = (undefined);
69
+ globals._intervals___183559 = (undefined);
70
+ globals._pollEventQueue___183572 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P183229.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"radio-broadcast.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P183229.continuations = [ ]
75
+ _main___P183318.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"radio-broadcast.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P183318.continuations = [ ]
77
77
 
78
- function _main___P183229_mk(s) {
78
+ function _main___P183318_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P183229, depth: s.depth + 1,
81
+ parent: s, fn: _main___P183318, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P183229_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P183229
91
+ return _main___P183318
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P165317(s) {
59
+ function _main___P165402(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___165558 = (undefined);
70
- globals._pollEventQueue___165571 = (undefined);
69
+ globals._intervals___165643 = (undefined);
70
+ globals._pollEventQueue___165656 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P165317.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"targetoverrides.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P165317.continuations = [ ]
75
+ _main___P165402.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"targetoverrides.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P165402.continuations = [ ]
77
77
 
78
- function _main___P165317_mk(s) {
78
+ function _main___P165402_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P165317, depth: s.depth + 1,
81
+ parent: s, fn: _main___P165402, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P165317_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P165317
91
+ return _main___P165402
92
92
  })
@@ -1,4 +1,5 @@
1
1
  {
2
+ "Image.blit": "Copy an image from a source rectangle to a destination rectangle, stretching or\ncompressing to fit the dimensions of the destination rectangle, if necessary.",
2
3
  "Image.blitRow": "Scale and copy a row of pixels from a texture.",
3
4
  "Image.clone": "Return a copy of the current image",
4
5
  "Image.copyFrom": "Sets all pixels in the current image from the other image, which has to be of the same size and\nbpp.",
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P50434(s) {
59
+ function _main___P50438(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,29 +66,29 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___50675 = (undefined);
70
- globals._pollEventQueue___50688 = (undefined);
71
- globals.__updated___50914 = (false);
72
- r0 = pxsim.control.runInParallel(control___screen_inline__P50919);
69
+ globals._intervals___50679 = (undefined);
70
+ globals._pollEventQueue___50692 = (undefined);
71
+ globals.__updated___50921 = (false);
72
+ r0 = pxsim.control.runInParallel(control___screen_inline__P50926);
73
73
  r0 = pxsim.image.create(178, 128);
74
- globals.screen___50942 = (r0);
75
- s.tmp_0 = control___screen_setupUpdate__P50916_mk(s);
76
- s.tmp_0.arg0 = _screen_internal_inline__P50947;
74
+ globals.screen___50949 = (r0);
75
+ s.tmp_0 = control___screen_setupUpdate__P50923_mk(s);
76
+ s.tmp_0.arg0 = _screen_internal_inline__P50954;
77
77
  s.callLocIdx = 4; s.pc = 1; return s.tmp_0;
78
78
  case 1:
79
79
  r0 = s.retval;
80
- globals.control_EventContext_onStats___50743 = (_screen_internal_inline__P50952);
80
+ globals.control_EventContext_onStats___50747 = (_screen_internal_inline__P50959);
81
81
  r0 = undefined;
82
82
  return leave(s, r0)
83
83
  default: oops()
84
84
  } } }
85
- _main___P50434.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"imagesoverrides.ts","functionName":"<main>","argumentNames":[]}
86
- _main___P50434.continuations = [ ]
85
+ _main___P50438.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"imagesoverrides.ts","functionName":"<main>","argumentNames":[]}
86
+ _main___P50438.continuations = [ ]
87
87
 
88
- function _main___P50434_mk(s) {
88
+ function _main___P50438_mk(s) {
89
89
  checkStack(s.depth);
90
90
  return {
91
- parent: s, fn: _main___P50434, depth: s.depth + 1,
91
+ parent: s, fn: _main___P50438, depth: s.depth + 1,
92
92
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
93
93
  tmp_0: undefined,
94
94
  } }
@@ -97,7 +97,7 @@ function _main___P50434_mk(s) {
97
97
 
98
98
 
99
99
 
100
- function control___screen_inline__P50919(s) {
100
+ function control___screen_inline__P50926(s) {
101
101
  let r0 = s.r0, step = s.pc;
102
102
  s.pc = -1;
103
103
 
@@ -110,23 +110,23 @@ switch (step) {
110
110
  case 1:
111
111
  r0 = pxsim_numops_toBoolDecr(true);
112
112
  if (!r0) { step = 4; continue; }
113
- globals.__updated___50914 = (false);
114
- s.tmp_0 = pause__P50752_mk(s);
113
+ globals.__updated___50921 = (false);
114
+ s.tmp_0 = pause__P50756_mk(s);
115
115
  s.tmp_0.arg0 = 200;
116
116
  s.callLocIdx = 2; s.pc = 5; return s.tmp_0;
117
117
  case 5:
118
118
  r0 = s.retval;
119
- r0 = pxsim_numops_toBoolDecr(globals.__updated___50914);
119
+ r0 = pxsim_numops_toBoolDecr(globals.__updated___50921);
120
120
  s.tmp_1 = r0;
121
121
  r0 = pxsim_Boolean__bang(s.tmp_1);
122
122
  s.tmp_0 = r0;
123
123
  r0 = pxsim_numops_toBoolDecr(s.tmp_0);
124
124
  if (!r0) { step = 2; continue; }
125
- s.tmp_2 = control___screen_update__P50915_mk(s);
125
+ s.tmp_2 = control___screen_update__P50922_mk(s);
126
126
  s.callLocIdx = 3; s.pc = 6; return s.tmp_2;
127
127
  case 6:
128
128
  r0 = s.retval;
129
- globals.__updated___50914 = (true);
129
+ globals.__updated___50921 = (true);
130
130
  case 2:
131
131
  case 3:
132
132
  { step = 1; continue; }
@@ -135,12 +135,12 @@ switch (step) {
135
135
  return leave(s, r0)
136
136
  default: oops()
137
137
  } } }
138
- control___screen_inline__P50919.info = {"start":396,"length":211,"line":17,"column":26,"endLine":26,"endColumn":5,"fileName":"frame.ts","functionName":"inline","argumentNames":[]}
138
+ control___screen_inline__P50926.info = {"start":396,"length":211,"line":17,"column":26,"endLine":26,"endColumn":5,"fileName":"frame.ts","functionName":"inline","argumentNames":[]}
139
139
 
140
- function control___screen_inline__P50919_mk(s) {
140
+ function control___screen_inline__P50926_mk(s) {
141
141
  checkStack(s.depth);
142
142
  return {
143
- parent: s, fn: control___screen_inline__P50919, depth: s.depth + 1,
143
+ parent: s, fn: control___screen_inline__P50926, depth: s.depth + 1,
144
144
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
145
145
  tmp_0: undefined,
146
146
  tmp_1: undefined,
@@ -151,7 +151,7 @@ function control___screen_inline__P50919_mk(s) {
151
151
 
152
152
 
153
153
 
154
- function _screen_internal_inline__P50947(s) {
154
+ function _screen_internal_inline__P50954(s) {
155
155
  let r0 = s.r0, step = s.pc;
156
156
  s.pc = -1;
157
157
 
@@ -161,17 +161,17 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
161
161
  switch (step) {
162
162
  case 0:
163
163
 
164
- r0 = pxsim_pxtcore.updateScreen(globals.screen___50942);
164
+ r0 = pxsim_pxtcore.updateScreen(globals.screen___50949);
165
165
  r0 = undefined;
166
166
  return leave(s, r0)
167
167
  default: oops()
168
168
  } } }
169
- _screen_internal_inline__P50947.info = {"start":327,"length":26,"line":8,"column":33,"endLine":8,"endColumn":59,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":[]}
169
+ _screen_internal_inline__P50954.info = {"start":327,"length":26,"line":8,"column":33,"endLine":8,"endColumn":59,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":[]}
170
170
 
171
- function _screen_internal_inline__P50947_mk(s) {
171
+ function _screen_internal_inline__P50954_mk(s) {
172
172
  checkStack(s.depth);
173
173
  return {
174
- parent: s, fn: _screen_internal_inline__P50947, depth: s.depth + 1,
174
+ parent: s, fn: _screen_internal_inline__P50954, depth: s.depth + 1,
175
175
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
176
176
  } }
177
177
 
@@ -179,7 +179,7 @@ function _screen_internal_inline__P50947_mk(s) {
179
179
 
180
180
 
181
181
 
182
- function _screen_internal_inline__P50952(s) {
182
+ function _screen_internal_inline__P50959(s) {
183
183
  let r0 = s.r0, step = s.pc;
184
184
  s.pc = -1;
185
185
 
@@ -198,12 +198,12 @@ switch (step) {
198
198
  return leave(s, r0)
199
199
  default: oops()
200
200
  } } }
201
- _screen_internal_inline__P50952.info = {"start":390,"length":56,"line":9,"column":35,"endLine":11,"endColumn":5,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":["msg"]}
201
+ _screen_internal_inline__P50959.info = {"start":390,"length":56,"line":9,"column":35,"endLine":11,"endColumn":5,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":["msg"]}
202
202
 
203
- function _screen_internal_inline__P50952_mk(s) {
203
+ function _screen_internal_inline__P50959_mk(s) {
204
204
  checkStack(s.depth);
205
205
  return {
206
- parent: s, fn: _screen_internal_inline__P50952, depth: s.depth + 1,
206
+ parent: s, fn: _screen_internal_inline__P50959, depth: s.depth + 1,
207
207
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
208
208
  arg0: undefined,
209
209
  } }
@@ -212,7 +212,7 @@ function _screen_internal_inline__P50952_mk(s) {
212
212
 
213
213
 
214
214
 
215
- function control___screen_setupUpdate__P50916(s) {
215
+ function control___screen_setupUpdate__P50923(s) {
216
216
  let r0 = s.r0, step = s.pc;
217
217
  s.pc = -1;
218
218
 
@@ -226,8 +226,8 @@ switch (step) {
226
226
  s.arg0 = (s.lambdaArgs[0]);
227
227
  s.lambdaArgs = null;
228
228
  }
229
- globals.__updated___50914 = (true);
230
- globals.__update___50912 = (s.arg0);
229
+ globals.__updated___50921 = (true);
230
+ globals.__update___50919 = (s.arg0);
231
231
  s.tmp_0 = lambda_1_mk(s);
232
232
  s.tmp_0.argL = s.arg0;
233
233
  setupLambda(s.tmp_0, s.tmp_0.argL);
@@ -238,12 +238,12 @@ switch (step) {
238
238
  return leave(s, r0)
239
239
  default: oops()
240
240
  } } }
241
- control___screen_setupUpdate__P50916.info = {"start":198,"length":125,"line":10,"column":4,"endLine":14,"endColumn":5,"fileName":"frame.ts","functionName":"setupUpdate","argumentNames":["update"]}
241
+ control___screen_setupUpdate__P50923.info = {"start":198,"length":125,"line":10,"column":4,"endLine":14,"endColumn":5,"fileName":"frame.ts","functionName":"setupUpdate","argumentNames":["update"]}
242
242
 
243
- function control___screen_setupUpdate__P50916_mk(s) {
243
+ function control___screen_setupUpdate__P50923_mk(s) {
244
244
  checkStack(s.depth);
245
245
  return {
246
- parent: s, fn: control___screen_setupUpdate__P50916, depth: s.depth + 1,
246
+ parent: s, fn: control___screen_setupUpdate__P50923, depth: s.depth + 1,
247
247
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
248
248
  tmp_0: undefined,
249
249
  arg0: undefined,
@@ -253,7 +253,7 @@ function control___screen_setupUpdate__P50916_mk(s) {
253
253
 
254
254
 
255
255
 
256
- function control___screen_update__P50915(s) {
256
+ function control___screen_update__P50922(s) {
257
257
  let r0 = s.r0, step = s.pc;
258
258
  s.pc = -1;
259
259
 
@@ -263,27 +263,27 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
263
263
  switch (step) {
264
264
  case 0:
265
265
 
266
- r0 = pxsim_numops_toBoolDecr(globals.__update___50912);
266
+ r0 = pxsim_numops_toBoolDecr(globals.__update___50919);
267
267
  if (!r0) { step = 1; continue; }
268
268
  s.tmp_0 = lambda_1_mk(s);
269
- s.tmp_0.argL = globals.__update___50912;
269
+ s.tmp_0.argL = globals.__update___50919;
270
270
  setupLambda(s.tmp_0, s.tmp_0.argL);
271
271
  s.callLocIdx = 0; s.pc = 3; return s.tmp_0;
272
272
  case 3:
273
273
  r0 = s.retval;
274
274
  case 1:
275
275
  case 2:
276
- globals.__updated___50914 = (true);
276
+ globals.__updated___50921 = (true);
277
277
  r0 = undefined;
278
278
  return leave(s, r0)
279
279
  default: oops()
280
280
  } } }
281
- control___screen_update__P50915.info = {"start":90,"length":102,"line":4,"column":4,"endLine":8,"endColumn":5,"fileName":"frame.ts","functionName":"update","argumentNames":[]}
281
+ control___screen_update__P50922.info = {"start":90,"length":102,"line":4,"column":4,"endLine":8,"endColumn":5,"fileName":"frame.ts","functionName":"update","argumentNames":[]}
282
282
 
283
- function control___screen_update__P50915_mk(s) {
283
+ function control___screen_update__P50922_mk(s) {
284
284
  checkStack(s.depth);
285
285
  return {
286
- parent: s, fn: control___screen_update__P50915, depth: s.depth + 1,
286
+ parent: s, fn: control___screen_update__P50922, depth: s.depth + 1,
287
287
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
288
288
  tmp_0: undefined,
289
289
  } }
@@ -292,7 +292,7 @@ function control___screen_update__P50915_mk(s) {
292
292
 
293
293
 
294
294
 
295
- function pause__P50752(s) {
295
+ function pause__P50756(s) {
296
296
  let r0 = s.r0, step = s.pc;
297
297
  s.pc = -1;
298
298
 
@@ -316,12 +316,12 @@ switch (step) {
316
316
  return leave(s, r0)
317
317
  default: oops()
318
318
  } } }
319
- pause__P50752.info = {"start":246,"length":57,"line":7,"column":0,"endLine":9,"endColumn":1,"fileName":"pxt_modules/base/pause.ts","functionName":"pause","argumentNames":["ms"]}
319
+ pause__P50756.info = {"start":246,"length":57,"line":7,"column":0,"endLine":9,"endColumn":1,"fileName":"pxt_modules/base/pause.ts","functionName":"pause","argumentNames":["ms"]}
320
320
 
321
- function pause__P50752_mk(s) {
321
+ function pause__P50756_mk(s) {
322
322
  checkStack(s.depth);
323
323
  return {
324
- parent: s, fn: pause__P50752, depth: s.depth + 1,
324
+ parent: s, fn: pause__P50756, depth: s.depth + 1,
325
325
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
326
326
  arg0: undefined,
327
327
  } }
@@ -343,7 +343,7 @@ function lambda_1_mk(s) {
343
343
  } }
344
344
 
345
345
 
346
- const breakpoints = setupDebugger(1, ["__updated___50914","screen___50942","__update___50912"])
346
+ const breakpoints = setupDebugger(1, ["__updated___50921","screen___50949","__update___50919"])
347
347
 
348
- return _main___P50434
348
+ return _main___P50438
349
349
  })
@@ -1075,6 +1075,51 @@ void _blitRow(Image_ img, int xy, Image_ from, int xh) {
1075
1075
  blitRow(img, XX(xy), YY(xy), from, XX(xh), YY(xh));
1076
1076
  }
1077
1077
 
1078
+ void blit(Image_ dst, Image_ src, pxt::RefCollection *args) {
1079
+ int xDst = pxt::toInt(args->getAt(0));
1080
+ int yDst = pxt::toInt(args->getAt(1));
1081
+ int wDst = pxt::toInt(args->getAt(2));
1082
+ int hDst = pxt::toInt(args->getAt(3));
1083
+ int xSrc = pxt::toInt(args->getAt(4));
1084
+ int ySrc = pxt::toInt(args->getAt(5));
1085
+ int wSrc = pxt::toInt(args->getAt(6));
1086
+ int hSrc = pxt::toInt(args->getAt(7));
1087
+ bool transparent = pxt::toBoolQuick(args->getAt(8));
1088
+
1089
+ int xSrcStep = (wSrc << 16) / wDst;
1090
+ int ySrcStep = (hSrc << 16) / hDst;
1091
+
1092
+ int xDstClip = abs(min(0, xDst));
1093
+ int yDstClip = abs(min(0, yDst));
1094
+ int xDstStart = xDst + xDstClip;
1095
+ int yDstStart = yDst + yDstClip;
1096
+ int xDstEnd = min(dst->width(), xDst + wDst);
1097
+ int yDstEnd = min(dst->height(), yDst + hDst);
1098
+
1099
+ int xSrcStart = max(0, (xSrc << 16) + xDstClip * xSrcStep);
1100
+ int ySrcStart = max(0, (ySrc << 16) + yDstClip * ySrcStep);
1101
+ int xSrcEnd = min(src->width(), xSrc + wSrc) << 16;
1102
+ int ySrcEnd = min(src->height(), ySrc + hSrc) << 16;
1103
+
1104
+ dst->makeWritable();
1105
+
1106
+ for (int yDstCur = yDstStart, ySrcCur = ySrcStart; yDstCur < yDstEnd && ySrcCur < ySrcEnd; ++yDstCur, ySrcCur += ySrcStep) {
1107
+ int ySrcCurI = ySrcCur >> 16;
1108
+ for (int xDstCur = xDstStart, xSrcCur = xSrcStart; xDstCur < xDstEnd && xSrcCur < xSrcEnd; ++xDstCur, xSrcCur += xSrcStep) {
1109
+ int xSrcCurI = xSrcCur >> 16;
1110
+ int cSrc = getCore(src, xSrcCurI, ySrcCurI);
1111
+ if (!transparent || cSrc) {
1112
+ setCore(dst, xDstCur, yDstCur, cSrc);
1113
+ }
1114
+ }
1115
+ }
1116
+ }
1117
+
1118
+ //%
1119
+ void _blit(Image_ img, Image_ src, pxt::RefCollection *args) {
1120
+ blit(img, src, args);
1121
+ }
1122
+
1078
1123
  void fillCircle(Image_ img, int cx, int cy, int r, int c) {
1079
1124
  int x = r - 1;
1080
1125
  int y = 0;
@@ -78,6 +78,13 @@ interface Image {
78
78
  */
79
79
  //% helper=imageBlitRow
80
80
  blitRow(dstX: number, dstY: number, from: Image, fromX: number, fromH: number): void;
81
+
82
+ /**
83
+ * Copy an image from a source rectangle to a destination rectangle, stretching or
84
+ * compressing to fit the dimensions of the destination rectangle, if necessary.
85
+ */
86
+ //% helper=imageBlit
87
+ blit(xDst: number, yDst: number, wDst: number, hDst: number, src: Image, xSrc: number, ySrc: number, wSrc: number, hSrc: number, transparent: boolean): void;
81
88
  }
82
89
 
83
90
  interface ScreenImage extends Image {
@@ -118,10 +125,29 @@ namespace helpers {
118
125
  //% shim=ImageMethods::_blitRow
119
126
  declare function _blitRow(img: Image, xy: number, from: Image, xh: number): void;
120
127
 
128
+ //% shim=ImageMethods::_blit
129
+ declare function _blit(img: Image, src: Image, args: number[]): void;
130
+
121
131
  function pack(x: number, y: number) {
122
132
  return (Math.clamp(-30000, 30000, x | 0) & 0xffff) | (Math.clamp(-30000, 30000, y | 0) << 16)
123
133
  }
124
134
 
135
+ let _blitArgs: number[];
136
+
137
+ export function imageBlit(img: Image, xDst: number, yDst: number, wDst: number, hDst: number, src: Image, xSrc: number, ySrc: number, wSrc: number, hSrc: number, transparent: boolean) {
138
+ _blitArgs = _blitArgs || [];
139
+ _blitArgs[0] = xDst | 0;
140
+ _blitArgs[1] = yDst | 0;
141
+ _blitArgs[2] = wDst | 0;
142
+ _blitArgs[3] = hDst | 0;
143
+ _blitArgs[4] = xSrc | 0;
144
+ _blitArgs[5] = ySrc | 0;
145
+ _blitArgs[6] = wSrc | 0;
146
+ _blitArgs[7] = hSrc | 0;
147
+ _blitArgs[8] = transparent ? 1 : 0;
148
+ _blit(img, src, _blitArgs);
149
+ }
150
+
125
151
  export function imageBlitRow(img: Image, dstX: number, dstY: number, from: Image, fromX: number, fromH: number): void {
126
152
  _blitRow(img, pack(dstX, dstY), from, pack(fromX, fromH))
127
153
  }