Flutter Engine
The Flutter Engine
SkSGOpacityEffect.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 SkSGOpacityEffect_DEFINED
9#define SkSGOpacityEffect_DEFINED
10
11#include "include/core/SkRect.h"
16
17#include <utility>
18
19class SkCanvas;
20class SkMatrix;
21struct SkPoint;
22
23namespace sksg {
24class InvalidationController;
25
26/**
27 * Concrete Effect node, applying opacity to its descendants.
28 *
29 */
30class OpacityEffect final : public EffectNode {
31public:
32 static sk_sp<OpacityEffect> Make(sk_sp<RenderNode> child, float opacity = 1) {
33 return child ? sk_sp<OpacityEffect>(new OpacityEffect(std::move(child), opacity)) : nullptr;
34 }
35
36 SG_ATTRIBUTE(Opacity, float, fOpacity)
37
38protected:
40
41 void onRender(SkCanvas*, const RenderContext*) const override;
42 const RenderNode* onNodeAt(const SkPoint&) const override;
43
45
46private:
47 float fOpacity;
48
49 using INHERITED = EffectNode;
50};
51
52} // namespace sksg
53
54#endif // SkSGOpacityEffect_DEFINED
#define SG_ATTRIBUTE(attr_name, attr_type, attr_container)
Definition: SkSGNode.h:100
EffectNode(sk_sp< RenderNode >, uint32_t inval_traits=0)
void onRender(SkCanvas *, const RenderContext *) const override
static sk_sp< OpacityEffect > Make(sk_sp< RenderNode > child, float opacity=1)
OpacityEffect(sk_sp< RenderNode >, float)
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
const RenderNode * onNodeAt(const SkPoint &) const override
Definition: Skottie.h:32