-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose ImageData constructor #569
Conversation
+1 from me, but we should add it to documentation too then. |
I will investigate further because it only works with the internal CanvasPixelArray objects. |
@targos Could you rebase on master? Also, adding documentation and tests will greatly increase the chances of this getting merged. |
1166b12
to
73e5900
Compare
I just found that the constructor does not behave correctly. For example, |
I pushed an update to ImageData.cc + tests. PTAL |
Looks good! |
7adca4b
to
a51536e
Compare
if (width == 0) { | ||
Nan::ThrowRangeError("The source width is zero."); | ||
return; | ||
} else if (size % width != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need else
here, please change to
}
if (size % width != 0) {
One small nit and if you could please rebase on master again (sorry), we have updated the travis config and it will ensure that your tests runs with our new config. Thank you! |
a51536e
to
feac9a2
Compare
feac9a2
to
2884267
Compare
@LinusU done :) |
Cool! Merging now 👍 |
Released as 1.3.0 \o/ |
Thank you! |
I need the ImageData constructor and I currently have to get it
with require('canvas/lib/bindings').ImageData
Example use: convert a pixel array to dataURL