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

boolean() and overlayWith() accept raw buffers as input #516

Closed
wants to merge 5 commits into from
Closed

boolean() and overlayWith() accept raw buffers as input #516

wants to merge 5 commits into from

Conversation

mhirsch
Copy link
Contributor

@mhirsch mhirsch commented Jul 19, 2016

This PR allows boolean() and overlayWith() to accept raw buffers, just as sharp() does. It uses the same options.raw syntax as sharp().

return this;
};

/*
Overlay with another image, using an optional gravity
*/
Sharp.prototype.overlayWith = function(overlay, options) {
/* jshint maxcomplexity:16 */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need much higher test coverage at this complexity level. However a better approach here is probably to abstract the common logic for the various file/Buffer/raw input to a separate function and keep the boolean and overlayWith functions themselves simpler.

@coveralls
Copy link

coveralls commented Jul 22, 2016

Coverage Status

Coverage decreased (-0.4%) to 98.654% when pulling bba141a on mhirsch:boolean_raw into 032bb7e on lovell:master.

@lovell
Copy link
Owner

lovell commented Jul 26, 2016

Commit e6bfa52 on the pencil (v0.16.0) branch introduces quite a significant refactor to abstract the common image opening logic, which just so happens to allow the use of raw pixel data with any method that takes an input image.

I took the liberty of using the test cases from this PR to prove this is the case :)

I'll close this PR as it is no longer necessary but, most importantly, thank you for kicking me into action to clean up the code and make it more extensible for others to contribute.

@lovell lovell closed this Jul 26, 2016
@mhirsch mhirsch deleted the boolean_raw branch August 6, 2016 04:01
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.

3 participants