Flutter Engine
The Flutter Engine
SkSGMaskEffect.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 SkSGMaskEffect_DEFINED
9#define SkSGMaskEffect_DEFINED
10
11#include "include/core/SkRect.h"
15
16#include <cstdint>
17#include <utility>
18
19class SkCanvas;
20class SkMatrix;
21struct SkPoint;
22
23namespace sksg {
24class InvalidationController;
25
26/**
27 * Concrete Effect node, applying a mask to its descendants.
28 *
29 */
30class MaskEffect final : public EffectNode {
31public:
32 enum class Mode : uint32_t {
33 kAlphaNormal,
34 kAlphaInvert,
35 kLumaNormal,
36 kLumaInvert,
37 };
38
41 return (child && mask)
42 ? sk_sp<MaskEffect>(new MaskEffect(std::move(child), std::move(mask), mode))
43 : nullptr;
44 }
45
46 ~MaskEffect() override;
47
48protected:
50
51 void onRender(SkCanvas*, const RenderContext*) const override;
52 const RenderNode* onNodeAt(const SkPoint&) const override;
53
55
56private:
57 const sk_sp<RenderNode> fMaskNode;
58 const Mode fMaskMode;
59
60 using INHERITED = EffectNode;
61};
62
63} // namespace sksg
64
65#endif // SkSGMaskEffect_DEFINED
EffectNode(sk_sp< RenderNode >, uint32_t inval_traits=0)
const RenderNode * onNodeAt(const SkPoint &) const override
static sk_sp< MaskEffect > Make(sk_sp< RenderNode > child, sk_sp< RenderNode > mask, Mode mode=Mode::kAlphaNormal)
MaskEffect(sk_sp< RenderNode >, sk_sp< RenderNode > mask, Mode)
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
~MaskEffect() override
void onRender(SkCanvas *, const RenderContext *) const override
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
Definition: Skottie.h:32