Flutter Engine
The Flutter Engine
Functions | Variables
SkPDFUtils Namespace Reference

Functions

const char * BlendModeName (SkBlendMode)
 
std::unique_ptr< SkPDFArrayRectToArray (const SkRect &rect)
 
std::unique_ptr< SkPDFArrayMatrixToArray (const SkMatrix &matrix)
 
void MoveTo (SkScalar x, SkScalar y, SkWStream *content)
 
void AppendLine (SkScalar x, SkScalar y, SkWStream *content)
 
void AppendRectangle (const SkRect &rect, SkWStream *content)
 
void EmitPath (const SkPath &path, SkPaint::Style paintStyle, bool doConsumeDegerates, SkWStream *content, SkScalar tolerance=0.25f)
 
void EmitPath (const SkPath &path, SkPaint::Style paintStyle, SkWStream *content, SkScalar tolerance=0.25f)
 
void ClosePath (SkWStream *content)
 
void PaintPath (SkPaint::Style style, SkPathFillType fill, SkWStream *content)
 
void StrokePath (SkWStream *content)
 
void ApplyGraphicState (int objectIndex, SkWStream *content)
 
void ApplyPattern (int objectIndex, SkWStream *content)
 
size_t ColorToDecimal (uint8_t value, char result[5])
 
size_t ColorToDecimalF (float value, char result[kFloatColorDecimalCount+2])
 
void AppendColorComponent (uint8_t value, SkWStream *wStream)
 
void AppendColorComponentF (float value, SkWStream *wStream)
 
void AppendScalar (SkScalar value, SkWStream *stream)
 
void WriteUInt16BE (SkWStream *wStream, uint16_t value)
 
void WriteUInt8 (SkWStream *wStream, uint8_t value)
 
void WriteUTF16beHex (SkWStream *wStream, SkUnichar utf32)
 
SkMatrix GetShaderLocalMatrix (const SkShader *shader)
 
bool InverseTransformBBox (const SkMatrix &matrix, SkRect *bbox)
 
void PopulateTilingPatternDict (SkPDFDict *pattern, SkRect &bbox, std::unique_ptr< SkPDFDict > resources, const SkMatrix &matrix)
 
bool ToBitmap (const SkImage *img, SkBitmap *dst)
 
void AppendTransform (const SkMatrix &, SkWStream *)
 
void GetDateTime (SkPDF::DateTime *)
 

Variables

static constexpr unsigned kFloatColorDecimalCount = 4
 

Function Documentation

◆ AppendColorComponent()

void SkPDFUtils::AppendColorComponent ( uint8_t  value,
SkWStream wStream 
)
inline

Definition at line 87 of file SkPDFUtils.h.

87 {
88 char buffer[5];
90 wStream->write(buffer, len);
91}
virtual bool write(const void *buffer, size_t size)=0
uint8_t value
size_t ColorToDecimal(uint8_t value, char result[5])
Definition: SkPDFUtils.cpp:307
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ AppendColorComponentF()

void SkPDFUtils::AppendColorComponentF ( float  value,
SkWStream wStream 
)
inline

Definition at line 92 of file SkPDFUtils.h.

92 {
95 wStream->write(buffer, len);
96}
size_t ColorToDecimalF(float value, char result[kFloatColorDecimalCount+2])
Definition: SkPDFUtils.cpp:296
static constexpr unsigned kFloatColorDecimalCount
Definition: SkPDFUtils.h:85

◆ AppendLine()

void SkPDFUtils::AppendLine ( SkScalar  x,
SkScalar  y,
SkWStream content 
)

Definition at line 82 of file SkPDFUtils.cpp.

82 {
84 content->writeText(" ");
86 content->writeText(" l\n");
87}
union flutter::testing::@2836::KeyboardChange::@76 content
double y
double x
void AppendScalar(SkScalar value, SkWStream *stream)
Definition: SkPDFUtils.h:98

◆ AppendRectangle()

void SkPDFUtils::AppendRectangle ( const SkRect rect,
SkWStream content 
)

Definition at line 118 of file SkPDFUtils.cpp.

118 {
119 // Skia has 0,0 at top left, pdf at bottom left. Do the right thing.
120 SkScalar bottom = std::min(rect.fBottom, rect.fTop);
121
123 content->writeText(" ");
125 content->writeText(" ");
127 content->writeText(" ");
129 content->writeText(" re\n");
130}
float SkScalar
Definition: extension.cpp:12
static float min(float r, float g, float b)
Definition: hsl.cpp:48
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ AppendScalar()

void SkPDFUtils::AppendScalar ( SkScalar  value,
SkWStream stream 
)
inline

Definition at line 98 of file SkPDFUtils.h.

98 {
100 size_t len = SkFloatToDecimal(value, result);
102 stream->write(result, len);
103}
#define SkASSERT(cond)
Definition: SkAssert.h:116
unsigned SkFloatToDecimal(float value, char output[kMaximumSkFloatToDecimalLength])
constexpr unsigned kMaximumSkFloatToDecimalLength
GAsyncResult * result

◆ AppendTransform()

void SkPDFUtils::AppendTransform ( const SkMatrix matrix,
SkWStream content 
)

Definition at line 399 of file SkPDFUtils.cpp.

399 {
400 SkScalar values[6];
401 if (!matrix.asAffine(values)) {
403 }
404 for (SkScalar v : values) {
406 content->writeText(" ");
407 }
408 content->writeText("cm\n");
409}
static void SetAffineIdentity(SkScalar affine[6])
Definition: SkMatrix.cpp:746
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ ApplyGraphicState()

void SkPDFUtils::ApplyGraphicState ( int  objectIndex,
SkWStream content 
)

Definition at line 254 of file SkPDFUtils.cpp.

254 {
256 content->writeText(" gs\n");
257}
void SkPDFWriteResourceName(SkWStream *dst, SkPDFResourceType type, int key)

◆ ApplyPattern()

void SkPDFUtils::ApplyPattern ( int  objectIndex,
SkWStream content 
)

Definition at line 259 of file SkPDFUtils.cpp.

259 {
260 // Select Pattern color space (CS, cs) and set pattern object as current
261 // color (SCN, scn)
262 content->writeText("/Pattern CS/Pattern cs");
264 content->writeText(" SCN");
266 content->writeText(" scn\n");
267}

◆ BlendModeName()

const char * SkPDFUtils::BlendModeName ( SkBlendMode  mode)

Definition at line 37 of file SkPDFUtils.cpp.

37 {
38 // PDF32000.book section 11.3.5 "Blend Mode"
39 switch (mode) {
40 case SkBlendMode::kSrcOver: return "Normal";
41 case SkBlendMode::kXor: return "Normal"; // (unsupported mode)
42 case SkBlendMode::kPlus: return "Normal"; // (unsupported mode)
43 case SkBlendMode::kScreen: return "Screen";
44 case SkBlendMode::kOverlay: return "Overlay";
45 case SkBlendMode::kDarken: return "Darken";
46 case SkBlendMode::kLighten: return "Lighten";
47 case SkBlendMode::kColorDodge: return "ColorDodge";
48 case SkBlendMode::kColorBurn: return "ColorBurn";
49 case SkBlendMode::kHardLight: return "HardLight";
50 case SkBlendMode::kSoftLight: return "SoftLight";
51 case SkBlendMode::kDifference: return "Difference";
52 case SkBlendMode::kExclusion: return "Exclusion";
53 case SkBlendMode::kMultiply: return "Multiply";
54 case SkBlendMode::kHue: return "Hue";
55 case SkBlendMode::kSaturation: return "Saturation";
56 case SkBlendMode::kColor: return "Color";
57 case SkBlendMode::kLuminosity: return "Luminosity";
58 // Other blendmodes are handled in SkPDFDevice::setUpContentEntry.
59 default: return nullptr;
60 }
61}
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ ClosePath()

void SkPDFUtils::ClosePath ( SkWStream content)

Definition at line 227 of file SkPDFUtils.cpp.

227 {
228 content->writeText("h\n");
229}

◆ ColorToDecimal()

size_t SkPDFUtils::ColorToDecimal ( uint8_t  value,
char  result[5] 
)

Definition at line 307 of file SkPDFUtils.cpp.

307 {
308 if (value == 255 || value == 0) {
309 result[0] = value ? '1' : '0';
310 result[1] = '\0';
311 return 1;
312 }
313 // int x = 0.5 + (1000.0 / 255.0) * value;
314 int x = SkFixedRoundToInt((SK_Fixed1 * 1000 / 255) * value);
315 return print_permil_as_decimal(x, result, 3);
316}
#define SK_Fixed1
Definition: SkFixed.h:26
#define SkFixedRoundToInt(x)
Definition: SkFixed.h:76
static size_t print_permil_as_decimal(int x, char *result, unsigned places)
Definition: SkPDFUtils.cpp:271

◆ ColorToDecimalF()

size_t SkPDFUtils::ColorToDecimalF ( float  value,
char  result[kFloatColorDecimalCount+2] 
)

Definition at line 296 of file SkPDFUtils.cpp.

296 {
297 static constexpr int kFactor = int_pow(10, kFloatColorDecimalCount);
298 int x = sk_float_round2int(value * kFactor);
299 if (x >= kFactor || x <= 0) { // clamp to 0-1
300 result[0] = x > 0 ? '1' : '0';
301 result[1] = '\0';
302 return 1;
303 }
305}
#define sk_float_round2int(x)
static constexpr int int_pow(int base, unsigned exp, int acc=1)
Definition: SkPDFUtils.cpp:288

◆ EmitPath() [1/2]

void SkPDFUtils::EmitPath ( const SkPath path,
SkPaint::Style  paintStyle,
bool  doConsumeDegerates,
SkWStream content,
SkScalar  tolerance = 0.25f 
)

Definition at line 132 of file SkPDFUtils.cpp.

134 {
135 if (path.isEmpty() && SkPaint::kFill_Style == paintStyle) {
137 return;
138 }
139 // Filling a path with no area results in a drawing in PDF renderers but
140 // Chrome expects to be able to draw some such entities with no visible
141 // result, so we detect those cases and discard the drawing for them.
142 // Specifically: moveTo(X), lineTo(Y) and moveTo(X), lineTo(X), lineTo(Y).
143
144 SkRect rect;
145 bool isClosed; // Both closure and direction need to be checked.
146 SkPathDirection direction;
147 if (path.isRect(&rect, &isClosed, &direction) &&
148 isClosed &&
149 (SkPathDirection::kCW == direction ||
150 SkPathFillType::kEvenOdd == path.getFillType()))
151 {
153 return;
154 }
155
156 enum SkipFillState {
157 kEmpty_SkipFillState,
158 kSingleLine_SkipFillState,
159 kNonSingleLine_SkipFillState,
160 };
161 SkipFillState fillState = kEmpty_SkipFillState;
162 //if (paintStyle != SkPaint::kFill_Style) {
163 // fillState = kNonSingleLine_SkipFillState;
164 //}
165 SkPoint lastMovePt = SkPoint::Make(0,0);
166 SkDynamicMemoryWStream currentSegment;
167 SkPoint args[4];
168 SkPath::Iter iter(path, false);
169 for (SkPath::Verb verb = iter.next(args);
170 verb != SkPath::kDone_Verb;
171 verb = iter.next(args)) {
172 // args gets all the points, even the implicit first point.
173 switch (verb) {
175 MoveTo(args[0].fX, args[0].fY, &currentSegment);
176 lastMovePt = args[0];
177 fillState = kEmpty_SkipFillState;
178 break;
180 if (!doConsumeDegerates || !SkPathPriv::AllPointsEq(args, 2)) {
181 AppendLine(args[1].fX, args[1].fY, &currentSegment);
182 if ((fillState == kEmpty_SkipFillState) && (args[0] != lastMovePt)) {
183 fillState = kSingleLine_SkipFillState;
184 break;
185 }
186 fillState = kNonSingleLine_SkipFillState;
187 }
188 break;
190 if (!doConsumeDegerates || !SkPathPriv::AllPointsEq(args, 3)) {
191 append_quad(args, &currentSegment);
192 fillState = kNonSingleLine_SkipFillState;
193 }
194 break;
196 if (!doConsumeDegerates || !SkPathPriv::AllPointsEq(args, 3)) {
198 const SkPoint* quads = converter.computeQuads(args, iter.conicWeight(), tolerance);
199 for (int i = 0; i < converter.countQuads(); ++i) {
200 append_quad(&quads[i * 2], &currentSegment);
201 }
202 fillState = kNonSingleLine_SkipFillState;
203 }
204 break;
206 if (!doConsumeDegerates || !SkPathPriv::AllPointsEq(args, 4)) {
207 append_cubic(args[1].fX, args[1].fY, args[2].fX, args[2].fY,
208 args[3].fX, args[3].fY, &currentSegment);
209 fillState = kNonSingleLine_SkipFillState;
210 }
211 break;
213 ClosePath(&currentSegment);
214 currentSegment.writeToStream(content);
215 currentSegment.reset();
216 break;
217 default:
218 SkASSERT(false);
219 break;
220 }
221 }
222 if (currentSegment.bytesWritten() > 0) {
223 currentSegment.writeToStream(content);
224 }
225}
static void append_quad(const SkPoint quad[], SkWStream *content)
Definition: SkPDFUtils.cpp:111
static void append_cubic(SkScalar ctl1X, SkScalar ctl1Y, SkScalar ctl2X, SkScalar ctl2Y, SkScalar dstX, SkScalar dstY, SkWStream *content)
Definition: SkPDFUtils.cpp:89
SkPathDirection
Definition: SkPathTypes.h:34
size_t bytesWritten() const override
Definition: SkStream.cpp:526
bool writeToStream(SkWStream *dst) const
Definition: SkStream.cpp:642
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
static bool AllPointsEq(const SkPoint pts[], int count)
Definition: SkPathPriv.h:339
@ kClose_Verb
Definition: SkPath.h:1471
@ kMove_Verb
Definition: SkPath.h:1466
@ kConic_Verb
Definition: SkPath.h:1469
@ kDone_Verb
Definition: SkPath.h:1472
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
void AppendRectangle(const SkRect &rect, SkWStream *content)
Definition: SkPDFUtils.cpp:118
void AppendLine(SkScalar x, SkScalar y, SkWStream *content)
Definition: SkPDFUtils.cpp:82
void ClosePath(SkWStream *content)
Definition: SkPDFUtils.cpp:227
string converter
Definition: cacheimages.py:19
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
void MoveTo(PathBuilder *builder, Scalar x, Scalar y)
Definition: tessellator.cc:20
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173

◆ EmitPath() [2/2]

void SkPDFUtils::EmitPath ( const SkPath path,
SkPaint::Style  paintStyle,
SkWStream content,
SkScalar  tolerance = 0.25f 
)
inline

Definition at line 71 of file SkPDFUtils.h.

72 {
73 SkPDFUtils::EmitPath(path, paintStyle, true, content, tolerance);
74}
void EmitPath(const SkPath &path, SkPaint::Style paintStyle, bool doConsumeDegerates, SkWStream *content, SkScalar tolerance=0.25f)
Definition: SkPDFUtils.cpp:132

◆ GetDateTime()

void SkPDFUtils::GetDateTime ( SkPDF::DateTime dt)

Definition at line 431 of file SkPDFUtils.cpp.

431 {
432 if (dt) {
433 time_t m_time;
434 time(&m_time);
435 struct tm tstruct;
436 gmtime_r(&m_time, &tstruct);
437 dt->fTimeZoneMinutes = 0;
438 dt->fYear = tstruct.tm_year + 1900;
439 dt->fMonth = SkToU8(tstruct.tm_mon + 1);
440 dt->fDayOfWeek = SkToU8(tstruct.tm_wday);
441 dt->fDay = SkToU8(tstruct.tm_mday);
442 dt->fHour = SkToU8(tstruct.tm_hour);
443 dt->fMinute = SkToU8(tstruct.tm_min);
444 dt->fSecond = SkToU8(tstruct.tm_sec);
445 }
446}
constexpr uint8_t SkToU8(S x)
Definition: SkTo.h:22
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394
uint8_t fMinute
0..59
Definition: SkPDFDocument.h:77
uint8_t fMonth
1..12
Definition: SkPDFDocument.h:73
uint8_t fDay
1..31
Definition: SkPDFDocument.h:75
uint16_t fYear
e.g. 2005
Definition: SkPDFDocument.h:72
uint8_t fSecond
0..59
Definition: SkPDFDocument.h:78
int16_t fTimeZoneMinutes
Definition: SkPDFDocument.h:70
uint8_t fHour
0..23
Definition: SkPDFDocument.h:76
uint8_t fDayOfWeek
0..6, 0==Sunday
Definition: SkPDFDocument.h:74

◆ GetShaderLocalMatrix()

SkMatrix SkPDFUtils::GetShaderLocalMatrix ( const SkShader shader)
inline

Definition at line 129 of file SkPDFUtils.h.

129 {
130 SkMatrix localMatrix;
131 if (sk_sp<SkShader> s = as_SB(shader)->makeAsALocalMatrixShader(&localMatrix)) {
132 return localMatrix;
133 }
134 return SkMatrix::I();
135}
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
struct MyStruct s

◆ InverseTransformBBox()

bool SkPDFUtils::InverseTransformBBox ( const SkMatrix matrix,
SkRect bbox 
)

Definition at line 318 of file SkPDFUtils.cpp.

318 {
319 SkMatrix inverse;
320 if (!matrix.invert(&inverse)) {
321 return false;
322 }
323 inverse.mapRect(bbox);
324 return true;
325}
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkMatrix.cpp:1141

◆ MatrixToArray()

std::unique_ptr< SkPDFArray > SkPDFUtils::MatrixToArray ( const SkMatrix matrix)

Definition at line 67 of file SkPDFUtils.cpp.

67 {
68 SkScalar a[6];
69 if (!matrix.asAffine(a)) {
71 }
72 return SkPDFMakeArray(a[0], a[1], a[2], a[3], a[4], a[5]);
73}
static std::unique_ptr< SkPDFArray > SkPDFMakeArray(Args... args)
Definition: SkPDFTypes.h:125
struct MyStruct a[10]

◆ MoveTo()

void SkPDFUtils::MoveTo ( SkScalar  x,
SkScalar  y,
SkWStream content 
)

Definition at line 75 of file SkPDFUtils.cpp.

75 {
77 content->writeText(" ");
79 content->writeText(" m\n");
80}

◆ PaintPath()

void SkPDFUtils::PaintPath ( SkPaint::Style  style,
SkPathFillType  fill,
SkWStream content 
)

Definition at line 231 of file SkPDFUtils.cpp.

231 {
232 if (style == SkPaint::kFill_Style) {
233 content->writeText("f");
234 } else if (style == SkPaint::kStrokeAndFill_Style) {
235 content->writeText("B");
236 } else if (style == SkPaint::kStroke_Style) {
237 content->writeText("S");
238 }
239
240 if (style != SkPaint::kStroke_Style) {
243 if (fill == SkPathFillType::kEvenOdd) {
244 content->writeText("*");
245 }
246 }
247 content->writeText("\n");
248}
#define NOT_IMPLEMENTED(condition, assertion)
Definition: SkPDFUtils.h:51
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kStrokeAndFill_Style
sets to stroke and fill geometry
Definition: SkPaint.h:195

◆ PopulateTilingPatternDict()

void SkPDFUtils::PopulateTilingPatternDict ( SkPDFDict pattern,
SkRect bbox,
std::unique_ptr< SkPDFDict resources,
const SkMatrix matrix 
)

Definition at line 327 of file SkPDFUtils.cpp.

330 {
331 const int kTiling_PatternType = 1;
332 const int kColoredTilingPattern_PaintType = 1;
333 const int kConstantSpacing_TilingType = 1;
334
335 pattern->insertName("Type", "Pattern");
336 pattern->insertInt("PatternType", kTiling_PatternType);
337 pattern->insertInt("PaintType", kColoredTilingPattern_PaintType);
338 pattern->insertInt("TilingType", kConstantSpacing_TilingType);
339 pattern->insertObject("BBox", SkPDFUtils::RectToArray(bbox));
340 pattern->insertScalar("XStep", bbox.width());
341 pattern->insertScalar("YStep", bbox.height());
342 pattern->insertObject("Resources", std::move(resources));
343 if (!matrix.isIdentity()) {
344 pattern->insertObject("Matrix", SkPDFUtils::MatrixToArray(matrix));
345 }
346}
void insertName(const char key[], const char nameValue[])
Definition: SkPDFTypes.cpp:512
void insertObject(const char key[], std::unique_ptr< SkPDFObject > &&)
Definition: SkPDFTypes.cpp:484
void insertInt(const char key[], int32_t value)
Definition: SkPDFTypes.cpp:496
void insertScalar(const char key[], SkScalar value)
Definition: SkPDFTypes.cpp:508
std::unique_ptr< SkPDFArray > MatrixToArray(const SkMatrix &matrix)
Definition: SkPDFUtils.cpp:67
std::unique_ptr< SkPDFArray > RectToArray(const SkRect &rect)
Definition: SkPDFUtils.cpp:63
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

◆ RectToArray()

std::unique_ptr< SkPDFArray > SkPDFUtils::RectToArray ( const SkRect rect)

Definition at line 63 of file SkPDFUtils.cpp.

63 {
64 return SkPDFMakeArray(r.left(), r.top(), r.right(), r.bottom());
65}

◆ StrokePath()

void SkPDFUtils::StrokePath ( SkWStream content)

Definition at line 250 of file SkPDFUtils.cpp.

250 {
252}
void PaintPath(SkPaint::Style style, SkPathFillType fill, SkWStream *content)
Definition: SkPDFUtils.cpp:231

◆ ToBitmap()

bool SkPDFUtils::ToBitmap ( const SkImage img,
SkBitmap dst 
)

Definition at line 348 of file SkPDFUtils.cpp.

348 {
349 SkASSERT(img);
350 SkASSERT(dst);
352 // TODO: support GPU images
353 if(as_IB(img)->getROPixels(nullptr, &bitmap)) {
354 SkASSERT(bitmap.dimensions() == img->dimensions());
355 SkASSERT(!bitmap.drawsNothing());
356 *dst = std::move(bitmap);
357 return true;
358 }
359 return false;
360}
static SkImage_Base * as_IB(SkImage *image)
Definition: SkImage_Base.h:201
SkISize dimensions() const
Definition: SkImage.h:297
Definition: bitmap.py:1
dst
Definition: cp.py:12

◆ WriteUInt16BE()

void SkPDFUtils::WriteUInt16BE ( SkWStream wStream,
uint16_t  value 
)
inline

Definition at line 105 of file SkPDFUtils.h.

105 {
106 char result[4] = { SkHexadecimalDigits::gUpper[ value >> 12 ],
107 SkHexadecimalDigits::gUpper[0xF & (value >> 8 )],
108 SkHexadecimalDigits::gUpper[0xF & (value >> 4 )],
110 wStream->write(result, 4);
111}
const char gUpper[16]
Definition: SkUtils.cpp:10

◆ WriteUInt8()

void SkPDFUtils::WriteUInt8 ( SkWStream wStream,
uint8_t  value 
)
inline

Definition at line 113 of file SkPDFUtils.h.

113 {
114 char result[2] = { SkHexadecimalDigits::gUpper[value >> 4],
116 wStream->write(result, 2);
117}

◆ WriteUTF16beHex()

void SkPDFUtils::WriteUTF16beHex ( SkWStream wStream,
SkUnichar  utf32 
)
inline

Definition at line 119 of file SkPDFUtils.h.

119 {
120 uint16_t utf16[2] = {0, 0};
121 size_t len = SkUTF::ToUTF16(utf32, utf16);
122 SkASSERT(len == 1 || len == 2);
123 SkPDFUtils::WriteUInt16BE(wStream, utf16[0]);
124 if (len == 2) {
125 SkPDFUtils::WriteUInt16BE(wStream, utf16[1]);
126 }
127}
void WriteUInt16BE(SkWStream *wStream, uint16_t value)
Definition: SkPDFUtils.h:105
SK_SPI size_t ToUTF16(SkUnichar uni, uint16_t utf16[2]=nullptr)
Definition: SkUTF.cpp:243

Variable Documentation

◆ kFloatColorDecimalCount

constexpr unsigned SkPDFUtils::kFloatColorDecimalCount = 4
staticconstexpr

Definition at line 85 of file SkPDFUtils.h.