diff --git a/extensions/Longboost/color_channels.js b/extensions/Longboost/color_channels.js index e7bb7666da..d4b378e29d 100644 --- a/extensions/Longboost/color_channels.js +++ b/extensions/Longboost/color_channels.js @@ -30,6 +30,7 @@ opcode: "true", blockType: Scratch.BlockType.BOOLEAN, text: "true", + hideFromPalette: true, disableMonitor: true, }, { @@ -50,10 +51,30 @@ }, }, }, + { + opcode: "drawSelected", + blockType: Scratch.BlockType.COMMAND, + text: "set colors red:[R]green:[G]blue:[B]", + arguments: { + R: { + type: Scratch.ArgumentType.MENU, + menu: "ENABLED_MENU", + }, + G: { + type: Scratch.ArgumentType.MENU, + menu: "ENABLED_MENU", + }, + B: { + type: Scratch.ArgumentType.MENU, + menu: "ENABLED_MENU", + }, + }, + }, { opcode: "draw", blockType: Scratch.BlockType.COMMAND, text: "only draw colors:[R]green:[G]blue:[B]", + hideFromPalette: true, arguments: { R: { type: Scratch.ArgumentType.BOOLEAN, @@ -99,6 +120,19 @@ acceptReporters: true, items: ["red", "green", "blue"], }, + ENABLED_MENU: { + acceptReporters: true, + items: [ + { + text: "off", + value: "false", + }, + { + text: "on", + value: "true", + }, + ], + }, }, }; } @@ -123,6 +157,22 @@ } } + drawSelected({ R, G, B }) { + channel_array = [ + Scratch.Cast.toBoolean(R), + Scratch.Cast.toBoolean(G), + Scratch.Cast.toBoolean(B), + true, + ]; + gl.colorMask( + channel_array[0], + channel_array[1], + channel_array[2], + channel_array[3] + ); + Scratch.vm.renderer.dirty = true; + } + draw({ R, G, B }) { channel_array = [R, G, B, true]; gl.colorMask(