Add premultiplied option to composite operation (#1835)

This commit is contained in:
Andargor
2019-08-14 14:01:23 -04:00
committed by Lovell Fuller
parent 3fa91bb4ce
commit 4ae8999f62
10 changed files with 81 additions and 3 deletions

View File

@@ -105,7 +105,8 @@ function composite (images) {
tile: false,
left: -1,
top: -1,
gravity: 0
gravity: 0,
premultiplied: false
};
if (is.defined(image.blend)) {
if (is.string(blend[image.blend])) {
@@ -147,6 +148,14 @@ function composite (images) {
throw is.invalidParameterError('gravity', 'valid gravity', image.gravity);
}
}
if (is.defined(image.premultiplied)) {
if (is.bool(image.premultiplied)) {
composite.premultiplied = image.premultiplied;
} else {
throw is.invalidParameterError('premultiplied', 'boolean', image.premultiplied);
}
}
return composite;
});
return this;