xref: /aosp_15_r20/external/skia/modules/svg/src/SkSVGAttribute.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "modules/svg/include/SkSVGAttribute.h"
9 
10 #include "include/core/SkColor.h"
11 
MakeInitial()12 SkSVGPresentationAttributes SkSVGPresentationAttributes::MakeInitial() {
13     SkSVGPresentationAttributes result;
14 
15     result.fFill.set(SkSVGPaint(SkSVGColor(SK_ColorBLACK)));
16     result.fFillOpacity.set(SkSVGNumberType(1));
17     result.fFillRule.set(SkSVGFillRule(SkSVGFillRule::Type::kNonZero));
18     result.fClipRule.set(SkSVGFillRule(SkSVGFillRule::Type::kNonZero));
19 
20     result.fStroke.set(SkSVGPaint(SkSVGPaint::Type::kNone));
21     result.fStrokeDashArray.set(SkSVGDashArray(SkSVGDashArray::Type::kNone));
22     result.fStrokeDashOffset.set(SkSVGLength(0));
23     result.fStrokeLineCap.set(SkSVGLineCap::kButt);
24     result.fStrokeLineJoin.set(SkSVGLineJoin(SkSVGLineJoin::Type::kMiter));
25     result.fStrokeMiterLimit.set(SkSVGNumberType(4));
26     result.fStrokeOpacity.set(SkSVGNumberType(1));
27     result.fStrokeWidth.set(SkSVGLength(1));
28 
29     result.fVisibility.set(SkSVGVisibility(SkSVGVisibility::Type::kVisible));
30 
31     result.fColor.set(SkSVGColorType(SK_ColorBLACK));
32     result.fColorInterpolation.set(SkSVGColorspace::kSRGB);
33     result.fColorInterpolationFilters.set(SkSVGColorspace::kLinearRGB);
34 
35     result.fFontFamily.init("Sans");
36     result.fFontStyle.init(SkSVGFontStyle::Type::kNormal);
37     result.fFontSize.init(SkSVGLength(24));
38     result.fFontWeight.init(SkSVGFontWeight::Type::kNormal);
39     result.fTextAnchor.init(SkSVGTextAnchor::Type::kStart);
40 
41     result.fDisplay.init(SkSVGDisplay::kInline);
42 
43     result.fStopColor.set(SkSVGColor(SK_ColorBLACK));
44     result.fStopOpacity.set(SkSVGNumberType(1));
45     result.fFloodColor.set(SkSVGColor(SK_ColorBLACK));
46     result.fFloodOpacity.set(SkSVGNumberType(1));
47     result.fLightingColor.set(SkSVGColor(SK_ColorWHITE));
48 
49     return result;
50 }
51