1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2021 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#ifndef SkSVGMask_DEFINED
9cb93a386Sopenharmony_ci#define SkSVGMask_DEFINED
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#include "modules/svg/include/SkSVGHiddenContainer.h"
12cb93a386Sopenharmony_ci#include "modules/svg/include/SkSVGTypes.h"
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_ciclass SkSVGMask final : public SkSVGHiddenContainer {
15cb93a386Sopenharmony_cipublic:
16cb93a386Sopenharmony_ci    static sk_sp<SkSVGMask> Make() {
17cb93a386Sopenharmony_ci        return sk_sp<SkSVGMask>(new SkSVGMask());
18cb93a386Sopenharmony_ci    }
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ci    SVG_ATTR(X     , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
21cb93a386Sopenharmony_ci    SVG_ATTR(Y     , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
22cb93a386Sopenharmony_ci    SVG_ATTR(Width , SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
23cb93a386Sopenharmony_ci    SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
24cb93a386Sopenharmony_ci
25cb93a386Sopenharmony_ci    SVG_ATTR(MaskUnits, SkSVGObjectBoundingBoxUnits,
26cb93a386Sopenharmony_ci             SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))
27cb93a386Sopenharmony_ci    SVG_ATTR(MaskContentUnits, SkSVGObjectBoundingBoxUnits,
28cb93a386Sopenharmony_ci             SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse))
29cb93a386Sopenharmony_ci
30cb93a386Sopenharmony_ciprivate:
31cb93a386Sopenharmony_ci    friend class SkSVGRenderContext;
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ci    SkSVGMask() : INHERITED(SkSVGTag::kMask) {}
34cb93a386Sopenharmony_ci
35cb93a386Sopenharmony_ci    bool parseAndSetAttribute(const char*, const char*) override;
36cb93a386Sopenharmony_ci
37cb93a386Sopenharmony_ci    SkRect bounds(const SkSVGRenderContext&) const;
38cb93a386Sopenharmony_ci    void renderMask(const SkSVGRenderContext&) const;
39cb93a386Sopenharmony_ci
40cb93a386Sopenharmony_ci    using INHERITED = SkSVGHiddenContainer;
41cb93a386Sopenharmony_ci};
42cb93a386Sopenharmony_ci
43cb93a386Sopenharmony_ci#endif // SkSVGMask_DEFINED
44