Skip to content
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

Merged
merged 6 commits into from May 4, 2012
Merged

Image mime data tracking #167

merged 6 commits into from May 4, 2012

Conversation

c-spencer
Copy link
Contributor

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.

@@ -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));
Copy link
Contributor

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

@tj
Copy link
Contributor

tj commented May 4, 2012

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

tj added a commit that referenced this pull request May 4, 2012
@tj tj merged commit 20153eb into Automattic:master May 4, 2012
@c-spencer
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants