1.1.2: Update deps and docs.
This commit is contained in:
parent
4aa1afc0c2
commit
75915ab05f
21 changed files with 59 additions and 67 deletions
File diff suppressed because one or more lines are too long
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:23 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:23 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -161,7 +161,7 @@ Decodes GIF data into an Image.
|
|||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:40 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:25 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -586,7 +586,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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:24 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -150,6 +150,11 @@ function main() {
|
|||
<li><a class="reference" href="#%24%2CPath"
|
||||
title="`$`(path: Path): string">$,<wbr>Path</a></li>
|
||||
|
||||
</ul>
|
||||
<ul class="simple nested-toc-section">circle
|
||||
<li><a class="reference" href="#circle%2CPath%2CVec2%2Cfloat32"
|
||||
title="circle(path: var Path; center: Vec2; r: float32)">circle,<wbr>Path,<wbr>Vec2,<wbr>float32</a></li>
|
||||
|
||||
</ul>
|
||||
<ul class="simple nested-toc-section">strokePath
|
||||
<li><a class="reference" href="#strokePath%2CImage%2CSomePath%2CSomeColor%2Cfloat"
|
||||
|
@ -270,14 +275,6 @@ function main() {
|
|||
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class="reference reference-toplevel" href="#15" id="65">Iterators</a>
|
||||
<ul class="simple simple-toc-section">
|
||||
<li><a class="reference" href="#segments.i%2Cseq%5BVec2%5D"
|
||||
title="segments(s: seq[Vec2]): Segment">segments</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -541,6 +538,14 @@ Adds a ellipse.
|
|||
|
||||
Adds a ellipse.
|
||||
|
||||
</dd>
|
||||
<a id="circle,Path,Vec2,float32"></a>
|
||||
<dt><pre><span class="Keyword">proc</span> <a href="#circle%2CPath%2CVec2%2Cfloat32"><span class="Identifier">circle</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">center</span><span class="Other">:</span> <span class="Identifier">Vec2</span><span class="Other">;</span> <span class="Identifier">r</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">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>
|
||||
|
||||
Adds a circle.
|
||||
|
||||
</dd>
|
||||
<a id="polygon,Path,float32,float32,float32,int"></a>
|
||||
<dt><pre><span class="Keyword">proc</span> <a href="#polygon%2CPath%2Cfloat32%2Cfloat32%2Cfloat32%2Cint"><span class="Identifier">polygon</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</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">size</span><span class="Other">:</span> <span class="Identifier">float32</span><span class="Other">;</span> <span class="Identifier">sides</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>
|
||||
|
@ -641,18 +646,6 @@ Strokes a path.
|
|||
|
||||
</dd>
|
||||
|
||||
</dl></div>
|
||||
<div class="section" id="15">
|
||||
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
|
||||
<dl class="item">
|
||||
<a id="segments.i,seq[Vec2]"></a>
|
||||
<dt><pre><span class="Keyword">iterator</span> <a href="#segments.i%2Cseq%5BVec2%5D"><span class="Identifier">segments</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">Vec2</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Segment</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>
|
||||
|
||||
Return elements in pairs: (1st, 2nd), (2nd, 3rd) ... (n - 1, last).
|
||||
|
||||
</dd>
|
||||
|
||||
</dl></div>
|
||||
|
||||
</div>
|
||||
|
@ -662,7 +655,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-03-12 03:47:39 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:25 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -56,10 +56,10 @@ roundedRect pixie/paths.html#roundedRect,Path,Vec2,Vec2,float32,float32,float32,
|
|||
roundedRect pixie/paths.html#roundedRect,Path,Rect,float32,float32,float32,float32 paths: roundedRect(path: var Path; rect: Rect; nw, ne, se, sw: float32;\n clockwise = true)
|
||||
ellipse pixie/paths.html#ellipse,Path,float32,float32,float32,float32 paths: ellipse(path: var Path; cx, cy, rx, ry: float32)
|
||||
ellipse pixie/paths.html#ellipse,Path,Vec2,float32,float32 paths: ellipse(path: var Path; center: Vec2; rx, ry: float32)
|
||||
circle pixie/paths.html#circle,Path,Vec2,float32 paths: circle(path: var Path; center: Vec2; r: float32)
|
||||
polygon pixie/paths.html#polygon,Path,float32,float32,float32,int paths: polygon(path: var Path; x, y, size: float32; sides: int)
|
||||
polygon pixie/paths.html#polygon,Path,Vec2,float32,int paths: polygon(path: var Path; pos: Vec2; size: float32; sides: int)
|
||||
commandsToShapes pixie/paths.html#commandsToShapes,Path,float32 paths: commandsToShapes(path: Path; pixelScale: float32 = 1.0): seq[seq[Vec2]]
|
||||
segments pixie/paths.html#segments.i,seq[Vec2] paths: segments(s: seq[Vec2]): Segment
|
||||
fillPath pixie/paths.html#fillPath,Image,SomePath,SomeColor paths: fillPath(image: Image; path: SomePath; color: SomeColor;\n windingRule = wrNonZero; blendMode = bmNormal)
|
||||
fillPath pixie/paths.html#fillPath,Image,SomePath,SomeColor, paths: fillPath(image: Image; path: SomePath; color: SomeColor; transform: Vec2 | Mat3;\n windingRule = wrNonZero; blendMode = bmNormal)
|
||||
fillPath pixie/paths.html#fillPath,Mask,SomePath paths: fillPath(mask: Mask; path: SomePath; windingRule = wrNonZero)
|
||||
|
|
|
@ -238,6 +238,10 @@ function main() {
|
|||
<li><a class="reference external"
|
||||
data-doc-search-tag="masks: ceil(mask: Mask)" href="pixie/masks.html#ceil%2CMask">masks: ceil(mask: Mask)</a></li>
|
||||
</ul></dd>
|
||||
<dt><a name="circle" href="#circle"><span>circle:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="paths: circle(path: var Path; center: Vec2; r: float32)" href="pixie/paths.html#circle%2CPath%2CVec2%2Cfloat32">paths: circle(path: var Path; center: Vec2; r: float32)</a></li>
|
||||
</ul></dd>
|
||||
<dt><a name="Close" href="#Close"><span>Close:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="PathCommandKind.Close" href="pixie/paths.html#Close">PathCommandKind.Close</a></li>
|
||||
|
@ -772,10 +776,6 @@ function main() {
|
|||
<li><a class="reference external"
|
||||
data-doc-search-tag="PathCommandKind.SCubic" href="pixie/paths.html#SCubic">PathCommandKind.SCubic</a></li>
|
||||
</ul></dd>
|
||||
<dt><a name="segments" href="#segments"><span>segments:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="paths: segments(s: seq[Vec2]): Segment" href="pixie/paths.html#segments.i%2Cseq%5BVec2%5D">paths: segments(s: seq[Vec2]): Segment</a></li>
|
||||
</ul></dd>
|
||||
<dt><a name="setRgbaUnsafe" href="#setRgbaUnsafe"><span>setRgbaUnsafe:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="images: setRgbaUnsafe(image: Image; x, y: int; color: SomeColor)" href="pixie/images.html#setRgbaUnsafe%2CImage%2Cint%2Cint%2CSomeColor">images: setRgbaUnsafe(image: Image; x, y: int; color: SomeColor)</a></li>
|
||||
|
@ -945,7 +945,7 @@ function main() {
|
|||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-12 03:47:40 UTC</small>
|
||||
<small style="color: var(--hint);">Made with Nim. Generated: 2021-03-26 21:09:25 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version = "1.1.1"
|
||||
version = "1.1.2"
|
||||
author = "Andre von Houck and Ryan Oldenburg"
|
||||
description = "Full-featured 2d graphics library for Nim."
|
||||
license = "MIT"
|
||||
|
@ -6,12 +6,12 @@ license = "MIT"
|
|||
srcDir = "src"
|
||||
|
||||
requires "nim >= 1.2.6"
|
||||
requires "vmath >= 0.4.0"
|
||||
requires "vmath >= 1.0.0"
|
||||
requires "chroma >= 0.2.5"
|
||||
requires "zippy >= 0.3.5"
|
||||
requires "flatty >= 0.1.3"
|
||||
requires "nimsimd >= 1.0.0"
|
||||
requires "bumpy >= 1.0.2"
|
||||
requires "bumpy >= 1.0.3"
|
||||
|
||||
task docs, "Generate API documents":
|
||||
exec "nim doc --index:on --project --out:docs --hints:off src/pixie.nim"
|
||||
|
|
|
@ -163,12 +163,12 @@ proc decodeCtx(inherited: Ctx, node: XmlNode): Ctx =
|
|||
if arr.len != 6:
|
||||
failInvalidTransform(transform)
|
||||
var m = mat3()
|
||||
m[0] = parseFloat(arr[0].strip())
|
||||
m[1] = parseFloat(arr[1].strip())
|
||||
m[3] = parseFloat(arr[2].strip())
|
||||
m[4] = parseFloat(arr[3].strip())
|
||||
m[6] = parseFloat(arr[4].strip())
|
||||
m[7] = parseFloat(arr[5].strip())
|
||||
m[0, 0] = parseFloat(arr[0].strip())
|
||||
m[0, 1] = parseFloat(arr[1].strip())
|
||||
m[1, 0] = parseFloat(arr[2].strip())
|
||||
m[1, 1] = parseFloat(arr[3].strip())
|
||||
m[2, 0] = parseFloat(arr[4].strip())
|
||||
m[2, 1] = parseFloat(arr[5].strip())
|
||||
result.transform = result.transform * m
|
||||
elif f.startsWith("translate("):
|
||||
let
|
||||
|
@ -183,7 +183,7 @@ proc decodeCtx(inherited: Ctx, node: XmlNode): Ctx =
|
|||
elif f.startsWith("rotate("):
|
||||
let
|
||||
values = f[7 .. ^2].split(" ")
|
||||
angle = parseFloat(values[0].strip()) * -PI / 180
|
||||
angle: float32 = parseFloat(values[0].strip()) * -PI / 180
|
||||
var cx, cy: float32
|
||||
if values.len > 1:
|
||||
cx = parseFloat(values[1].strip())
|
||||
|
@ -191,7 +191,7 @@ proc decodeCtx(inherited: Ctx, node: XmlNode): Ctx =
|
|||
cy = parseFloat(values[2].strip())
|
||||
let center = vec2(cx, cy)
|
||||
result.transform = result.transform *
|
||||
translate(center) * rotationMat3(angle) * translate(-center)
|
||||
translate(center) * rotate(angle) * translate(-center)
|
||||
else:
|
||||
failInvalidTransform(transform)
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ proc fillRadialGradient*(
|
|||
gradientAngle = normalize(center - edge).angle().fixAngle()
|
||||
mat = (
|
||||
translate(center) *
|
||||
rotationMat3(-gradientAngle) *
|
||||
rotate(-gradientAngle) *
|
||||
scale(vec2(distanceX, distanceY))
|
||||
).inverse()
|
||||
for y in 0 ..< image.height:
|
||||
|
|
|
@ -543,6 +543,10 @@ proc ellipse*(path: var Path, center: Vec2, rx, ry: float32) {.inline.} =
|
|||
## Adds a ellipse.
|
||||
path.ellipse(center.x, center.y, rx, ry)
|
||||
|
||||
proc circle*(path: var Path, center: Vec2, r: float32) {.inline.} =
|
||||
## Adds a circle.
|
||||
path.ellipse(center.x, center.y, r, r)
|
||||
|
||||
proc polygon*(path: var Path, x, y, size: float32, sides: int) =
|
||||
## Draws an n-sided regular polygon at (x, y) with the parameter size.
|
||||
path.moveTo(x + size * cos(0.0), y + size * sin(0.0))
|
||||
|
@ -658,7 +662,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
radiiSq = vec2(radii.x * radii.x, radii.y * radii.y)
|
||||
|
||||
let
|
||||
radians = rotation / 180 * PI
|
||||
radians: float32 = rotation / 180 * PI
|
||||
d = vec2((at.x - to.x) / 2.0, (at.y - to.y) / 2.0)
|
||||
p = vec2(
|
||||
cos(radians) * d.x + sin(radians) * d.y,
|
||||
|
@ -714,7 +718,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
|
||||
ArcParams(
|
||||
radii: radii,
|
||||
rotMat: rotationMat3(-radians),
|
||||
rotMat: rotate(-radians),
|
||||
center: center,
|
||||
theta: theta,
|
||||
delta: delta
|
||||
|
@ -789,7 +793,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
ctrl2 = vec2(command.numbers[0], command.numbers[1])
|
||||
to = vec2(command.numbers[2], command.numbers[3])
|
||||
if prevCommandKind in {Cubic, SCubic, RCubic, RSCubic}:
|
||||
let ctrl1 = 2 * at - prevCtrl2
|
||||
let ctrl1 = at * 2 - prevCtrl2
|
||||
shape.addCubic(at, ctrl1, ctrl2, to)
|
||||
else:
|
||||
shape.addCubic(at, at, ctrl2, to)
|
||||
|
@ -809,7 +813,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
to = vec2(command.numbers[0], command.numbers[1])
|
||||
ctrl =
|
||||
if prevCommandKind in {Quad, TQuad, RQuad, RTQuad}:
|
||||
2 * at - prevCtrl
|
||||
at * 2 - prevCtrl
|
||||
else:
|
||||
at
|
||||
shape.addQuadratic(at, ctrl, to)
|
||||
|
@ -864,7 +868,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
to = vec2(at.x + command.numbers[2], at.y + command.numbers[3])
|
||||
ctrl1 =
|
||||
if prevCommandKind in {Cubic, SCubic, RCubic, RSCubic}:
|
||||
2 * at - prevCtrl2
|
||||
at * 2 - prevCtrl2
|
||||
else:
|
||||
at
|
||||
shape.addCubic(at, ctrl1, ctrl2, to)
|
||||
|
@ -884,7 +888,7 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
to = vec2(at.x + command.numbers[0], at.y + command.numbers[1])
|
||||
ctrl =
|
||||
if prevCommandKind in {Quad, TQuad, RQuad, RTQuad}:
|
||||
2 * at - prevCtrl
|
||||
at * 2 - prevCtrl
|
||||
else:
|
||||
at
|
||||
shape.addQuadratic(at, ctrl, to)
|
||||
|
@ -914,11 +918,6 @@ proc commandsToShapes*(path: Path, pixelScale: float32 = 1.0): seq[seq[Vec2]] =
|
|||
if shape.len > 0:
|
||||
result.add(shape)
|
||||
|
||||
iterator segments*(s: seq[Vec2]): Segment =
|
||||
## Return elements in pairs: (1st, 2nd), (2nd, 3rd) ... (n - 1, last).
|
||||
for i in 0 ..< s.len - 1:
|
||||
yield(segment(s[i], s[i + 1]))
|
||||
|
||||
proc quickSort(a: var seq[(float32, int16)], inl, inr: int) =
|
||||
## Sorts in place + faster than standard lib sort.
|
||||
var
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
|
@ -17,7 +17,7 @@ block:
|
|||
a.fill(rgba(255, 0, 0, 255))
|
||||
b.fill(rgba(0, 255, 0, 255))
|
||||
|
||||
a.draw(b, translate(vec2(250, 250)) * rotationMat3(90 * PI / 180))
|
||||
a.draw(b, translate(vec2(250, 250)) * rotate(90 * PI.float32 / 180))
|
||||
a.writeFile("tests/images/rotate90.png")
|
||||
|
||||
block:
|
||||
|
@ -27,7 +27,7 @@ block:
|
|||
a.fill(rgba(255, 0, 0, 255))
|
||||
b.fill(rgba(0, 255, 0, 255))
|
||||
|
||||
a.draw(b, translate(vec2(250, 250)) * rotationMat3(180 * PI / 180))
|
||||
a.draw(b, translate(vec2(250, 250)) * rotate(180 * PI.float32 / 180))
|
||||
a.writeFile("tests/images/rotate180.png")
|
||||
|
||||
block:
|
||||
|
@ -37,7 +37,7 @@ block:
|
|||
a.fill(rgba(255, 0, 0, 255))
|
||||
b.fill(rgba(0, 255, 0, 255))
|
||||
|
||||
a.draw(b, translate(vec2(250, 250)) * rotationMat3(270 * PI / 180))
|
||||
a.draw(b, translate(vec2(250, 250)) * rotate(270 * PI.float32 / 180))
|
||||
a.writeFile("tests/images/rotate270.png")
|
||||
|
||||
block:
|
||||
|
@ -47,7 +47,7 @@ block:
|
|||
a.fill(rgba(255, 0, 0, 255))
|
||||
b.fill(rgba(0, 255, 0, 255))
|
||||
|
||||
a.draw(b, translate(vec2(250, 250)) * rotationMat3(360 * PI / 180))
|
||||
a.draw(b, translate(vec2(250, 250)) * rotate(360 * PI.float32 / 180))
|
||||
a.writeFile("tests/images/rotate360.png")
|
||||
|
||||
block:
|
||||
|
|
Loading…
Reference in a new issue