Flutter Engine
The Flutter Engine
third_party
skia
src
pdf
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
#ifndef SkPDFShader_DEFINED
8
#define SkPDFShader_DEFINED
9
10
#include "
include/core/SkColor.h
"
11
#include "
include/core/SkMatrix.h
"
12
#include "
include/core/SkRect.h
"
13
#include "
include/private/base/SkAssert.h
"
14
#include "
include/private/base/SkMacros.h
"
15
#include "
src/core/SkChecksum.h
"
16
#include "
src/pdf/SkBitmapKey.h
"
17
#include "
src/pdf/SkPDFTypes.h
"
18
19
class
SkPDFDocument
;
20
class
SkShader
;
21
enum class
SkTileMode
;
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
*/
42
SkPDFIndirectReference
SkPDFMakeShader
(
SkPDFDocument
* doc,
43
SkShader
* shader,
44
const
SkMatrix
& ctm,
45
const
SkIRect
& surfaceBBox,
46
SkColor4f
paintColor);
47
48
SK_BEGIN_REQUIRE_DENSE
49
struct
SkPDFImageShaderKey
{
50
SkMatrix
fTransform
;
51
SkIRect
fBBox
;
52
SkBitmapKey
fBitmapKey
;
53
SkTileMode
fImageTileModes
[2];
54
SkColor4f
fPaintColor
;
55
56
using
Hash
=
SkForceDirectHash<SkPDFImageShaderKey>
;
57
};
58
SK_END_REQUIRE_DENSE
59
60
inline
bool
operator==
(
const
SkPDFImageShaderKey
&
a
,
const
SkPDFImageShaderKey
&
b
) {
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
SkAssert.h
SkASSERT
#define SkASSERT(cond)
Definition:
SkAssert.h:116
SkBitmapKey.h
SkChecksum.h
SkColor.h
SkMacros.h
SK_BEGIN_REQUIRE_DENSE
#define SK_BEGIN_REQUIRE_DENSE
Definition:
SkMacros.h:37
SK_END_REQUIRE_DENSE
#define SK_END_REQUIRE_DENSE
Definition:
SkMacros.h:38
SkMatrix.h
SkPDFMakeShader
SkPDFIndirectReference SkPDFMakeShader(SkPDFDocument *doc, SkShader *shader, const SkMatrix &ctm, const SkIRect &surfaceBBox, SkColor4f paintColor)
Definition:
SkPDFShader.cpp:334
operator==
SK_END_REQUIRE_DENSE bool operator==(const SkPDFImageShaderKey &a, const SkPDFImageShaderKey &b)
Definition:
SkPDFShader.h:60
SkPDFTypes.h
SkRect.h
SkTileMode
SkTileMode
Definition:
SkTileMode.h:13
SkMatrix
Definition:
SkMatrix.h:54
SkPDFDocument
Definition:
SkPDFDocumentPriv.h:95
SkShader
Definition:
SkShader.h:36
b
static bool b
Definition:
ffi_native_test_module.c:74
a
struct MyStruct a[10]
SkBitmapKey
Definition:
SkBitmapKey.h:14
SkColor4f
SkForceDirectHash
Definition:
SkChecksum.h:112
SkIRect
Definition:
SkRect.h:32
SkPDFImageShaderKey
Definition:
SkPDFShader.h:49
SkPDFImageShaderKey::fTransform
SkMatrix fTransform
Definition:
SkPDFShader.h:50
SkPDFImageShaderKey::fBBox
SkIRect fBBox
Definition:
SkPDFShader.h:51
SkPDFImageShaderKey::fBitmapKey
SkBitmapKey fBitmapKey
Definition:
SkPDFShader.h:52
SkPDFImageShaderKey::fImageTileModes
SkTileMode fImageTileModes[2]
Definition:
SkPDFShader.h:53
SkPDFImageShaderKey::fPaintColor
SkColor4f fPaintColor
Definition:
SkPDFShader.h:54
SkPDFIndirectReference
Definition:
SkPDFTypes.h:26
Generated on Sun Jun 23 2024 21:56:30 for Flutter Engine by
1.9.4