Another doc pass.
This commit is contained in:
parent
50a472ceb9
commit
a038e5ae6e
14 changed files with 30 additions and 17 deletions
|
@ -533,7 +533,7 @@ Strokes a polygon.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:40 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:51 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -239,7 +239,7 @@ window.addEventListener('DOMContentLoaded', main);
|
||||||
<dt><pre><span class="Keyword">proc</span> <a href="#blendAlpha%2Cuint8%2Cuint8"><span class="Identifier">blendAlpha</span></a><span class="Other">(</span><span class="Identifier">backdrop</span><span class="Other">,</span> <span class="Identifier">source</span><span class="Other">:</span> <span class="Identifier">uint8</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>
|
<dt><pre><span class="Keyword">proc</span> <a href="#blendAlpha%2Cuint8%2Cuint8"><span class="Identifier">blendAlpha</span></a><span class="Other">(</span><span class="Identifier">backdrop</span><span class="Other">,</span> <span class="Identifier">source</span><span class="Other">:</span> <span class="Identifier">uint8</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>
|
<dd>
|
||||||
|
|
||||||
|
Blends alphas of backdrop, source.
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<a id="blender,BlendMode"></a>
|
<a id="blender,BlendMode"></a>
|
||||||
|
@ -282,7 +282,7 @@ Unpack the first 32 bits into 4 rgba(0, 0, 0, value)
|
||||||
<dt><pre><span class="Keyword">proc</span> <a href="#hasSimdBlender%2CBlendMode"><span class="Identifier">hasSimdBlender</span></a><span class="Other">(</span><span class="Identifier">blendMode</span><span class="Other">:</span> <a href="blends.html#BlendMode"><span class="Identifier">BlendMode</span></a><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">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>
|
<dt><pre><span class="Keyword">proc</span> <a href="#hasSimdBlender%2CBlendMode"><span class="Identifier">hasSimdBlender</span></a><span class="Other">(</span><span class="Identifier">blendMode</span><span class="Other">:</span> <a href="blends.html#BlendMode"><span class="Identifier">BlendMode</span></a><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">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>
|
||||||
|
|
||||||
|
Is there a blend function for a given blend mode with SIMD support?
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<a id="maskerSimd,BlendMode"></a>
|
<a id="maskerSimd,BlendMode"></a>
|
||||||
|
@ -297,7 +297,7 @@ Unpack the first 32 bits into 4 rgba(0, 0, 0, value)
|
||||||
<dt><pre><span class="Keyword">proc</span> <a href="#hasSimdMasker%2CBlendMode"><span class="Identifier">hasSimdMasker</span></a><span class="Other">(</span><span class="Identifier">blendMode</span><span class="Other">:</span> <a href="blends.html#BlendMode"><span class="Identifier">BlendMode</span></a><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">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>
|
<dt><pre><span class="Keyword">proc</span> <a href="#hasSimdMasker%2CBlendMode"><span class="Identifier">hasSimdMasker</span></a><span class="Other">(</span><span class="Identifier">blendMode</span><span class="Other">:</span> <a href="blends.html#BlendMode"><span class="Identifier">BlendMode</span></a><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">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>
|
||||||
|
|
||||||
|
Is there a blend masking function with SIMD support?
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ Unpack the first 32 bits into 4 rgba(0, 0, 0, value)
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:38 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:49 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -228,7 +228,7 @@ Converts a color from premultiplied alpha to straight alpha.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:38 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:49 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -185,7 +185,7 @@ Encodes an image into the BMP file format.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:39 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:50 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -185,7 +185,7 @@ Encodes Image into a JPEG data string.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:39 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:50 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -204,7 +204,7 @@ Encodes the mask data into the PNG file format.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:39 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:50 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -174,7 +174,7 @@ Render SVG file and return the image.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:40 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:51 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -479,7 +479,7 @@ Returns a new mask using the alpha values of the parameter image.
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
|
Gets a interpolated color with float point coordinates. Pixes outside the image are transparent.
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<a id="getRgbaSmoothWrapped,Image,float32,float32"></a>
|
<a id="getRgbaSmoothWrapped,Image,float32,float32"></a>
|
||||||
|
@ -487,7 +487,7 @@ Returns a new mask using the alpha values of the parameter image.
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
|
Gets a interpolated color with float point coordinates. Pixes outside the image are repeated.
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<a id="draw,Image,Image,Mat3"></a>
|
<a id="draw,Image,Image,Mat3"></a>
|
||||||
|
@ -579,7 +579,7 @@ Shifts the target by offset.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:38 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:50 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -357,7 +357,7 @@ A value of 0 stays 0. Anything else turns into 255.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:38 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:49 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -272,7 +272,7 @@ Angular gradient.
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:39 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:50 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -628,7 +628,7 @@ Return elements in pairs: (1st, 2nd), (2nd, 3rd) ... (n - 1, last).
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:39 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:51 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -917,7 +917,7 @@ window.addEventListener('DOMContentLoaded', main);
|
||||||
<div class="twelve-columns footer">
|
<div class="twelve-columns footer">
|
||||||
<span class="nim-sprite"></span>
|
<span class="nim-sprite"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:05:40 UTC</small>
|
<small style="color: var(--hint);">Made with Nim. Generated: 2021-02-25 15:15:51 UTC</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -45,6 +45,7 @@ proc min(a, b: uint32): uint32 {.inline.} =
|
||||||
if a < b: a else: b
|
if a < b: a else: b
|
||||||
|
|
||||||
proc alphaFix(backdrop, source, mixed: ColorRGBA): ColorRGBA =
|
proc alphaFix(backdrop, source, mixed: ColorRGBA): ColorRGBA =
|
||||||
|
## After mixing an image, adjust its alpha value to be correct.
|
||||||
let
|
let
|
||||||
sa = source.a.uint32
|
sa = source.a.uint32
|
||||||
ba = backdrop.a.uint32
|
ba = backdrop.a.uint32
|
||||||
|
@ -67,6 +68,7 @@ proc alphaFix(backdrop, source, mixed: ColorRGBA): ColorRGBA =
|
||||||
result.a = a.uint8
|
result.a = a.uint8
|
||||||
|
|
||||||
proc alphaFix(backdrop, source, mixed: Color): Color =
|
proc alphaFix(backdrop, source, mixed: Color): Color =
|
||||||
|
## After mixing an image, adjust its alpha value to be correct.
|
||||||
result.a = (source.a + backdrop.a * (1.0 - source.a))
|
result.a = (source.a + backdrop.a * (1.0 - source.a))
|
||||||
if result.a == 0:
|
if result.a == 0:
|
||||||
return
|
return
|
||||||
|
@ -85,6 +87,7 @@ proc alphaFix(backdrop, source, mixed: Color): Color =
|
||||||
result.b /= result.a
|
result.b /= result.a
|
||||||
|
|
||||||
proc blendAlpha*(backdrop, source: uint8): uint8 {.inline.} =
|
proc blendAlpha*(backdrop, source: uint8): uint8 {.inline.} =
|
||||||
|
## Blends alphas of backdrop, source.
|
||||||
source + ((backdrop.uint32 * (255 - source)) div 255).uint8
|
source + ((backdrop.uint32 * (255 - source)) div 255).uint8
|
||||||
|
|
||||||
proc screen(backdrop, source: uint32): uint8 {.inline.} =
|
proc screen(backdrop, source: uint32): uint8 {.inline.} =
|
||||||
|
@ -448,6 +451,7 @@ proc blendWhite(backdrop, source: ColorRGBA): ColorRGBA =
|
||||||
rgba(255, 255, 255, 255)
|
rgba(255, 255, 255, 255)
|
||||||
|
|
||||||
proc blender*(blendMode: BlendMode): Blender =
|
proc blender*(blendMode: BlendMode): Blender =
|
||||||
|
## Returns a blend function for a given blend mode.
|
||||||
case blendMode:
|
case blendMode:
|
||||||
of bmNormal: blendNormal
|
of bmNormal: blendNormal
|
||||||
of bmDarken: blendDarken
|
of bmDarken: blendDarken
|
||||||
|
@ -494,6 +498,7 @@ proc maskOverwrite(backdrop, source: uint8): uint8 =
|
||||||
source
|
source
|
||||||
|
|
||||||
proc masker*(blendMode: BlendMode): Masker =
|
proc masker*(blendMode: BlendMode): Masker =
|
||||||
|
## Returns a blend masking function for a given blend masking mode.
|
||||||
case blendMode:
|
case blendMode:
|
||||||
of bmNormal: maskNormal
|
of bmNormal: maskNormal
|
||||||
of bmMask: maskMask
|
of bmMask: maskMask
|
||||||
|
@ -601,6 +606,7 @@ when defined(amd64) and not defined(pixieNoSimd):
|
||||||
source
|
source
|
||||||
|
|
||||||
proc blenderSimd*(blendMode: BlendMode): BlenderSimd =
|
proc blenderSimd*(blendMode: BlendMode): BlenderSimd =
|
||||||
|
## Returns a blend function for a given blend mode with SIMD support.
|
||||||
case blendMode:
|
case blendMode:
|
||||||
of bmNormal: blendNormalSimd
|
of bmNormal: blendNormalSimd
|
||||||
of bmMask: blendMaskSimd
|
of bmMask: blendMaskSimd
|
||||||
|
@ -609,6 +615,7 @@ when defined(amd64) and not defined(pixieNoSimd):
|
||||||
raise newException(PixieError, "No SIMD blender for " & $blendMode)
|
raise newException(PixieError, "No SIMD blender for " & $blendMode)
|
||||||
|
|
||||||
proc hasSimdBlender*(blendMode: BlendMode): bool =
|
proc hasSimdBlender*(blendMode: BlendMode): bool =
|
||||||
|
## Is there a blend function for a given blend mode with SIMD support?
|
||||||
blendMode in {bmNormal, bmMask, bmOverwrite}
|
blendMode in {bmNormal, bmMask, bmOverwrite}
|
||||||
|
|
||||||
proc maskNormalSimd(backdrop, source: M128i): M128i =
|
proc maskNormalSimd(backdrop, source: M128i): M128i =
|
||||||
|
@ -670,6 +677,7 @@ when defined(amd64) and not defined(pixieNoSimd):
|
||||||
mm_or_si128(backdropEven, mm_slli_epi16(backdropOdd, 8))
|
mm_or_si128(backdropEven, mm_slli_epi16(backdropOdd, 8))
|
||||||
|
|
||||||
proc maskerSimd*(blendMode: BlendMode): MaskerSimd =
|
proc maskerSimd*(blendMode: BlendMode): MaskerSimd =
|
||||||
|
## Returns a blend masking function with SIMD support.
|
||||||
case blendMode:
|
case blendMode:
|
||||||
of bmNormal: maskNormalSimd
|
of bmNormal: maskNormalSimd
|
||||||
of bmMask: maskMaskSimd
|
of bmMask: maskMaskSimd
|
||||||
|
@ -678,6 +686,7 @@ when defined(amd64) and not defined(pixieNoSimd):
|
||||||
raise newException(PixieError, "No SIMD masker for " & $blendMode)
|
raise newException(PixieError, "No SIMD masker for " & $blendMode)
|
||||||
|
|
||||||
proc hasSimdMasker*(blendMode: BlendMode): bool =
|
proc hasSimdMasker*(blendMode: BlendMode): bool =
|
||||||
|
## Is there a blend masking function with SIMD support?
|
||||||
blendMode in {bmNormal, bmMask, bmOverwrite}
|
blendMode in {bmNormal, bmMask, bmOverwrite}
|
||||||
|
|
||||||
when defined(release):
|
when defined(release):
|
||||||
|
|
|
@ -511,6 +511,8 @@ proc newMask*(image: Image): Mask =
|
||||||
result.data[j] = image.data[j].a
|
result.data[j] = image.data[j].a
|
||||||
|
|
||||||
proc getRgbaSmooth*(image: Image, x, y: float32): ColorRGBA =
|
proc getRgbaSmooth*(image: Image, x, y: float32): ColorRGBA =
|
||||||
|
## Gets a interpolated color with float point coordinates.
|
||||||
|
## Pixes outside the image are transparent.
|
||||||
let
|
let
|
||||||
minX = floor(x)
|
minX = floor(x)
|
||||||
minY = floor(y)
|
minY = floor(y)
|
||||||
|
@ -530,6 +532,8 @@ proc getRgbaSmooth*(image: Image, x, y: float32): ColorRGBA =
|
||||||
lerp(bottomMix, topMix, diffY)
|
lerp(bottomMix, topMix, diffY)
|
||||||
|
|
||||||
proc getRgbaSmoothWrapped*(image: Image, x, y: float32): ColorRGBA =
|
proc getRgbaSmoothWrapped*(image: Image, x, y: float32): ColorRGBA =
|
||||||
|
## Gets a interpolated color with float point coordinates.
|
||||||
|
## Pixes outside the image are repeated.
|
||||||
let
|
let
|
||||||
minX = floor(x)
|
minX = floor(x)
|
||||||
minY = floor(y)
|
minY = floor(y)
|
||||||
|
|
Loading…
Reference in a new issue