Coder Social home page Coder Social logo

Comments (4)

jangko avatar jangko commented on June 11, 2024

please report this to Nim repo as a regression. it is very hard to fix it from nimPNG.

from nimpng.

ftsf avatar ftsf commented on June 11, 2024

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.

ftsf avatar ftsf commented on June 11, 2024

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.

jangko avatar jangko commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.