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
Image mime data tracking #167
Conversation
…of mime API behind cairo version conditional.
… data memory handling.
@@ -58,6 +53,11 @@ | |||
proto->SetAccessor(String::NewSymbol("height"), GetHeight); | |||
proto->SetAccessor(String::NewSymbol("onload"), GetOnload, SetOnload); | |||
proto->SetAccessor(String::NewSymbol("onerror"), GetOnerror, SetOnerror); | |||
#if CAIRO_VERSION_MINOR >= 10 | |||
proto->SetAccessor(String::NewSymbol("dataMode"), GetDataMode, SetDataMode); | |||
constructor->Set(String::NewSymbol("MODE_IMAGE"), Number::New(1)); |
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.
we should use the enums here instead of the literal value
looks good! my gut feeling is that this stuff is a bit out of scope for the module but if you guys are finding it useful likely someone else will too |
Thanks for the merge. Yeah this is definitely near the edge of where the module functionality should be, but kind of needed for building PDFs efficiently. I've introduced error handling for jpeg decoding and some colour space detection in my fork, which fixes a lot of the issues relating to crashing on random images. (https://github.com/c-spencer/node-canvas) Will probably pull request next week, or you can pull across. Just making it a bit more robust. |
Final (for now ;)) and largest pull request, adds Mime data options to Image. This means that the cairo pdf backend can directly embed source jpegs.
This commit should also make drawImage work on cairo < 1.10 (#52) as to keep mime data tracked, the intermediate surface used had to be eliminated.