mirror of https://github.com/status-im/nimPNG.git
fixes #19
This commit is contained in:
parent
7a98fec6cd
commit
c55008c163
|
@ -29,7 +29,7 @@ import streams, endians, tables, hashes, math
|
||||||
import private.buffer, private.nimz
|
import private.buffer, private.nimz
|
||||||
|
|
||||||
const
|
const
|
||||||
NIM_PNG_VERSION = "0.2.0"
|
NIM_PNG_VERSION = "0.2.1"
|
||||||
|
|
||||||
type
|
type
|
||||||
PNGChunkType = distinct int32
|
PNGChunkType = distinct int32
|
||||||
|
@ -2021,7 +2021,7 @@ proc decodePNG*(s: Stream, settings = PNGDecoder(nil)): PNG =
|
||||||
result = png
|
result = png
|
||||||
|
|
||||||
when not defined(js):
|
when not defined(js):
|
||||||
proc loadPNG*(fileName: string, colorType: PNGColorType, bitDepth: int, settings: PNGDecoder): PNGResult =
|
proc loadPNG*(fileName: string, colorType: PNGColorType, bitDepth: int, settings: PNGDecoder = nil): PNGResult =
|
||||||
try:
|
try:
|
||||||
var s = newFileStream(fileName, fmRead)
|
var s = newFileStream(fileName, fmRead)
|
||||||
if s == nil: return nil
|
if s == nil: return nil
|
||||||
|
@ -3165,7 +3165,7 @@ proc encoderCore(png: PNG) =
|
||||||
raise PNGError("unexisting interlace mode")
|
raise PNGError("unexisting interlace mode")
|
||||||
|
|
||||||
if not bitDepthAllowed(modeOut.colorType, modeOut.bitDepth):
|
if not bitDepthAllowed(modeOut.colorType, modeOut.bitDepth):
|
||||||
raise PNGError("colorType and bitDepth combination not allowed")
|
raise PNGError("colorType and bitDepth combination not allowed")
|
||||||
|
|
||||||
if not png.isAPNG: png.apngPixels = @[""]
|
if not png.isAPNG: png.apngPixels = @[""]
|
||||||
shallowCopy(png.apngPixels[0], png.pixels)
|
shallowCopy(png.apngPixels[0], png.pixels)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Package
|
# Package
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
author = "Andri Lim"
|
author = "Andri Lim"
|
||||||
description = "PNG encoder and decoder"
|
description = "PNG encoder and decoder"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
Loading…
Reference in New Issue