This commit is contained in:
Ryan Oldenburg 2020-11-20 23:09:52 -06:00
parent 2ee05e25ef
commit 3eebfdb902
2 changed files with 16 additions and 10 deletions

View file

@ -1,11 +1,17 @@
# Full-featured 2d graphics library for Nim.
# Pixie - A full-featured 2D graphics library for Nim
Written in pure nim. Basis for the fidget UI library.
⚠️ WARNING: This library is still in heavy development. ⚠️
Features:
* images
* paths
* masks
Pixie is a 2D graphics library similar to [Cairo](https://www.cairographics.org/) and [Skia](https://skia.org) written entirely in Nim.
Supported File formats reading and writing:
* BMP (RGBA Only)
Features include:
* Drawing paths, shapes and curves
* Complex masking
* Shadows, glows and effects
* Loading image file formats (PNG, BMP, + more in development)
This library is being actively developed and is not yet ready for use. Since you've managed to stumble onto it, give it a star and check back soon!
## Testing
`nimble test`

View file

@ -21,7 +21,7 @@ proc toImage*(mask: Mask): Image =
for i in 0 ..< mask.data.len:
result.data[i].a = mask.data[i]
proc decodeImage(data: string | seq[uint8]): Image =
proc decodeImage*(data: string | seq[uint8]): Image =
## Loads an image from a memory.
if data.len > 8 and cast[array[8, uint8]](data.readUint64(0)) == pngSignature:
return decodePng(data)
@ -35,7 +35,7 @@ proc readImage*(filePath: string): Image =
## Loads an image from a file.
decodeImage(readFile(filePath))
proc encodeImage(image: Image, fileFormat: FileFormat): string =
proc encodeImage*(image: Image, fileFormat: FileFormat): string =
## Encodes an image into a memory.
case fileFormat:
of ffPng: