// If a SkBlendMode is unsupported in PDF, this function returns // SrcOver, otherwise, it returns the blend mode. static uint8_t pdf_blend_mode(SkBlendMode mode) { if (!SkPDFUtils::BlendModeName(mode)
|| SkBlendMode::kXor == mode
|| SkBlendMode::kPlus == mode)
{
mode = SkBlendMode::kSrcOver;
} return SkToU8((unsigned)mode);
}
static SkPDFIndirectReference make_invert_function(SkPDFDocument* doc) { // Acrobat crashes if we use a type 0 function, kpdf crashes if we use // a type 2 function, so we use a type 4 function. staticconstchar psInvert[] = "{1 exch sub}"; // Do not copy the trailing '\0' into the SkData. auto invertFunction = SkData::MakeWithoutCopy(psInvert, strlen(psInvert));
SkPDFIndirectReference SkPDFGraphicState::GetSMaskGraphicState(SkPDFIndirectReference sMask, bool invert,
SkPDFSMaskMode sMaskMode,
SkPDFDocument* doc) { // The practical chances of using the same mask more than once are unlikely // enough that it's not worth canonicalizing. auto sMaskDict = SkPDFMakeDict("Mask"); if (sMaskMode == kAlpha_SMaskMode) {
sMaskDict->insertName("S", "Alpha");
} elseif (sMaskMode == kLuminosity_SMaskMode) {
sMaskDict->insertName("S", "Luminosity");
}
sMaskDict->insertRef("G", sMask); if (invert) { // let the doc deduplicate this object. if (doc->fInvertFunction == SkPDFIndirectReference()) {
doc->fInvertFunction = make_invert_function(doc);
}
sMaskDict->insertRef("TR", doc->fInvertFunction);
}
SkPDFDict result("ExtGState");
result.insertObject("SMask", std::move(sMaskDict)); return doc->emit(result);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.