Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkPDFFormXObject.h File Reference
#include "src/pdf/SkPDFDevice.h"
#include "src/pdf/SkPDFTypes.h"

Go to the source code of this file.

Functions

SkPDFIndirectReference SkPDFMakeFormXObject (SkPDFDocument *doc, std::unique_ptr< SkStreamAsset > content, std::unique_ptr< SkPDFArray > mediaBox, std::unique_ptr< SkPDFDict > resourceDict, const SkMatrix &inverseTransform, const char *colorSpace)
 

Function Documentation

◆ SkPDFMakeFormXObject()

SkPDFIndirectReference SkPDFMakeFormXObject ( SkPDFDocument doc,
std::unique_ptr< SkStreamAsset content,
std::unique_ptr< SkPDFArray mediaBox,
std::unique_ptr< SkPDFDict resourceDict,
const SkMatrix inverseTransform,
const char *  colorSpace 
)

A form XObject is a self contained description of a graphics object. A form XObject is a page object with slightly different syntax, that can be drawn into a page content stream, just like a bitmap XObject can be drawn into a page content stream.

Definition at line 12 of file SkPDFFormXObject.cpp.

17 {
18 std::unique_ptr<SkPDFDict> dict = SkPDFMakeDict();
19 dict->insertName("Type", "XObject");
20 dict->insertName("Subtype", "Form");
21 if (!inverseTransform.isIdentity()) {
22 dict->insertObject("Matrix", SkPDFUtils::MatrixToArray(inverseTransform));
23 }
24 dict->insertObject("Resources", std::move(resourceDict));
25 dict->insertObject("BBox", std::move(mediaBox));
26
27 // Right now FormXObject is only used for saveLayer, which implies
28 // isolated blending. Do this conditionally if that changes.
29 // TODO(halcanary): Is this comment obsolete, since we use it for
30 // alpha masks?
31 auto group = SkPDFMakeDict("Group");
32 group->insertName("S", "Transparency");
33 if (colorSpace != nullptr) {
34 group->insertName("CS", colorSpace);
35 }
36 group->insertBool("I", true); // Isolated.
37 dict->insertObject("Group", std::move(group));
38 return SkPDFStreamOut(std::move(dict), std::move(content), doc);
39}
SkPDFIndirectReference SkPDFStreamOut(std::unique_ptr< SkPDFDict > dict, std::unique_ptr< SkStreamAsset > content, SkPDFDocument *doc, SkPDFSteamCompressionEnabled compress)
static std::unique_ptr< SkPDFDict > SkPDFMakeDict(const char *type=nullptr)
Definition SkPDFTypes.h:195
bool isIdentity() const
Definition SkMatrix.h:223
union flutter::testing::@2838::KeyboardChange::@76 content
std::unique_ptr< SkPDFArray > MatrixToArray(const SkMatrix &matrix)