377 lines
31 KiB
HTML
377 lines
31 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!-- This file is generated by Nim. -->
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
|
|
|
<!-- Google fonts -->
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
|
|
<!-- CSS -->
|
|
<title>pixie/masks</title>
|
|
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
|
|
|
|
<script type="text/javascript" src="../dochack.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function main() {
|
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
|
for (var i = 0; i < pragmaDots.length; i++) {
|
|
pragmaDots[i].onclick = function(event) {
|
|
// Hide tease
|
|
event.target.parentNode.style.display = "none";
|
|
// Show actual
|
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
|
}
|
|
}
|
|
|
|
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
|
function switchTheme(e) {
|
|
if (e.target.checked) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
}
|
|
|
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
|
|
|
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
|
|
if (currentTheme) {
|
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
|
|
|
if (currentTheme === 'dark') {
|
|
toggleSwitch.checked = true;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body onload="main()">
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">pixie/masks</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-switch-wrapper">
|
|
<label class="theme-switch" for="checkbox">
|
|
<input type="checkbox" id="checkbox" />
|
|
<div class="slider round"></div>
|
|
</label>
|
|
<em>Dark Mode</em>
|
|
</div>
|
|
<div id="global-links">
|
|
<ul class="simple">
|
|
<li>
|
|
<a href="../theindex.html">Index</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#Mask"
|
|
title="Mask = ref object
|
|
width*, height*: int
|
|
data*: seq[uint8]">Mask</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<ul class="simple nested-toc-section">$
|
|
<li><a class="reference" href="#%24%2CMask"
|
|
title="`$`(mask: Mask): string">$,<wbr>Mask</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getValueSmooth
|
|
<li><a class="reference" href="#getValueSmooth%2CMask%2Cfloat32%2Cfloat32"
|
|
title="getValueSmooth(mask: Mask; x, y: float32): uint8">getValueSmooth,<wbr>Mask,<wbr>float32,<wbr>float32</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">[]=
|
|
<li><a class="reference" href="#%5B%5D%3D%2CMask%2Cint%2Cint%2Cuint8"
|
|
title="`[]=`(mask: Mask; x, y: int; value: uint8)">[]=,<wbr>Mask,<wbr>int,<wbr>int,<wbr>uint8</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">spread
|
|
<li><a class="reference" href="#spread%2CMask%2Cfloat32"
|
|
title="spread(mask: Mask; spread: float32)">spread,<wbr>Mask,<wbr>float32</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fill
|
|
<li><a class="reference" href="#fill%2CMask%2Cuint8"
|
|
title="fill(mask: Mask; value: uint8)">fill,<wbr>Mask,<wbr>uint8</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">wh
|
|
<li><a class="reference" href="#wh%2CMask"
|
|
title="wh(mask: Mask): Vec2">wh,<wbr>Mask</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">setValueUnsafe
|
|
<li><a class="reference" href="#setValueUnsafe%2CMask%2Cint%2Cint%2Cuint8"
|
|
title="setValueUnsafe(mask: Mask; x, y: int; value: uint8)">setValueUnsafe,<wbr>Mask,<wbr>int,<wbr>int,<wbr>uint8</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">newMask
|
|
<li><a class="reference" href="#newMask%2Cint%2Cint"
|
|
title="newMask(width, height: int): Mask">newMask,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">minifyBy2
|
|
<li><a class="reference" href="#minifyBy2%2CMask%2Cint"
|
|
title="minifyBy2(mask: Mask; power = 1): Mask">minifyBy2,<wbr>Mask,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getValueUnsafe
|
|
<li><a class="reference" href="#getValueUnsafe%2CMask%2Cint%2Cint"
|
|
title="getValueUnsafe(mask: Mask; x, y: int): uint8">getValueUnsafe,<wbr>Mask,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">blur
|
|
<li><a class="reference" href="#blur%2CMask%2Cfloat32%2Cuint8"
|
|
title="blur(mask: Mask; radius: float32; outOfBounds: uint8 = 0)">blur,<wbr>Mask,<wbr>float32,<wbr>uint8</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">dataIndex
|
|
<li><a class="reference" href="#dataIndex%2CMask%2Cint%2Cint"
|
|
title="dataIndex(mask: Mask; x, y: int): int">dataIndex,<wbr>Mask,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">inside
|
|
<li><a class="reference" href="#inside%2CMask%2Cint%2Cint"
|
|
title="inside(mask: Mask; x, y: int): bool">inside,<wbr>Mask,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">ceil
|
|
<li><a class="reference" href="#ceil%2CMask"
|
|
title="ceil(mask: Mask)">ceil,<wbr>Mask</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">copy
|
|
<li><a class="reference" href="#copy%2CMask"
|
|
title="copy(mask: Mask): Mask">copy,<wbr>Mask</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">[]
|
|
<li><a class="reference" href="#%5B%5D%2CMask%2Cint%2Cint"
|
|
title="`[]`(mask: Mask; x, y: int): uint8">[],<wbr>Mask,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">fillUnsafe
|
|
<li><a class="reference" href="#fillUnsafe%2Cseq%5Buint8%5D%2Cuint8%2Cint%2Cint"
|
|
title="fillUnsafe(data: var seq[uint8]; value: uint8; start, len: int)">fillUnsafe,<wbr>seq[uint8],<wbr>uint8,<wbr>int,<wbr>int</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc"></p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="common.html">common</a>, <a class="reference external" href="internal.html">internal</a>
|
|
</dl></div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<a id="Mask"></a>
|
|
<dt><pre><a href="masks.html#Mask"><span class="Identifier">Mask</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">width</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">height</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
|
|
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">uint8</span><span class="Other">]</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
Mask object that holds mask opacity data.
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
<div class="section" id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<a id="newMask,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#newMask%2Cint%2Cint"><span class="Identifier">newMask</span></a><span class="Other">(</span><span class="Identifier">width</span><span class="Other">,</span> <span class="Identifier">height</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">PixieError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Creates a new mask with the parameter dimensions.
|
|
|
|
</dd>
|
|
<a id="wh,Mask"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#wh%2CMask"><span class="Identifier">wh</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Vec2</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Return with and height as a size vector.
|
|
|
|
</dd>
|
|
<a id="copy,Mask"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#copy%2CMask"><span class="Identifier">copy</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">)</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">PixieError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Copies the image data into a new image.
|
|
|
|
</dd>
|
|
<a id="$,Mask"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CMask"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Prints the mask size.
|
|
|
|
</dd>
|
|
<a id="inside,Mask,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#inside%2CMask%2Cint%2Cint"><span class="Identifier">inside</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Returns true if (x, y) is inside the mask.
|
|
|
|
</dd>
|
|
<a id="dataIndex,Mask,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#dataIndex%2CMask%2Cint%2Cint"><span class="Identifier">dataIndex</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="getValueUnsafe,Mask,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getValueUnsafe%2CMask%2Cint%2Cint"><span class="Identifier">getValueUnsafe</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint8</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Gets a value from (x, y) coordinates.<ul class="simple"><li>No bounds checking *</li>
|
|
</ul>
|
|
<p>Make sure that x, y are in bounds. Failure in the assumptions will case unsafe memory reads.</p>
|
|
|
|
|
|
</dd>
|
|
<a id="[],Mask,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CMask%2Cint%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint8</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Gets a pixel at (x, y) or returns transparent black if outside of bounds.
|
|
|
|
</dd>
|
|
<a id="setValueUnsafe,Mask,int,int,uint8"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#setValueUnsafe%2CMask%2Cint%2Cint%2Cuint8"><span class="Identifier">setValueUnsafe</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Sets a value from (x, y) coordinates.<ul class="simple"><li>No bounds checking *</li>
|
|
</ul>
|
|
<p>Make sure that x, y are in bounds. Failure in the assumptions will case unsafe memory writes.</p>
|
|
|
|
|
|
</dd>
|
|
<a id="[]=,Mask,int,int,uint8"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CMask%2Cint%2Cint%2Cuint8"><span class="Identifier">`[]=`</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Sets a value at (x, y) or does nothing if outside of bounds.
|
|
|
|
</dd>
|
|
<a id="minifyBy2,Mask,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#minifyBy2%2CMask%2Cint"><span class="Identifier">minifyBy2</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">power</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">PixieError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Scales the mask down by an integer scale.
|
|
|
|
</dd>
|
|
<a id="fillUnsafe,seq[uint8],uint8,int,int"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#fillUnsafe%2Cseq%5Buint8%5D%2Cuint8%2Cint%2Cint"><span class="Identifier">fillUnsafe</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">uint8</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">start</span><span class="Other">,</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Fills the mask data with the parameter value starting at index start and continuing for len indices.
|
|
|
|
</dd>
|
|
<a id="fill,Mask,uint8"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#fill%2CMask%2Cuint8"><span class="Identifier">fill</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">inline</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Fills the mask with the parameter value.
|
|
|
|
</dd>
|
|
<a id="getValueSmooth,Mask,float32,float32"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getValueSmooth%2CMask%2Cfloat32%2Cfloat32"><span class="Identifier">getValueSmooth</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">float32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint8</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Gets a interpolated value with float point coordinates.
|
|
|
|
</dd>
|
|
<a id="spread,Mask,float32"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#spread%2CMask%2Cfloat32"><span class="Identifier">spread</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">spread</span><span class="Other">:</span> <span class="Identifier">float32</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">PixieError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Grows the mask by spread.
|
|
|
|
</dd>
|
|
<a id="ceil,Mask"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#ceil%2CMask"><span class="Identifier">ceil</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
A value of 0 stays 0. Anything else turns into 255.
|
|
|
|
</dd>
|
|
<a id="blur,Mask,float32,uint8"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#blur%2CMask%2Cfloat32%2Cuint8"><span class="Identifier">blur</span></a><span class="Other">(</span><span class="Identifier">mask</span><span class="Other">:</span> <a href="masks.html#Mask"><span class="Identifier">Mask</span></a><span class="Other">;</span> <span class="Identifier">radius</span><span class="Other">:</span> <span class="Identifier">float32</span><span class="Other">;</span> <span class="Identifier">outOfBounds</span><span class="Other">:</span> <span class="Identifier">uint8</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">PixieError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
Applies Gaussian blur to the image given a radius.
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|