Add skipBlanks support for tile layout (#1687)

This commit is contained in:
RaboliotTheGrey
2019-07-12 13:02:51 +02:00
committed by Lovell Fuller
parent b737d4601e
commit 6c02949fc1
6 changed files with 112 additions and 2 deletions

View File

@@ -965,7 +965,8 @@ class PipelineWorker : public Nan::AsyncWorker {
->set("container", baton->tileContainer)
->set("layout", baton->tileLayout)
->set("suffix", const_cast<char*>(suffix.data()))
->set("angle", CalculateAngleRotation(baton->tileAngle));
->set("angle", CalculateAngleRotation(baton->tileAngle))
->set("skip-blanks", baton->skipBlanks);
// libvips chooses a default depth based on layout. Instead of replicating that logic here by
// not passing anything - libvips will handle choice
@@ -1371,6 +1372,7 @@ NAN_METHOD(pipeline) {
baton->tileOverlap = AttrTo<uint32_t>(options, "tileOverlap");
std::string tileContainer = AttrAsStr(options, "tileContainer");
baton->tileAngle = AttrTo<int32_t>(options, "tileAngle");
baton->skipBlanks = AttrTo<int32_t>(options, "skipBlanks");
if (tileContainer == "zip") {
baton->tileContainer = VIPS_FOREIGN_DZ_CONTAINER_ZIP;
} else {

View File

@@ -172,6 +172,7 @@ struct PipelineBaton {
VipsForeignDzLayout tileLayout;
std::string tileFormat;
int tileAngle;
int skipBlanks;
VipsForeignDzDepth tileDepth;
std::unique_ptr<double[]> recombMatrix;
@@ -271,6 +272,7 @@ struct PipelineBaton {
tileContainer(VIPS_FOREIGN_DZ_CONTAINER_FS),
tileLayout(VIPS_FOREIGN_DZ_LAYOUT_DZ),
tileAngle(0),
skipBlanks(-1),
tileDepth(VIPS_FOREIGN_DZ_DEPTH_LAST) {}
};