Giter VIP home page Giter VIP logo

Comments (1)

davepagurek avatar davepagurek commented on July 18, 2024

Previously, get() would always return an image of pixel density 1, regardless of the density of the main canvas, making it impossible to capture the full resolution of the canvas to a p5.Image. Now, it continues to use the same density as the main canvas. So while previously get() would return an image 1/100th of the size of the main canvas if you used pixelDensity(10), it will now be using the full size.

I think if you wanted to replicate the old behaviour, you would have to createGraphics(width, height), set its pixel density to 1, and then use image() to draw the main canvas to the graphic (which is essentially what it was doing under the hood before.) I tried making a little demo here: https://editor.p5js.org/davepagurek/sketches/qA0891h1z

Also, in that version, you can try setting the pixel density of the graphic to 10 too, and it doesn't lag nearly as much as the image version. Seems to be garbage collection is the main thing making it lag, so if you reuse a graphic rather than making new images, it seems to run more smoothly.

from p5.js.

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.