Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSGImage.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 SkSGImage_DEFINED
9#define SkSGImage_DEFINED
10
12#include "include/core/SkRect.h"
17
18#include <utility>
19
20class SkCanvas;
21class SkMatrix;
22struct SkPoint;
23
24namespace sksg {
25class InvalidationController;
26
27/**
28 * Concrete rendering node, wrapping an SkImage.
29 *
30 */
31class Image final : public RenderNode {
32public:
34 return sk_sp<Image>(new Image(std::move(image)));
35 }
36
38 SG_ATTRIBUTE(SamplingOptions, SkSamplingOptions, fSamplingOptions)
39 SG_ATTRIBUTE(AntiAlias , bool , fAntiAlias )
40
41protected:
42 explicit Image(sk_sp<SkImage>);
43
44 void onRender(SkCanvas*, const RenderContext*) const override;
45 const RenderNode* onNodeAt(const SkPoint&) const override;
46
48
49private:
50 SkSamplingOptions fSamplingOptions;
51 sk_sp<SkImage> fImage;
52 bool fAntiAlias = true;
53
54 using INHERITED = RenderNode;
55};
56
57} // namespace sksg
58
59#endif // SkSGImage_DEFINED
#define SG_ATTRIBUTE(attr_name, attr_type, attr_container)
Definition SkSGNode.h:100
const RenderNode * onNodeAt(const SkPoint &) const override
Definition SkSGImage.cpp:41
void onRender(SkCanvas *, const RenderContext *) const override
Definition SkSGImage.cpp:20
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
Definition SkSGImage.cpp:46
static sk_sp< Image > Make(sk_sp< SkImage > image)
Definition SkSGImage.h:33
sk_sp< SkImage > image
Definition examples.cpp:29
Definition Skottie.h:32