Better readme.

This commit is contained in:
treeform 2020-12-04 09:41:28 -08:00
parent a3491867ad
commit 77e243f232
2 changed files with 11 additions and 5 deletions

View file

@ -18,7 +18,8 @@ This library is being actively developed and is not yet ready for use. Since you
## Examples
### examples/blur.nim
### Blur
[examples/blur.nim](examples/blur.nim)
```nim
var p = newPath()
p.polygon(100, 100, 70, sides=6)
@ -32,7 +33,8 @@ image.draw(blur)
```
![example output](examples/blur.png)
### examples/rounded_rectangle.nim
### Rounded rectangle
[examples/rounded_rectangle.nim](examples/rounded_rectangle.nim)
```nim
var path = newPath()
let
@ -51,7 +53,8 @@ image.fillPath(path, rgba(255, 0, 0, 255))
```
![example output](examples/rounded_rectangle.png)
### examples/square.nim
### Square
[examples/square.nim](examples/square.nim)
```nim
var p = newPath()
p.moveTo(50, 50)
@ -63,7 +66,8 @@ image.fillPath(p, rgba(255, 0, 0, 255))
```
![example output](examples/square.png)
### examples/tiger.nim
### Tiger
[examples/tiger.nim](examples/tiger.nim)
```nim
var tiger = readImage("examples/data/tiger.svg")
image.draw(

View file

@ -16,7 +16,9 @@ for k, path in walkDir("examples"):
let code = readFile(path)
let innerCode = code.cutBetween("image.fill(rgba(255, 255, 255, 255))", "image.writeFile")
if innerCode != "":
md.add "### " & path.replace("\\", "/")
let path = path.replace("\\", "/")
md.add "### " & path.splitFile().name.replace("_", " ").capitalizeAscii()
md.add "[" & path & "](" & path & ")"
md.add "```nim"
md.add innerCode.strip()
md.add "```"