Skia
2D Graphics Library
SkSVGRect.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 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 SkSVGRect_DEFINED
9 #define SkSVGRect_DEFINED
10 
13 
14 class SkRRect;
15 
16 class SK_API SkSVGRect final : public SkSVGShape {
17 public:
18  static sk_sp<SkSVGRect> Make() { return sk_sp<SkSVGRect>(new SkSVGRect()); }
19 
22  SVG_ATTR(Width , SkSVGLength, SkSVGLength(0))
23  SVG_ATTR(Height, SkSVGLength, SkSVGLength(0))
24 
27 
28 protected:
29  bool parseAndSetAttribute(const char*, const char*) override;
30 
31  void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
32  SkPathFillType) const override;
33 
34  SkPath onAsPath(const SkSVGRenderContext&) const override;
35 
36  SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override;
37 
38 private:
39  SkSVGRect();
40 
41  SkRRect resolve(const SkSVGLengthContext&) const;
42 
43  using INHERITED = SkSVGShape;
44 };
45 
46 #endif // SkSVGRect_DEFINED
SkPathFillType
Definition: SkPathTypes.h:11
#define SVG_OPTIONAL_ATTR(attr_name, attr_type)
Definition: SkSVGNode.h:213
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
SkPath contain geometry.
Definition: SkPath.h:58
SkRRect describes a rounded rectangle with a bounds and a pair of radii for each corner.
Definition: SkRRect.h:35
Definition: SkRefCnt.h:119
Definition: SkSVGRenderContext.h:27
Definition: SkSVGTypes.h:116
Definition: SkSVGRect.h:16
static sk_sp< SkSVGRect > Make()
Definition: SkSVGRect.h:18
Definition: SkSVGRenderContext.h:61
Definition: SkSVGShape.h:17
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582