Add support for Zoomify and Google tile layouts

Breaks existing tile API
This commit is contained in:
Lovell Fuller
2016-03-03 20:29:23 +00:00
parent f950294f70
commit 38ddb3b866
6 changed files with 176 additions and 144 deletions

View File

@@ -766,6 +766,7 @@ class PipelineWorker : public AsyncWorker {
->set("strip", !baton->withMetadata)
->set("tile_size", baton->tileSize)
->set("overlap", baton->tileOverlap)
->set("layout", baton->tileLayout)
);
baton->formatOut = "dz";
} else {
@@ -1030,8 +1031,18 @@ NAN_METHOD(pipeline) {
// Output
baton->formatOut = attrAsStr(options, "formatOut");
baton->fileOut = attrAsStr(options, "fileOut");
// Tile output
baton->tileSize = attrAs<int32_t>(options, "tileSize");
baton->tileOverlap = attrAs<int32_t>(options, "tileOverlap");
std::string tileLayout = attrAsStr(options, "tileLayout");
if (tileLayout == "google") {
baton->tileLayout = VIPS_FOREIGN_DZ_LAYOUT_GOOGLE;
} else if (tileLayout == "zoomify") {
baton->tileLayout = VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY;
} else {
baton->tileLayout = VIPS_FOREIGN_DZ_LAYOUT_DZ;
}
// Function to notify of queue length changes
Callback *queueListener = new Callback(
Get(options, New("queueListener").ToLocalChecked()).ToLocalChecked().As<Function>()

View File

@@ -1,6 +1,8 @@
#ifndef SRC_PIPELINE_H_
#define SRC_PIPELINE_H_
#include <vips/vips8>
#include "nan.h"
NAN_METHOD(pipeline);
@@ -79,6 +81,7 @@ struct PipelineBaton {
int withMetadataOrientation;
int tileSize;
int tileOverlap;
VipsForeignDzLayout tileLayout;
PipelineBaton():
bufferInLength(0),
@@ -126,7 +129,8 @@ struct PipelineBaton {
withMetadata(false),
withMetadataOrientation(-1),
tileSize(256),
tileOverlap(0) {
tileOverlap(0),
tileLayout(VIPS_FOREIGN_DZ_LAYOUT_DZ) {
background[0] = 0.0;
background[1] = 0.0;
background[2] = 0.0;