Expose stylesheet and highBitdepth SVG input params

This commit is contained in:
Lovell Fuller
2025-06-16 11:11:02 +01:00
parent f92540f134
commit c4b1d80c35
9 changed files with 102 additions and 3 deletions

View File

@@ -101,6 +101,13 @@ namespace sharp {
if (HasAttr(input, "page")) {
descriptor->page = AttrAsUint32(input, "page");
}
// SVG
if (HasAttr(input, "svgStylesheet")) {
descriptor->svgStylesheet = AttrAsStr(input, "svgStylesheet");
}
if (HasAttr(input, "svgHighBitdepth")) {
descriptor->svgHighBitdepth = AttrAsBool(input, "svgHighBitdepth");
}
// Multi-level input (OpenSlide)
if (HasAttr(input, "level")) {
descriptor->level = AttrAsUint32(input, "level");
@@ -429,6 +436,10 @@ namespace sharp {
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);
}

View File

@@ -77,6 +77,8 @@ namespace sharp {
std::vector<double> joinBackground;
VipsAlign joinHalign;
VipsAlign joinValign;
std::string svgStylesheet;
bool svgHighBitdepth;
std::vector<double> pdfBackground;
bool jp2Oneshot;
@@ -121,6 +123,7 @@ namespace sharp {
joinBackground{ 0.0, 0.0, 0.0, 255.0 },
joinHalign(VIPS_ALIGN_LOW),
joinValign(VIPS_ALIGN_LOW),
svgHighBitdepth(false),
pdfBackground{ 255.0, 255.0, 255.0, 255.0 },
jp2Oneshot(false) {}
};