1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
23 #include "svgnode.hxx"
24 #include "svgstyleattributes.hxx"
25 #include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
32 class SvgGradientNode
: public SvgNode
36 SvgStyleAttributes maSvgStyleAttributes
;
38 /// linear gradient values
44 /// radial gradient values
51 /// variable scan values, dependent of given XAttributeList
52 SvgUnits maGradientUnits
;
53 drawinglayer::primitive2d::SpreadMethod maSpreadMethod
;
54 std::unique_ptr
<basegfx::B2DHomMatrix
> mpaGradientTransform
;
56 /// link to another gradient used as style. If maXLink
57 /// is set, the node can be fetched on demand by using
58 // tryToFindLink (buffered)
59 mutable bool mbResolvingLink
; // protect against infinite link recursion
61 const SvgGradientNode
* mpXLink
;
69 SvgDocument
& rDocument
,
71 virtual ~SvgGradientNode() override
;
73 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
74 virtual void parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
) override
;
76 /// collect gradient stop entries
77 void collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector
& aVector
) const;
80 const SvgNumber
getX1() const;
83 const SvgNumber
getY1() const;
86 const SvgNumber
getX2() const;
89 const SvgNumber
getY2() const;
92 const SvgNumber
getCx() const;
95 const SvgNumber
getCy() const;
98 const SvgNumber
getR() const;
101 const SvgNumber
* getFx() const;
104 const SvgNumber
* getFy() const;
106 /// gradientUnits content
107 SvgUnits
getGradientUnits() const { return maGradientUnits
; }
108 void setGradientUnits(const SvgUnits aGradientUnits
) { maGradientUnits
= aGradientUnits
; }
110 /// SpreadMethod content
111 drawinglayer::primitive2d::SpreadMethod
getSpreadMethod() const { return maSpreadMethod
; }
112 void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod
) { maSpreadMethod
= aSpreadMethod
; }
114 /// transform content, set if found in current context
115 const basegfx::B2DHomMatrix
* getGradientTransform() const;
116 void setGradientTransform(const basegfx::B2DHomMatrix
* pMatrix
);
118 } // end of namespace svgreader
119 } // end of namespace svgio
121 #endif // INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */