Flutter Engine
The Flutter Engine
third_party
skia
src
pdf
SkPDFGraphicState.h
Go to the documentation of this file.
1
/*
2
* Copyright 2010 The Android Open Source Project
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 SkPDFGraphicState_DEFINED
10
#define SkPDFGraphicState_DEFINED
11
12
#include "
include/core/SkScalar.h
"
13
#include "
include/private/base/SkMacros.h
"
14
#include "
src/core/SkChecksum.h
"
15
#include "
src/pdf/SkPDFTypes.h
"
16
17
#include <cstdint>
18
#include <cstring>
19
20
class
SkPDFDocument
;
21
class
SkPaint
;
22
23
/** \class SkPDFGraphicState
24
SkPaint objects roughly correspond to graphic state dictionaries that can
25
be installed. So that a given dictionary is only output to the pdf file
26
once, we want to canonicalize them.
27
*/
28
namespace
SkPDFGraphicState
{
29
enum
SkPDFSMaskMode
{
30
kAlpha_SMaskMode
,
31
kLuminosity_SMaskMode
32
};
33
34
/** Get the graphic state for the passed SkPaint.
35
*/
36
SkPDFIndirectReference
GetGraphicStateForPaint
(
SkPDFDocument
*,
const
SkPaint
&);
37
38
/** Make a graphic state that only sets the passed soft mask.
39
* @param sMask The form xobject to use as a soft mask.
40
* @param invert Indicates if the alpha of the sMask should be inverted.
41
* @param sMaskMode Whether to use alpha or luminosity for the sMask.
42
*
43
* These are not de-duped.
44
*/
45
SkPDFIndirectReference
GetSMaskGraphicState
(
SkPDFIndirectReference
sMask,
46
bool
invert
,
47
SkPDFSMaskMode
sMaskMode,
48
SkPDFDocument
* doc);
49
}
// namespace SkPDFGraphicState
50
51
SK_BEGIN_REQUIRE_DENSE
52
struct
SkPDFStrokeGraphicState
{
53
SkScalar
fStrokeWidth
;
54
SkScalar
fStrokeMiter
;
55
SkScalar
fAlpha
;
56
uint8_t
fStrokeCap
;
// SkPaint::Cap
57
uint8_t
fStrokeJoin
;
// SkPaint::Join
58
uint8_t
fBlendMode
;
// SkBlendMode
59
uint8_t
fPADDING
= 0;
60
bool
operator==
(
const
SkPDFStrokeGraphicState
& o)
const
{
return
!memcmp(
this
, &o,
sizeof
(o)); }
61
bool
operator!=
(
const
SkPDFStrokeGraphicState
& o)
const
{
return
!(*
this
== o); }
62
63
using
Hash
=
SkForceDirectHash<SkPDFStrokeGraphicState>
;
64
};
65
SK_END_REQUIRE_DENSE
66
67
SK_BEGIN_REQUIRE_DENSE
68
struct
SkPDFFillGraphicState
{
69
SkScalar
fAlpha
;
70
uint8_t
fBlendMode
;
71
uint8_t
fPADDING
[3] = {0, 0, 0};
72
bool
operator==
(
const
SkPDFFillGraphicState
& o)
const
{
return
!memcmp(
this
, &o,
sizeof
(o)); }
73
bool
operator!=
(
const
SkPDFFillGraphicState
& o)
const
{
return
!(*
this
== o); }
74
75
using
Hash
=
SkForceDirectHash<SkPDFFillGraphicState>
;
76
};
77
SK_END_REQUIRE_DENSE
78
79
#endif
SkChecksum.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
SkPDFTypes.h
SkScalar.h
SkPDFDocument
Definition:
SkPDFDocumentPriv.h:95
SkPDFGraphicState::SkPDFSMaskMode
SkPDFSMaskMode
Definition:
SkPDFGraphicState.h:29
SkPDFGraphicState::kLuminosity_SMaskMode
@ kLuminosity_SMaskMode
Definition:
SkPDFGraphicState.h:31
SkPDFGraphicState::kAlpha_SMaskMode
@ kAlpha_SMaskMode
Definition:
SkPDFGraphicState.h:30
SkPaint
Definition:
SkPaint.h:44
SkScalar
float SkScalar
Definition:
extension.cpp:12
invert
gboolean invert
Definition:
fl_accessible_node.cc:12
SkPDFGraphicState
Definition:
SkPDFGraphicState.h:28
SkPDFGraphicState::GetGraphicStateForPaint
SkPDFIndirectReference GetGraphicStateForPaint(SkPDFDocument *, const SkPaint &)
SkPDFGraphicState::GetSMaskGraphicState
SkPDFIndirectReference GetSMaskGraphicState(SkPDFIndirectReference sMask, bool invert, SkPDFSMaskMode sMaskMode, SkPDFDocument *doc)
SkForceDirectHash
Definition:
SkChecksum.h:112
SkPDFFillGraphicState
Definition:
SkPDFGraphicState.h:68
SkPDFFillGraphicState::fAlpha
SkScalar fAlpha
Definition:
SkPDFGraphicState.h:69
SkPDFFillGraphicState::fBlendMode
uint8_t fBlendMode
Definition:
SkPDFGraphicState.h:70
SkPDFFillGraphicState::operator!=
bool operator!=(const SkPDFFillGraphicState &o) const
Definition:
SkPDFGraphicState.h:73
SkPDFFillGraphicState::fPADDING
uint8_t fPADDING[3]
Definition:
SkPDFGraphicState.h:71
SkPDFFillGraphicState::operator==
bool operator==(const SkPDFFillGraphicState &o) const
Definition:
SkPDFGraphicState.h:72
SkPDFIndirectReference
Definition:
SkPDFTypes.h:26
SkPDFStrokeGraphicState
Definition:
SkPDFGraphicState.h:52
SkPDFStrokeGraphicState::fStrokeWidth
SkScalar fStrokeWidth
Definition:
SkPDFGraphicState.h:53
SkPDFStrokeGraphicState::fStrokeJoin
uint8_t fStrokeJoin
Definition:
SkPDFGraphicState.h:57
SkPDFStrokeGraphicState::operator!=
bool operator!=(const SkPDFStrokeGraphicState &o) const
Definition:
SkPDFGraphicState.h:61
SkPDFStrokeGraphicState::operator==
bool operator==(const SkPDFStrokeGraphicState &o) const
Definition:
SkPDFGraphicState.h:60
SkPDFStrokeGraphicState::fPADDING
uint8_t fPADDING
Definition:
SkPDFGraphicState.h:59
SkPDFStrokeGraphicState::fStrokeCap
uint8_t fStrokeCap
Definition:
SkPDFGraphicState.h:56
SkPDFStrokeGraphicState::fBlendMode
uint8_t fBlendMode
Definition:
SkPDFGraphicState.h:58
SkPDFStrokeGraphicState::fAlpha
SkScalar fAlpha
Definition:
SkPDFGraphicState.h:55
SkPDFStrokeGraphicState::fStrokeMiter
SkScalar fStrokeMiter
Definition:
SkPDFGraphicState.h:54
Generated on Sun Jun 23 2024 21:56:30 for Flutter Engine by
1.9.4