Skia
2D Graphics Library
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 
14 
15 class SkImage;
16 
17 namespace sksg {
18 
23 class Image final : public RenderNode {
24 public:
26  return sk_sp<Image>(new Image(std::move(image)));
27  }
28 
29  SG_ATTRIBUTE(Image , sk_sp<SkImage> , fImage )
30  SG_ATTRIBUTE(SamplingOptions, SkSamplingOptions, fSamplingOptions)
31  SG_ATTRIBUTE(AntiAlias , bool , fAntiAlias )
32 
33 protected:
34  explicit Image(sk_sp<SkImage>);
35 
36  void onRender(SkCanvas*, const RenderContext*) const override;
37  const RenderNode* onNodeAt(const SkPoint&) const override;
38 
40 
41 private:
42  SkSamplingOptions fSamplingOptions;
43  sk_sp<SkImage> fImage;
44  bool fAntiAlias = true;
45 
46  using INHERITED = RenderNode;
47 };
48 
49 } // namespace sksg
50 
51 #endif // SkSGImage_DEFINED
#define SG_ATTRIBUTE(attr_name, attr_type, attr_container)
Definition: SkSGNode.h:99
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkImage describes a two dimensional array of pixels to draw.
Definition: SkImage.h:270
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
Concrete rendering node, wrapping an SkImage.
Definition: SkSGImage.h:23
const RenderNode * onNodeAt(const SkPoint &) const override
void onRender(SkCanvas *, const RenderContext *) const override
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
Image(sk_sp< SkImage >)
static sk_sp< Image > Make(sk_sp< SkImage > image)
Definition: SkSGImage.h:25
Receiver for invalidation events.
Definition: SkSGInvalidationController.h:25
friend class RenderNode
Definition: SkSGNode.h:93
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: SkSamplingOptions.h:58
Definition: SkSGRenderNode.h:53