mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Clean up internal naming of format-specific input options
This commit is contained in:
@@ -109,12 +109,12 @@ namespace sharp {
|
||||
descriptor->svgHighBitdepth = AttrAsBool(input, "svgHighBitdepth");
|
||||
}
|
||||
// Multi-level input (OpenSlide)
|
||||
if (HasAttr(input, "level")) {
|
||||
descriptor->level = AttrAsUint32(input, "level");
|
||||
if (HasAttr(input, "openSlideLevel")) {
|
||||
descriptor->openSlideLevel = AttrAsUint32(input, "openSlideLevel");
|
||||
}
|
||||
// subIFD (OME-TIFF)
|
||||
if (HasAttr(input, "subifd")) {
|
||||
descriptor->subifd = AttrAsInt32(input, "subifd");
|
||||
descriptor->tiffSubifd = AttrAsInt32(input, "tiffSubifd");
|
||||
}
|
||||
// // PDF background color
|
||||
if (HasAttr(input, "pdfBackground")) {
|
||||
@@ -404,31 +404,34 @@ namespace sharp {
|
||||
if (descriptor->unlimited && ImageTypeSupportsUnlimited(imageType)) {
|
||||
option->set("unlimited", true);
|
||||
}
|
||||
if (imageType == ImageType::SVG || imageType == ImageType::PDF) {
|
||||
option->set("dpi", descriptor->density);
|
||||
}
|
||||
if (imageType == ImageType::MAGICK) {
|
||||
option->set("density", std::to_string(descriptor->density).data());
|
||||
}
|
||||
if (ImageTypeSupportsPage(imageType)) {
|
||||
option->set("n", descriptor->pages);
|
||||
option->set("page", descriptor->page);
|
||||
}
|
||||
if (imageType == ImageType::SVG) {
|
||||
option->set("stylesheet", descriptor->svgStylesheet.data());
|
||||
option->set("high_bitdepth", descriptor->svgHighBitdepth);
|
||||
}
|
||||
if (imageType == ImageType::OPENSLIDE) {
|
||||
option->set("level", descriptor->level);
|
||||
}
|
||||
if (imageType == ImageType::TIFF) {
|
||||
option->set("subifd", descriptor->subifd);
|
||||
}
|
||||
if (imageType == ImageType::PDF) {
|
||||
option->set("background", descriptor->pdfBackground);
|
||||
}
|
||||
if (imageType == ImageType::JP2) {
|
||||
option->set("oneshot", descriptor->jp2Oneshot);
|
||||
switch (imageType) {
|
||||
case ImageType::SVG:
|
||||
option->set("dpi", descriptor->density)
|
||||
->set("stylesheet", descriptor->svgStylesheet.data())
|
||||
->set("high_bitdepth", descriptor->svgHighBitdepth);
|
||||
break;
|
||||
case ImageType::TIFF:
|
||||
option->set("tiffSubifd", descriptor->tiffSubifd);
|
||||
break;
|
||||
case ImageType::PDF:
|
||||
option->set("dpi", descriptor->density)
|
||||
->set("background", descriptor->pdfBackground);
|
||||
break;
|
||||
case ImageType::OPENSLIDE:
|
||||
option->set("openSlideLevel", descriptor->openSlideLevel);
|
||||
break;
|
||||
case ImageType::JP2:
|
||||
option->set("oneshot", descriptor->jp2Oneshot);
|
||||
break;
|
||||
case ImageType::MAGICK:
|
||||
option->set("density", std::to_string(descriptor->density).data());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return option;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ namespace sharp {
|
||||
bool rawPremultiplied;
|
||||
int pages;
|
||||
int page;
|
||||
int level;
|
||||
int subifd;
|
||||
int createChannels;
|
||||
int createWidth;
|
||||
int createHeight;
|
||||
@@ -79,6 +77,8 @@ namespace sharp {
|
||||
VipsAlign joinValign;
|
||||
std::string svgStylesheet;
|
||||
bool svgHighBitdepth;
|
||||
int tiffSubifd;
|
||||
int openSlideLevel;
|
||||
std::vector<double> pdfBackground;
|
||||
bool jp2Oneshot;
|
||||
|
||||
@@ -100,8 +100,6 @@ namespace sharp {
|
||||
rawPremultiplied(false),
|
||||
pages(1),
|
||||
page(0),
|
||||
level(0),
|
||||
subifd(-1),
|
||||
createChannels(0),
|
||||
createWidth(0),
|
||||
createHeight(0),
|
||||
@@ -124,6 +122,8 @@ namespace sharp {
|
||||
joinHalign(VIPS_ALIGN_LOW),
|
||||
joinValign(VIPS_ALIGN_LOW),
|
||||
svgHighBitdepth(false),
|
||||
tiffSubifd(-1),
|
||||
openSlideLevel(0),
|
||||
pdfBackground{ 255.0, 255.0, 255.0, 255.0 },
|
||||
jp2Oneshot(false) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user