diff --git a/HISTORY.md b/HISTORY.md index 1b31f92f..e8e570c0 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,12 +4,16 @@ * **Notable Changes:** * hyperized image attribute reporter primitive (monadic) + * when constructing a costume from a pixel list handle single values as greyscale * **Notable Fixes:** * fixed a glitch in the animation library's "sine in-out" easing function * fixed a postMessage glitch in the API, thanks, Bernat! * **Translation Updates:** * Tamil, thanks, Barthdry! +### 2021-01-26 +* threads: handle single values as greyscale when constructing a costume from a pixel list + ### 2021-01-25 * threads: hyperized image attribute reporter primitive (monadic) * pulled pending PRs diff --git a/snap.html b/snap.html index e796c7d9..af4a78a4 100755 --- a/snap.html +++ b/snap.html @@ -9,7 +9,7 @@ - + diff --git a/src/threads.js b/src/threads.js index 99a3ad8f..ba47d159 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2021-January-25'; +modules.threads = '2021-January-26'; var ThreadManager; var Process; @@ -5922,9 +5922,9 @@ Process.prototype.reportNewCostume = function (pixels, width, height, name) { src = pixels.itemsArray(); dta = ctx.createImageData(width, height); for (i = 0; i < src.length; i += 1) { - px = src[i].itemsArray(); + px = src[i] instanceof List ? src[i].itemsArray() : [src[i]]; for (k = 0; k < 3; k += 1) { - dta.data[(i * 4) + k] = +px[k]; + dta.data[(i * 4) + k] = px[k] === undefined ? +px[0] : +px[k]; } dta.data[i * 4 + 3] = (px[3] === undefined ? 255 : +px[3]); }