Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
core
SkPaintPriv.h
Go to the documentation of this file.
1
/*
2
* Copyright 2013 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
#ifndef SkPaintPriv_DEFINED
9
#define SkPaintPriv_DEFINED
10
11
#include "
include/core/SkColor.h
"
12
#include "
include/core/SkPaint.h
"
13
14
class
SkColorSpace
;
15
class
SkReadBuffer
;
16
class
SkWriteBuffer
;
17
enum
SkColorType
:
int
;
18
19
class
SkPaintPriv
{
20
public
:
21
enum
ShaderOverrideOpacity
{
22
kNone_ShaderOverrideOpacity
,
//!< there is no overriding shader (bitmap or image)
23
kOpaque_ShaderOverrideOpacity
,
//!< the overriding shader is opaque
24
kNotOpaque_ShaderOverrideOpacity
,
//!< the overriding shader may not be opaque
25
};
26
27
/**
28
* Returns true if drawing with this paint (or nullptr) will ovewrite all affected pixels.
29
*
30
* Note: returns conservative true, meaning it may return false even though the paint might
31
* in fact overwrite its pixels.
32
*/
33
static
bool
Overwrites
(
const
SkPaint
*
paint
,
ShaderOverrideOpacity
);
34
35
static
bool
ShouldDither
(
const
SkPaint
&,
SkColorType
);
36
37
/*
38
* The luminance color is used to determine which Gamma Canonical color to map to. This is
39
* really only used by backends which want to cache glyph masks, and need some way to know if
40
* they need to generate new masks based off a given color.
41
*/
42
static
SkColor
ComputeLuminanceColor
(
const
SkPaint
&);
43
44
/** Serializes SkPaint into a buffer. A companion unflatten() call
45
can reconstitute the paint at a later time.
46
47
@param buffer SkWriteBuffer receiving the flattened SkPaint data
48
*/
49
static
void
Flatten
(
const
SkPaint
&
paint
,
SkWriteBuffer
&
buffer
);
50
51
/** Populates SkPaint, typically from a serialized stream, created by calling
52
flatten() at an earlier time.
53
*/
54
static
SkPaint
Unflatten
(
SkReadBuffer
&
buffer
);
55
56
// If this paint has any color filter, fold it into the shader and/or paint color
57
// so that it draws the same but getColorFilter() returns nullptr.
58
//
59
// Since we may be filtering now, we need to know what color space to filter in,
60
// typically the color space of the device we're drawing into.
61
static
void
RemoveColorFilter
(
SkPaint
*,
SkColorSpace
* dstCS);
62
63
};
64
65
#endif
SkColorType
SkColorType
Definition
SkColorType.h:19
SkColor.h
SkColor
uint32_t SkColor
Definition
SkColor.h:37
SkPaint.h
int
Type::kYUV Type::kRGBA() int(0.7 *637)
SkColorSpace
Definition
SkColorSpace.h:107
SkPaintPriv
Definition
SkPaintPriv.h:19
SkPaintPriv::RemoveColorFilter
static void RemoveColorFilter(SkPaint *, SkColorSpace *dstCS)
Definition
SkPaintPriv.cpp:160
SkPaintPriv::Unflatten
static SkPaint Unflatten(SkReadBuffer &buffer)
Definition
SkPaintPriv.cpp:288
SkPaintPriv::Overwrites
static bool Overwrites(const SkPaint *paint, ShaderOverrideOpacity)
Definition
SkPaintPriv.cpp:82
SkPaintPriv::ShouldDither
static bool ShouldDither(const SkPaint &, SkColorType)
Definition
SkPaintPriv.cpp:112
SkPaintPriv::ShaderOverrideOpacity
ShaderOverrideOpacity
Definition
SkPaintPriv.h:21
SkPaintPriv::kNone_ShaderOverrideOpacity
@ kNone_ShaderOverrideOpacity
there is no overriding shader (bitmap or image)
Definition
SkPaintPriv.h:22
SkPaintPriv::kOpaque_ShaderOverrideOpacity
@ kOpaque_ShaderOverrideOpacity
the overriding shader is opaque
Definition
SkPaintPriv.h:23
SkPaintPriv::kNotOpaque_ShaderOverrideOpacity
@ kNotOpaque_ShaderOverrideOpacity
the overriding shader may not be opaque
Definition
SkPaintPriv.h:24
SkPaintPriv::ComputeLuminanceColor
static SkColor ComputeLuminanceColor(const SkPaint &)
Definition
SkPaintPriv.cpp:152
SkPaintPriv::Flatten
static void Flatten(const SkPaint &paint, SkWriteBuffer &buffer)
Definition
SkPaintPriv.cpp:260
SkPaint
Definition
SkPaint.h:44
SkReadBuffer
Definition
SkReadBuffer.h:52
SkWriteBuffer
Definition
SkWriteBuffer.h:41
paint
const Paint & paint
Definition
color_source.cc:38
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
Generated on Fri Apr 26 2024 06:16:45 for Flutter Engine by
1.9.8