mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add premultiplied option to composite operation (#1835)
This commit is contained in:
@@ -591,7 +591,7 @@ class PipelineWorker : public Nan::AsyncWorker {
|
||||
if (!HasAlpha(compositeImage)) {
|
||||
compositeImage = sharp::EnsureAlpha(compositeImage);
|
||||
}
|
||||
compositeImage = compositeImage.premultiply();
|
||||
if (!composite->premultiplied) compositeImage = compositeImage.premultiply();
|
||||
// Calculate position
|
||||
int left;
|
||||
int top;
|
||||
@@ -1230,6 +1230,7 @@ NAN_METHOD(pipeline) {
|
||||
composite->left = AttrTo<int32_t>(compositeObject, "left");
|
||||
composite->top = AttrTo<int32_t>(compositeObject, "top");
|
||||
composite->tile = AttrTo<bool>(compositeObject, "tile");
|
||||
composite->premultiplied = AttrTo<bool>(compositeObject, "premultiplied");
|
||||
baton->composite.push_back(composite);
|
||||
}
|
||||
// Resize options
|
||||
|
||||
@@ -41,6 +41,7 @@ struct Composite {
|
||||
int left;
|
||||
int top;
|
||||
bool tile;
|
||||
bool premultiplied;
|
||||
|
||||
Composite():
|
||||
input(nullptr),
|
||||
@@ -48,7 +49,8 @@ struct Composite {
|
||||
gravity(0),
|
||||
left(-1),
|
||||
top(-1),
|
||||
tile(false) {}
|
||||
tile(false),
|
||||
premultiplied(false) {}
|
||||
};
|
||||
|
||||
struct PipelineBaton {
|
||||
|
||||
Reference in New Issue
Block a user