add -d:useStb

This commit is contained in:
Ryan Oldenburg 2021-01-21 19:07:07 -06:00
parent d337e04732
commit 773036a3ba
2 changed files with 18 additions and 11 deletions

View file

@ -1,10 +1,16 @@
import pixie/images, pixie/common, pixie/fileformats/stb_image/stb_image import pixie/images, pixie/common
when defined(useStb):
import pixie/fileformats/stb_image/stb_image
const const
jpgStartOfImage* = [0xFF.uint8, 0xD8] jpgStartOfImage* = [0xFF.uint8, 0xD8]
proc decodeJpg*(data: seq[uint8]): Image = proc decodeJpg*(data: seq[uint8]): Image =
## Decodes the JPEG into an Image. ## Decodes the JPEG into an Image.
when not defined(useStb):
raise newException(PixieError, "Decoding JPG requires -d:useStb")
else:
var var
width: int width: int
height: int height: int

View file

@ -1,3 +1,4 @@
when defined(useStb):
import pixie/fileformats/jpg import pixie/fileformats/jpg
let let