Merge pull request #147 from guzba/master

1.0.4
This commit is contained in:
treeform 2021-02-27 23:13:40 -08:00 committed by GitHub
commit 1418a68f40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 45 additions and 27 deletions

File diff suppressed because one or more lines are too long

View file

@ -283,7 +283,7 @@ Is there a blend masking function with SIMD support?
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -196,7 +196,7 @@ Linearly interpolate between a and b using t.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -182,7 +182,7 @@ Encodes an image into the BMP file format.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -182,7 +182,7 @@ Encodes Image into a JPEG data string.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -201,7 +201,7 @@ Encodes the mask data into the PNG file format.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -171,7 +171,7 @@ Render SVG file and return the image. Defaults to the SVG's view box size.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -163,6 +163,11 @@ function main() {
<li><a class="reference" href="#invert"
title="invert(target: Image | Mask)">invert</a></li>
</ul>
<ul class="simple nested-toc-section">diff
<li><a class="reference" href="#diff%2CImage%2CImage"
title="diff(master, image: Image): (float32, Image)">diff,<wbr>Image,<wbr>Image</a></li>
</ul>
<ul class="simple nested-toc-section">getRgbaUnsafe
<li><a class="reference" href="#getRgbaUnsafe%2CImage%2Cint%2Cint"
@ -421,6 +426,14 @@ Gets a sub image from this image.
Either cuts a sub image or returns a super image with padded transparency.
</dd>
<a id="diff,Image,Image"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#diff%2CImage%2CImage"><span class="Identifier">diff</span></a><span class="Other">(</span><span class="Identifier">master</span><span class="Other">,</span> <span class="Identifier">image</span><span class="Other">:</span> <a href="images.html#Image"><span class="Identifier">Image</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><span class="Identifier">float32</span><span class="Other">,</span> <a href="images.html#Image"><span class="Identifier">Image</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="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>
Compares the parameters and returns a score and image of the difference.
</dd>
<a id="minifyBy2,Image,int"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#minifyBy2%2CImage%2Cint"><span class="Identifier">minifyBy2</span></a><span class="Other">(</span><span class="Identifier">image</span><span class="Other">:</span> <a href="images.html#Image"><span class="Identifier">Image</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="images.html#Image"><span class="Identifier">Image</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>
@ -578,7 +591,7 @@ Create a shadow of the image with the offset, spread and blur.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -15,6 +15,7 @@ flipHorizontal pixie/images.html#flipHorizontal,Image images: flipHorizontal(ima
flipVertical pixie/images.html#flipVertical,Image images: flipVertical(image: Image)
subImage pixie/images.html#subImage,Image,int,int,int,int images: subImage(image: Image; x, y, w, h: int): Image
superImage pixie/images.html#superImage,Image,int,int,int,int images: superImage(image: Image; x, y, w, h: int): Image
diff pixie/images.html#diff,Image,Image images: diff(master, image: Image): (float32, Image)
minifyBy2 pixie/images.html#minifyBy2,Image,int images: minifyBy2(image: Image; power = 1): Image
magnifyBy2 pixie/images.html#magnifyBy2,Image,int images: magnifyBy2(image: Image; power = 1): Image
applyOpacity pixie/images.html#applyOpacity,,float32 images: applyOpacity(target: Image | Mask; opacity: float32)

View file

@ -98,16 +98,16 @@ function main() {
<li><a class="reference" href="#toPremultipliedAlpha%2Cseq%5B%5D"
title="toPremultipliedAlpha(data: var seq[ColorRGBA | ColorRGBX])">toPremultipliedAlpha,<wbr>seq[]</a></li>
</ul>
<ul class="simple nested-toc-section">gaussianLookup
<li><a class="reference" href="#gaussianLookup%2Cint"
title="gaussianLookup(radius: int): seq[uint32]">gaussianLookup,<wbr>int</a></li>
</ul>
<ul class="simple nested-toc-section">unpackAlphaValues
<li><a class="reference" href="#unpackAlphaValues%2CM128i"
title="unpackAlphaValues(v: M128i): M128i">unpackAlphaValues,<wbr>M128i</a></li>
</ul>
<ul class="simple nested-toc-section">gaussianKernel
<li><a class="reference" href="#gaussianKernel%2Cint"
title="gaussianKernel(radius: int): seq[uint32]">gaussianKernel,<wbr>int</a></li>
</ul>
<ul class="simple nested-toc-section">packAlphaValues
<li><a class="reference" href="#packAlphaValues%2CM128i"
@ -133,8 +133,8 @@ function main() {
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<a id="gaussianLookup,int"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#gaussianLookup%2Cint"><span class="Identifier">gaussianLookup</span></a><span class="Other">(</span><span class="Identifier">radius</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">uint32</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>
<a id="gaussianKernel,int"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#gaussianKernel%2Cint"><span class="Identifier">gaussianKernel</span></a><span class="Other">(</span><span class="Identifier">radius</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">uint32</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>
Compute lookup table for 1d Gaussian kernel. Values are [0, 255] * 1024.
@ -178,7 +178,7 @@ Unpack the first 32 bits into 4 rgba(0, 0, 0, value)
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
gaussianLookup pixie/internal.html#gaussianLookup,int internal: gaussianLookup(radius: int): seq[uint32]
gaussianKernel pixie/internal.html#gaussianKernel,int internal: gaussianKernel(radius: int): seq[uint32]
toStraightAlpha pixie/internal.html#toStraightAlpha,seq[] internal: toStraightAlpha(data: var seq[ColorRGBA | ColorRGBX])
toPremultipliedAlpha pixie/internal.html#toPremultipliedAlpha,seq[] internal: toPremultipliedAlpha(data: var seq[ColorRGBA | ColorRGBX])
packAlphaValues pixie/internal.html#packAlphaValues,M128i internal: packAlphaValues(v: M128i): M128i

View file

@ -367,7 +367,7 @@ Applies Gaussian blur to the image given a radius.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:33 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -243,7 +243,7 @@ Angular gradient.
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -662,7 +662,7 @@ Return elements in pairs: (1st, 2nd), (2nd, 3rd) ... (n - 1, last).
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -288,6 +288,10 @@ function main() {
<li><a class="reference external"
data-doc-search-tag="svg: decodeSvg(data: string; width = 0; height = 0): Image" href="pixie/fileformats/svg.html#decodeSvg%2Cstring%2Cint%2Cint">svg: decodeSvg(data: string; width = 0; height = 0): Image</a></li>
</ul></dd>
<dt><a name="diff" href="#diff"><span>diff:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="images: diff(master, image: Image): (float32, Image)" href="pixie/images.html#diff%2CImage%2CImage">images: diff(master, image: Image): (float32, Image)</a></li>
</ul></dd>
<dt><a name="draw" href="#draw"><span>draw:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="images: draw(a, b: Image; pos = vec2(0, 0); blendMode = bmNormal)" href="pixie/images.html#draw%2CImage%2CImage">images: draw(a, b: Image; pos = vec2(0, 0); blendMode = bmNormal)</a></li>
@ -452,9 +456,9 @@ function main() {
<li><a class="reference external"
data-doc-search-tag="common: fractional(v: float32): float32" href="pixie/common.html#fractional%2Cfloat32">common: fractional(v: float32): float32</a></li>
</ul></dd>
<dt><a name="gaussianLookup" href="#gaussianLookup"><span>gaussianLookup:</span></a></dt><dd><ul class="simple">
<dt><a name="gaussianKernel" href="#gaussianKernel"><span>gaussianKernel:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="internal: gaussianLookup(radius: int): seq[uint32]" href="pixie/internal.html#gaussianLookup%2Cint">internal: gaussianLookup(radius: int): seq[uint32]</a></li>
data-doc-search-tag="internal: gaussianKernel(radius: int): seq[uint32]" href="pixie/internal.html#gaussianKernel%2Cint">internal: gaussianKernel(radius: int): seq[uint32]</a></li>
</ul></dd>
<dt><a name="getRgbaSmooth" href="#getRgbaSmooth"><span>getRgbaSmooth:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
@ -921,7 +925,7 @@ function main() {
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-27 01:24:34 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-28 07:11:38 UTC</small>
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
version = "1.0.3"
version = "1.0.4"
author = "Andre von Houck and Ryan Oldenburg"
description = "Full-featured 2d graphics library for Nim."
license = "MIT"

View file

@ -19,6 +19,6 @@ for file in files:
image = decodeSvg(original)
gold = readImage(&"tests/images/svg/{file}.png")
let (diffScore, _) = diff(image, gold)
doAssert diffScore < 1
let (score, _) = diff(image, gold)
doAssert score < 1
# image.writeFile(&"tests/images/svg/{file}.png")