Skia
2D Graphics Library
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 
12 
13 namespace sksg {
14 
19 class MaskEffect final : public EffectNode {
20 public:
21  enum class Mode : uint32_t {
26  };
27 
29  Mode mode = Mode::kAlphaNormal) {
30  return (child && mask)
31  ? sk_sp<MaskEffect>(new MaskEffect(std::move(child), std::move(mask), mode))
32  : nullptr;
33  }
34 
35  ~MaskEffect() override;
36 
37 protected:
39 
40  void onRender(SkCanvas*, const RenderContext*) const override;
41  const RenderNode* onNodeAt(const SkPoint&) const override;
42 
44 
45 private:
46  const sk_sp<RenderNode> fMaskNode;
47  const Mode fMaskMode;
48 
49  using INHERITED = EffectNode;
50 };
51 
52 } // namespace sksg
53 
54 #endif // SkSGMaskEffect_DEFINED
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
Base class for nodes which apply some transformation when rendering their descendants.
Definition: SkSGEffectNode.h:21
EffectNode(sk_sp< RenderNode >, uint32_t inval_traits=0)
Receiver for invalidation events.
Definition: SkSGInvalidationController.h:25
Concrete Effect node, applying a mask to its descendants.
Definition: SkSGMaskEffect.h:19
const RenderNode * onNodeAt(const SkPoint &) const override
static sk_sp< MaskEffect > Make(sk_sp< RenderNode > child, sk_sp< RenderNode > mask, Mode mode=Mode::kAlphaNormal)
Definition: SkSGMaskEffect.h:28
MaskEffect(sk_sp< RenderNode >, sk_sp< RenderNode > mask, Mode)
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
~MaskEffect() override
Mode
Definition: SkSGMaskEffect.h:21
void onRender(SkCanvas *, const RenderContext *) const override
Base class for nodes which can render to a canvas.
Definition: SkSGRenderNode.h:27
Definition: Skottie.h:30
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
Definition: SkSGRenderNode.h:53