File indexing completed on 2025-01-26 04:04:57
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Sharaf Zaman <sharafzaz121@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef KISMESHGRADIENT_H 0007 #define KISMESHGRADIENT_H 0008 0009 #include <QGradient> 0010 0011 #include <KoFlakeCoordinateSystem.h> 0012 #include "SvgMeshPatch.h" 0013 #include "SvgMeshArray.h" 0014 0015 class KRITAFLAKE_EXPORT SvgMeshGradient 0016 { 0017 public: 0018 enum Shading { 0019 BILINEAR, 0020 BICUBIC, 0021 }; 0022 0023 SvgMeshGradient(); 0024 SvgMeshGradient(const SvgMeshGradient& other); 0025 0026 void setType(Shading type); 0027 SvgMeshGradient::Shading type() const; 0028 0029 void setTransform(const QTransform& matrix); 0030 bool isValid() const; 0031 0032 void setGradientUnits(KoFlake::CoordinateSystem units = KoFlake::UserSpaceOnUse) { 0033 m_gradientUnits = units; 0034 } 0035 0036 KoFlake::CoordinateSystem gradientUnits() const { 0037 return m_gradientUnits; 0038 } 0039 0040 // returns boundingRect of the meshpatches in "user" coordinates (QPainter's) 0041 QRectF boundingRect() const; 0042 0043 const QScopedPointer<SvgMeshArray>& getMeshArray() const; 0044 0045 private: 0046 Shading m_type; 0047 KoFlake::CoordinateSystem m_gradientUnits; 0048 QScopedPointer<SvgMeshArray> m_mesharray; 0049 }; 0050 0051 #endif // KISMESHGRADIENT_H