easy-scratch/doc/scratch-vm/Scratch3PenBlocks.html

5173 lines
118 KiB
HTML
Raw Normal View History

2025-02-12 12:27:32 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Scratch3PenBlocks - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="-_StackFrame.html">_StackFrame</a><ul class='methods'><li data-type='method'><a href="-_StackFrame.html#.create">create</a></li><li data-type='method'><a href="-_StackFrame.html#.release">release</a></li><li data-type='method'><a href="-_StackFrame.html#reset">reset</a></li><li data-type='method'><a href="-_StackFrame.html#reuse">reuse</a></li></ul></li><li><a href="BLE.html">BLE</a><ul class='methods'><li data-type='method'><a href="BLE.html#connectPeripheral">connectPeripheral</a></li><li data-type='method'><a href="BLE.html#didReceiveCall">didReceiveCall</a></li><li data-type='method'><a href="BLE.html#disconnect">disconnect</a></li><li data-type='method'><a href="BLE.html#handleDisconnectError">handleDisconnectError</a></li><li data-type='method'><a href="BLE.html#isConnected">isConnected</a></li><li data-type='method'><a href="BLE.html#read">read</a></li><li data-type='method'><a href="BLE.html#requestPeripheral">requestPeripheral</a></li><li data-type='method'><a href="BLE.html#startNotifications">startNotifications</a></li><li data-type='method'><a href="BLE.html#write">write</a></li></ul></li><li><a href="BlockCached.html">BlockCached</a></li><li><a href="Blocks.html">Blocks</a><ul class='methods'><li data-type='method'><a href="Blocks.html#_addScript">_addScript</a></li><li data-type='method'><a href="Blocks.html#_deleteScript">_deleteScript</a></li><li data-type='method'><a href="Blocks.html#_getBackdropField">_getBackdropField</a></li><li data-type='method'><a href="Blocks.html#_getBlockParams">_getBlockParams</a></li><li data-type='method'><a href="Blocks.html#_getCostumeField">_getCostumeField</a></li><li data-type='method'><a href="Blocks.html#_getCustomBlockInternal">_getCustomBlockInternal</a></li><li data-type='method'><a href="Blocks.html#_getSoundField">_getSoundField</a></li><li data-type='method'><a href="Blocks.html#_getSpriteField">_getSpriteField</a></li><li data-type='method'><a href="Blocks.html#blocklyListen">blocklyListen</a></li><li data-type='method'><a href="Blocks.html#blockToXML">blockToXML</a></li><li data-type='method'><a href="Blocks.html#changeBlock">changeBlock</a></li><li data-type='method'><a href="Blocks.html#createBlock">createBlock</a></li><li data-type='method'><a href="Blocks.html#deleteBlock">deleteBlock</a></li><li data-type='method'><a href="Blocks.html#emitProjectChanged">emitProjectChanged</a></li><li data-type='method'><a href="Blocks.html#getAllVariableAndListReferences">getAllVariableAndListReferences</a></li><li data-type='method'><a href="Blocks.html#getBlock">getBlock</a></li><li data-type='method'><a href="Blocks.html#getBranch">getBranch</a></li><li data-type='method'><a href="Blocks.html#getFields">getFields</a></li><li data-type='method'><a href="Blocks.html#getInputs">getInputs</a></li><li data-type='method'><a href="Blocks.html#getMutation">getMutation</a></li><li data-type='method'><a href="Blocks.html#getNextBlock">getNextBlock</a></li><li data-type='method'><a href="Blocks.html#getOpcode">getOpcode</a></li><li data-type='method'><a href="Blocks.html#getProcedureDefinition">getProcedureDefinition</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesAndIds">getProcedureParamNamesAndIds</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesIdsAndDefaults">getProcedureParamNamesIdsAndDefaults</a></li><li data-type='method'><a href="Blocks.html#getScripts">getScripts</a></li><li data-type='method'><a href="Blocks.html#getTopLevelScript">getTopLevelScript</a></li><li data-type='method'><a href="Blocks.html#moveBlock">moveBlock</a></li><li data-type='method'><a href="Blocks.html#mutationToXML">mutationToXML</a></li><li data-type='method'><a href="Blocks.html#resetCache">resetCache</a></li><li data-type='method'><a href="Blocks.html#runAllMonitored">runAllMonitored</a></li><li data-type='method'><a href="Blocks.html#toXML">toXML</a></li><li data-type='method'><a href="Blocks.html#updateAssetName">updateAssetName</a></li><li data-type='method'><a href
</nav>
<div id="main">
<h1 class="page-title">Scratch3PenBlocks</h1>
<section>
<header>
<h2>
Scratch3PenBlocks
</h2>
<div class="class-description"><p>Host for the Pen-related blocks in Scratch 3.0</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Scratch3PenBlocks"><span class="type-signature"></span>new Scratch3PenBlocks<span class="signature">(runtime)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>runtime</code></td>
<td class="type">
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</td>
<td class="description last"><p>the runtime instantiating this block package.</p></td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".DEFAULT_PEN_STATE"><span class="type-signature">(static) </span>DEFAULT_PEN_STATE<span class="type-signature"> :<a href="global.html#PenState">PenState</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The default pen state, to be used when a target has no existing pen state.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#PenState">PenState</a></span>
</li>
</ul>
<h4 class="name" id=".PEN_SIZE_RANGE"><span class="type-signature">(static) </span>PEN_SIZE_RANGE<span class="type-signature"> :Object</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The minimum and maximum allowed pen size.
The maximum is twice the diagonal of the stage, so that even an
off-stage sprite can fill it.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h4 class="name" id=".STATE_KEY"><span class="type-signature">(static) </span>STATE_KEY<span class="type-signature"> :string</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The key to load &amp; store a target's pen-related state.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<h4 class="name" id="_penDrawableId"><span class="type-signature">(private) </span>_penDrawableId<span class="type-signature"> :int</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The ID of the renderer Drawable corresponding to the pen layer.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<h4 class="name" id="_penSkinId"><span class="type-signature">(private) </span>_penSkinId<span class="type-signature"> :int</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The ID of the renderer Skin corresponding to the pen layer.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">int</span>
</li>
</ul>
<h4 class="name" id="runtime"><span class="type-signature"></span>runtime<span class="type-signature"> :<a href="Runtime.html">Runtime</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The runtime instantiating this block package.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_alphaToTransparency"><span class="type-signature">(private) </span>_alphaToTransparency<span class="signature">(alpha)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Convert an alpha value to a pen transparency value.
Alpha ranges from 0 to 1, where 0 is transparent and 1 is opaque.
Transparency ranges from 0 to 100, where 0 is opaque and 100 is transparent.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>alpha</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the input alpha value.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the transparency value.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="_clampColorParam"><span class="type-signature">(private) </span>_clampColorParam<span class="signature">(value)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Clamp a pen color parameter to the range (0,100).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the value to be clamped.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the clamped value.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="_clampPenSize"><span class="type-signature">(private) </span>_clampPenSize<span class="signature">(requestedSize)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Clamp a pen size value to the range allowed by the pen.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>requestedSize</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the requested pen size.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the clamped size.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="_getPenLayerID"><span class="type-signature">(private) </span>_getPenLayerID<span class="signature">()</span><span class="type-signature"> &rarr; {int}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Retrieve the ID of the renderer &quot;Skin&quot; corresponding to the pen layer. If
the pen Skin doesn't yet exist, create it.</p>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>the Skin ID of the pen layer, or -1 on failure.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">int</span>
</dd>
</dl>
<h4 class="name" id="_getPenState"><span class="type-signature">(private) </span>_getPenState<span class="signature">(target)</span><span class="type-signature"> &rarr; {<a href="global.html#PenState">PenState</a>}</span></h4>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type"><a href="Target.html">Target</a></span>
</td>
<td class="description last"><p>collect pen state for this target. Probably, but not necessarily, a RenderedTarget.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the mutable pen state associated with that target. This will be created if necessary.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#PenState">PenState</a></span>
</dd>
</dl>
<h4 class="name" id="_initColorParam"><span class="type-signature">(private) </span>_initColorParam<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Initialize color parameters menu with localized strings</p>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>of the localized text and values for each menu element</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h4 class="name" id="_legacyUpdatePenColor"><span class="type-signature">(private) </span>_legacyUpdatePenColor<span class="signature">(penState)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Update the pen state's color from its hue &amp; shade values, Scratch 2.0 style.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>penState</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>update the HSV &amp; RGB values in this pen state from its hue &amp; shade values.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="_onTargetCreated"><span class="type-signature">(private) </span>_onTargetCreated<span class="signature">(newTarget, sourceTarget<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>When a pen-using Target is cloned, clone the pen state.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>newTarget</code></td>
<td class="type">
<span class="param-type"><a href="Target.html">Target</a></span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>the newly created target.</p></td>
</tr>
<tr>
<td class="name"><code>sourceTarget</code></td>
<td class="type">
<span class="param-type"><a href="Target.html">Target</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>the target used as a source for the new clone, if any.</p></td>
</tr>
</tbody>
</table>
<h5>Listens to Events:</h5>
<ul>
<li><a href="Runtime.html#event:targetWasCreated">Runtime#event:targetWasCreated</a></li>
</ul>
<h4 class="name" id="_onTargetMoved"><span class="type-signature">(private) </span>_onTargetMoved<span class="signature">(target, oldX, oldY, isForce)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Handle a target which has moved. This only fires when the pen is down.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type"><a href="RenderedTarget.html">RenderedTarget</a></span>
</td>
<td class="description last"><p>the target which has moved.</p></td>
</tr>
<tr>
<td class="name"><code>oldX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the previous X position.</p></td>
</tr>
<tr>
<td class="name"><code>oldY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the previous Y position.</p></td>
</tr>
<tr>
<td class="name"><code>isForce</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>whether the movement was forced.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="_setOrChangeColorParam"><span class="type-signature">(private) </span>_setOrChangeColorParam<span class="signature">(param, value, penState, change)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Set or change a single color parameter on the pen state, and update the pen color.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>param</code></td>
<td class="type">
<span class="param-type"><a href="global.html#ColorParam">ColorParam</a></span>
</td>
<td class="description last"><p>the name of the color parameter to set or change.</p></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the value to set or change the param by.</p></td>
</tr>
<tr>
<td class="name"><code>penState</code></td>
<td class="type">
<span class="param-type"><a href="global.html#PenState">PenState</a></span>
</td>
<td class="description last"><p>the pen state to update.</p></td>
</tr>
<tr>
<td class="name"><code>change</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>if true change param by value, if false set param to value.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="_transparencyToAlpha"><span class="type-signature">(private) </span>_transparencyToAlpha<span class="signature">(transparency)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Convert a pen transparency value to an alpha value.
Alpha ranges from 0 to 1, where 0 is transparent and 1 is opaque.
Transparency ranges from 0 to 100, where 0 is opaque and 100 is transparent.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>transparency</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the input transparency value.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the alpha value.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="_updatePenColor"><span class="type-signature">(private) </span>_updatePenColor<span class="signature">(penState)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Update the cached color from the color, saturation, brightness and transparency values
in the provided PenState object.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>penState</code></td>
<td class="type">
<span class="param-type"><a href="global.html#PenState">PenState</a></span>
</td>
<td class="description last"><p>the pen state to update.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="_wrapColor"><span class="type-signature">(private) </span>_wrapColor<span class="signature">(value)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Wrap a color input into the range (0,100).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the value to be wrapped.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>the wrapped value.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="changePenColorParamBy"><span class="type-signature"></span>changePenColorParamBy<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>COLOR_PARAM</code></td>
<td class="type">
<span class="param-type"><a href="global.html#ColorParam">ColorParam</a></span>
</td>
<td class="description last"><p>the name of the selected color parameter.</p></td>
</tr>
<tr>
<td class="name"><code>VALUE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount to change the selected parameter by.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>The &quot;change pen {ColorParam} by {number}&quot; block changes one of the pen's color parameters
by a given amound.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="changePenHueBy"><span class="type-signature"></span>changePenHueBy<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>HUE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount of desired hue change.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Scratch 2 &quot;hue&quot; param is equivelant to twice the new &quot;color&quot; param.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="changePenShadeBy"><span class="type-signature"></span>changePenShadeBy<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>SHADE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount of desired shade change.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Because &quot;shade&quot; cannot be backed out of hsv consistently, use the previously
stored penState._shade to make the shade change.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="changePenSizeBy"><span class="type-signature"></span>changePenSizeBy<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>SIZE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount of desired size change.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>The pen &quot;change pen size by {number}&quot; block changes the pen size by the given amount.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The pen &quot;clear&quot; block clears the pen layer's contents.</p>
</div>
<h4 class="name" id="getInfo"><span class="type-signature"></span>getInfo<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>metadata for this extension and its blocks.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h4 class="name" id="penDown"><span class="type-signature"></span>penDown<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The pen &quot;pen down&quot; block causes the target to leave pen trails on future motion.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="penUp"><span class="type-signature"></span>penUp<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The pen &quot;pen up&quot; block stops the target from leaving pen trails.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setPenColorParamTo"><span class="type-signature"></span>setPenColorParamTo<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>COLOR_PARAM</code></td>
<td class="type">
<span class="param-type"><a href="global.html#ColorParam">ColorParam</a></span>
</td>
<td class="description last"><p>the name of the selected color parameter.</p></td>
</tr>
<tr>
<td class="name"><code>VALUE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount to set the selected parameter to.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>The &quot;set pen {ColorParam} to {number}&quot; block sets one of the pen's color parameters
to a given amound.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setPenColorToColor"><span class="type-signature"></span>setPenColorToColor<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>COLOR</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>the color to set, expressed as a 24-bit RGB value (0xRRGGBB).</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>The pen &quot;set pen color to {color}&quot; block sets the pen to a particular RGB color.
The transparency is reset to 0.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setPenHueToNumber"><span class="type-signature"></span>setPenHueToNumber<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>HUE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount to set the hue to.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Scratch 2 &quot;hue&quot; param is equivelant to twice the new &quot;color&quot; param.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setPenShadeToNumber"><span class="type-signature"></span>setPenShadeToNumber<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>SHADE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount to set the shade to.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Use legacy &quot;set shade&quot; code to calculate RGB value for shade,
then convert back to HSV and store those components.
It is important to also track the given shade in penState._shade
because it cannot be accurately backed out of the new HSV later.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setPenSizeTo"><span class="type-signature"></span>setPenSizeTo<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>SIZE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the amount of desired size change.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>The pen &quot;set pen size to {number}&quot; block sets the pen size to the given amount.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="stamp"><span class="type-signature"></span>stamp<span class="signature">(args, util)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The pen &quot;stamp&quot; block stamps the current drawable's image onto the pen layer.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block arguments.</p></td>
</tr>
<tr>
<td class="name"><code>util</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>utility object provided by the runtime.</p></td>
</tr>
</tbody>
</table>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>