Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
13
14class SkColorSpace;
15class SkReadBuffer;
16class SkWriteBuffer;
17enum SkColorType : int;
18
20public:
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 */
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 */
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
Definition SkColorType.h:19
uint32_t SkColor
Definition SkColor.h:37
Type::kYUV Type::kRGBA() int(0.7 *637)
static void RemoveColorFilter(SkPaint *, SkColorSpace *dstCS)
static SkPaint Unflatten(SkReadBuffer &buffer)
static bool Overwrites(const SkPaint *paint, ShaderOverrideOpacity)
static bool ShouldDither(const SkPaint &, SkColorType)
@ kNone_ShaderOverrideOpacity
there is no overriding shader (bitmap or image)
Definition SkPaintPriv.h:22
@ kOpaque_ShaderOverrideOpacity
the overriding shader is opaque
Definition SkPaintPriv.h:23
@ kNotOpaque_ShaderOverrideOpacity
the overriding shader may not be opaque
Definition SkPaintPriv.h:24
static SkColor ComputeLuminanceColor(const SkPaint &)
static void Flatten(const SkPaint &paint, SkWriteBuffer &buffer)
const Paint & paint
static const uint8_t buffer[]