Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkPDFShader.h
Go to the documentation of this file.
1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9#ifndef SkPDFShader_DEFINED
10#define SkPDFShader_DEFINED
11
15#include "src/pdf/SkBitmapKey.h"
16#include "src/pdf/SkPDFTypes.h"
17
18
19class SkPDFDocument;
20class SkMatrix;
21struct SkIRect;
22
23/** Make a PDF shader for the passed SkShader. If the SkShader is invalid in
24 * some way, returns nullptr.
25 *
26 * In PDF parlance, this is a pattern, used in place of a color when the
27 * pattern color space is selected.
28 *
29 * May cache the shader in the document for later re-use. If this function is
30 * called again with an equivalent shader, a new reference to the cached pdf
31 * shader may be returned.
32 *
33 * @param doc The parent document, must be non-null.
34 * @param shader The SkShader to emulate.
35 * @param ctm The current transform matrix. (PDF shaders are absolutely
36 * positioned, relative to where the page is drawn.)
37 * @param surfaceBBox The bounding box of the drawing surface (with matrix
38 * already applied).
39 * @param paintColor Color+Alpha of the paint. Color is usually ignored,
40 * unless it is a alpha shader.
41 */
43 SkShader* shader,
44 const SkMatrix& ctm,
45 const SkIRect& surfaceBBox,
46 SkColor4f paintColor);
47
59
61 SkASSERT(a.fBitmapKey.fID != 0);
62 SkASSERT(b.fBitmapKey.fID != 0);
63 return a.fTransform == b.fTransform
64 && a.fBBox == b.fBBox
65 && a.fBitmapKey == b.fBitmapKey
66 && a.fImageTileModes[0] == b.fImageTileModes[0]
67 && a.fImageTileModes[1] == b.fImageTileModes[1]
68 && a.fPaintColor == b.fPaintColor;
69}
70#endif
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SK_BEGIN_REQUIRE_DENSE
Definition SkMacros.h:37
#define SK_END_REQUIRE_DENSE
Definition SkMacros.h:38
SkPDFIndirectReference SkPDFMakeShader(SkPDFDocument *doc, SkShader *shader, const SkMatrix &ctm, const SkIRect &surfaceBBox, SkColor4f paintColor)
SK_END_REQUIRE_DENSE bool operator==(const SkPDFImageShaderKey &a, const SkPDFImageShaderKey &b)
Definition SkPDFShader.h:60
SkTileMode
Definition SkTileMode.h:13
static bool b
struct MyStruct a[10]
SkBitmapKey fBitmapKey
Definition SkPDFShader.h:52
SkTileMode fImageTileModes[2]
Definition SkPDFShader.h:53
SkColor4f fPaintColor
Definition SkPDFShader.h:54