Giter VIP home page Giter VIP logo

Comments (8)

lmccart avatar lmccart commented on May 17, 2024

reworking all this to better match processing reference

from p5.js.

lmccart avatar lmccart commented on May 17, 2024

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-createimagedata

from p5.js.

lmccart avatar lmccart commented on May 17, 2024

In general, PImage needs review and reworking. One issue is canvas tainting by loading outside images, needs more investigation.

Also keep in mind adding option to disable pixel load with flag set:
https://github.com/lmccart/p5.js/issues/92

And check that the pixel stuff works out:
https://github.com/lmccart/p5.js/issues/42

from p5.js.

evhan55 avatar evhan55 commented on May 17, 2024

I am curious about this and will tackle it along with unit testing once the refactoring work is ready.

from p5.js.

tafsiri avatar tafsiri commented on May 17, 2024

An update on the canvas tainting from outside images. It is indeed because of same origin security policy. At the moment I do not see a purely client side solution for arbitraty remote images (indeed such a solution would be an exploit from the perspective of the spec).

Some searching led to https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image, which suggests how to make this work if the server serves the image with the right headers. I've added the crossOrigin = 'anonymous' flag to the code i'm currently working on and it works for that class of image. Else the image would need to be served from the same domain as the sketch.

from p5.js.

lmccart avatar lmccart commented on May 17, 2024

@tafsiri does it make sense to close this, as remaining parts are addressed under other issues?

from p5.js.

evhan55 avatar evhan55 commented on May 17, 2024

Thanks @tafsiri for looking into the cross-domain issue. For servers not serving that header, we should expect the error. I was talking to @lmccart and think this constraint should serve as a good teaching opportunity to bring cross-domain security issues to light for beginners. Basically, the PImage API should come with some documentation about this possible security error, and an explanation of why it exists.

I would vote for closing this issue!

from p5.js.

tafsiri avatar tafsiri commented on May 17, 2024

hey hey (sorry for late reply), yeah i think this could be closed and more specific bugs made. I'll be making one for blur as i have some thoughts on that. And we'll need another one for filter as that is not actually complete (so in a sense PImage is not done and you could choose to keep this open as a tracking bug—maybe just update the checkboxes above). So I could see going either way.

One other note is that tint(), noTint() are not actually part of the PImage api. In Processing it seems to be a state set to the drawing context that applies to image drawing operations. So we would need issues for that, or we could decide to include it in the PImage api.

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.