Debian Codegraph @

modules/svg/include/SkSVGMask.h

raw
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 SkSVGMask_DEFINED
9 #define SkSVGMask_DEFINED
10
11 #include "include/core/SkRect.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/private/base/SkAPI.h"
14 #include "modules/svg/include/SkSVGHiddenContainer.h"
15 #include "modules/svg/include/SkSVGNode.h"
16 #include "modules/svg/include/SkSVGTypes.h"
17
18 class SkSVGRenderContext;
19
20 class SK_API SkSVGMask final : public SkSVGHiddenContainer {
21 public:
22 static sk_sp<SkSVGMask> Make() {
23 return sk_sp<SkSVGMask>(new SkSVGMask());
24 }
25
26 SVG_ATTR(X , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
27 SVG_ATTR(Y , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
28 SVG_ATTR(Width , SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
29 SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
30
31 SVG_ATTR(MaskUnits, SkSVGObjectBoundingBoxUnits,
32 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))
33 SVG_ATTR(MaskContentUnits, SkSVGObjectBoundingBoxUnits,
34 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse))
35
36 private:
37 friend class SkSVGRenderContext;
38
39 SkSVGMask() : INHERITED(SkSVGTag::kMask) {}
40
41 bool parseAndSetAttribute(const char*, const char*) override;
42
43 SkRect bounds(const SkSVGRenderContext&) const;
44 void renderMask(const SkSVGRenderContext&) const;
45
46 using INHERITED = SkSVGHiddenContainer;
47 };
48
49 #endif // SkSVGMask_DEFINED