Flutter Engine
The Flutter Engine
Functions
SkPDFFormXObject.cpp File Reference
#include "src/pdf/SkPDFFormXObject.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkStream.h"
#include "src/pdf/SkPDFUtils.h"
#include <utility>

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 16 of file SkPDFFormXObject.cpp.

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