Comments (4)
please report this to Nim repo as a regression. it is very hard to fix it from nimPNG.
from nimpng.
Hmm, I've just gone and tested this with Nim 1.4 and Nim 1.2 and get the same behaviour, so it seems this is not caused by a recent change in Nim.
from nimpng.
Testing using a cutdown example doesn't reproduce the problem.
import nimPNG
import os
import strformat
import strutils
import times
import sdl2_nim/sdl
var swCanvas32: Surface
var writePath = "."
proc saveScreenshot*() =
echo "saveScreenshot"
createDir(writePath & "/screenshots")
let filename = joinPath(writePath, joinPath("screenshots", "screenshot-$1T$2.png".format(getDateStr(), getClockStr())))
var data = newSeq[uint8](swCanvas32.w * swCanvas32.h * 4)
copyMem(data[0].addr, swCanvas32.pixels, swCanvas32.w * swCanvas32.h * 4)
var res = savePNG(filename, data, LCT_RGBA, 32, swCanvas32.w, swCanvas32.h)
echo "saved screenshot to: ", filename
saveScreenshot()
Compiles successfully, but similar code used in nico gives the original error, though I'm unsure why, will investigate further.
from nimpng.
looks like a global scope pollution to me. some inner template in filters.nim
might collide with other template from somewhere.
a workaround is, you can write a helper module+proc to force instantiate nimPNG generics and then reexport those non-generic proc.
from nimpng.
Related Issues (20)
- Throw exceptions on errors instead of writing to stdout HOT 12
- Tests fail when using --gc:arc HOT 3
- This hash look up in calculateColorProfile is the slowest part of saving an image. HOT 2
- compiletime decoder HOT 2
- New API βΒ can't savePNG32 with a seq[uint8] HOT 2
- Error: unhandled exception: cannot read from stream [IOError] HOT 4
- Improve chunk parser flexibility when decoding incomplete input data.
- savePNG doesn't work for arrays
- Allow parsing into different data types HOT 1
- How to remove all unnecessary data HOT 8
- Enable user to configure compression library settings
- Need better documentation for encoder settings
- Warning: conversion to enum with holes is unsafe: PNGColorType(typ`gensym14) [HoleEnumConv]
- Doesn't compile on Nim devel due to `shallowCopy` being removed from the language.
- `decodePNG` colorType unexpected HOT 3
- savePNGImpl maybe have bug? HOT 3
- Doesn't work by default on Nim v2.0.0 HOT 2
- nimPNG relies on bugs of `newString` to work
- Move tests to another repo HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimpng.