From f22bc546ef7d4afd9fcc12ecc98c3a3ef5cbc527 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 7 Aug 2019 11:08:32 +0200 Subject: [PATCH] added "rgba" option to (aspect) AT (location) reporter in the sensing category returns a 4-item list of values from 0-255 (same is pixels from a costume) --- HISTORY.md | 2 ++ snap.html | 4 ++-- src/blocks.js | 3 ++- src/threads.js | 6 +++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 12d44c7e..667db3dc 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,12 +2,14 @@ ## in development: * **New Features:** + * new "rgba" option in "(aspect) AT (location)" sensing reporter, returns a 4-item list of values from 0-255 (same is pixels from a costume) * **Notable Changes:** * **Notable Fixes:** * **Translation Updates:** ### 2019-08-07 * new dev version +* blocks, threads: added "rgba" option to (aspect) AT (location) reporter in the sensing category ## v5.0.9 * **New Feature:** diff --git a/snap.html b/snap.html index 07d49e33..55d09f4f 100755 --- a/snap.html +++ b/snap.html @@ -6,8 +6,8 @@ - - + + diff --git a/src/blocks.js b/src/blocks.js index db05f907..e6d9771e 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2019-July-25'; +modules.blocks = '2019-August-07'; var SyntaxElementMorph; var BlockMorph; @@ -1406,6 +1406,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { saturation : ['saturation'], brightness : ['brightness'], transparency : ['transparency'], + rgba : ['rgba'], '~' : null, sprites : ['sprites'], }, diff --git a/src/threads.js b/src/threads.js index 823fe76f..db54c49f 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, Color, TableFrameMorph, ColorSlotMorph, isSnapObject, Map, newCanvas, Symbol*/ -modules.threads = '2019-August-06'; +modules.threads = '2019-August-07'; var ThreadManager; var Process; @@ -3973,6 +3973,7 @@ Process.prototype.reportAspect = function (aspect, location) { // 'saturation' - hsv SATURATION on a scale of 0 - 100 // 'brightness' - hsv VALUE on a scale of 0 - 100 // 'transparency' - rgba ALPHA on a reversed (!) scale of 0 - 100 + // 'rgba' - list of rgba values on a scale of 0 - 255 each // 'sprites' - a list of sprites at the location, empty if none // // right input (location): @@ -4048,6 +4049,9 @@ Process.prototype.reportAspect = function (aspect, location) { } + if (choice === 'rgba') { + return new List([clr.r, clr.g, clr.b, Math.round(clr.a * 255)]); + } if (idx < 0 || idx > 3) { return; }