caleb531 / jcanvas

A jQuery plugin that makes the HTML5 canvas easy to work with.
https://projects.calebevans.me/jcanvas/
MIT License
626 stars 192 forks source link

I Need X,Y coordinates in function setPixels (each) #119

Closed Walt7 closed 11 years ago

Walt7 commented 11 years ago

pls can you add this two line in your code at jCanvas v13.08.26 line 3460:

            // Loop through pixels with the "each" callback function
            if (params.each) {
                for (i = 0; i < len; i += 4) {
                    px.r = data[i];
                    px.g = data[i + 1];
                    px.b = data[i + 2];
                    px.a = data[i + 3];
                                            px.Y= Math.floor(i/4/params.width); /* this */
                                            px.X= (i/4) % params.width;            /* this */
                    params.each.call(canvas, px);
                    data[i] = px.r;
                    data[i + 1] = px.g;
                    data[i + 2] = px.b;
                    data[i + 3] = px.a;
                }
            }

X and Y are necessary for my rendering

Tks

W:-}

caleb531 commented 11 years ago

Thanks for the suggestion. I'll have this added in the next release.

-Caleb