Skia
2D Graphics Library
SkSVGImage.h
Go to the documentation of this file.
1 /*
2  * Copyright 2021 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 SkSVGImage_DEFINED
9 #define SkSVGImage_DEFINED
10 
13 
14 namespace skresources {
15 class ResourceProvider;
16 }
17 
18 class SK_API SkSVGImage final : public SkSVGTransformableNode {
19 public:
21  return sk_sp<SkSVGImage>(new SkSVGImage());
22  }
23 
24  void appendChild(sk_sp<SkSVGNode>) override {
25  SkDebugf("cannot append child nodes to this element.\n");
26  }
27 
28  bool onPrepareToRender(SkSVGRenderContext*) const override;
29  void onRender(const SkSVGRenderContext&) const override;
30  SkPath onAsPath(const SkSVGRenderContext&) const override;
32 
33  struct ImageInfo {
36  };
38  const SkSVGIRI&,
39  const SkRect&,
41 
44  SVG_ATTR(Width , SkSVGLength , SkSVGLength(0))
45  SVG_ATTR(Height , SkSVGLength , SkSVGLength(0))
46  SVG_ATTR(Href , SkSVGIRI , SkSVGIRI())
48 
49 protected:
50  bool parseAndSetAttribute(const char*, const char*) override;
51 
52 private:
54 
55  using INHERITED = SkSVGTransformableNode;
56 };
57 
58 #endif // SkSVGImage_DEFINED
SkSVGTag
Definition: SkSVGNode.h:23
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
SkPath contain geometry.
Definition: SkPath.h:58
Definition: SkSVGTypes.h:152
Definition: SkSVGImage.h:18
void onRender(const SkSVGRenderContext &) const override
bool onPrepareToRender(SkSVGRenderContext *) const override
SkPath onAsPath(const SkSVGRenderContext &) const override
static sk_sp< SkSVGImage > Make()
Definition: SkSVGImage.h:20
void appendChild(sk_sp< SkSVGNode >) override
Definition: SkSVGImage.h:24
SkRect onObjectBoundingBox(const SkSVGRenderContext &) const override
static ImageInfo LoadImage(const sk_sp< skresources::ResourceProvider > &, const SkSVGIRI &, const SkRect &, SkSVGPreserveAspectRatio)
Definition: SkSVGTypes.h:116
Definition: SkSVGRenderContext.h:61
Definition: SkSVGTransformableNode.h:14
SkSVGTransformableNode(SkSVGTag)
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
skresources::ResourceProvider ResourceProvider
Definition: Skottie.h:42
Definition: SlotManager.h:23
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
Definition: SkSVGImage.h:33
SkRect fDst
Definition: SkSVGImage.h:35
sk_sp< SkImage > fImage
Definition: SkSVGImage.h:34
Definition: SkSVGTypes.h:585