2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 VGradient::VGradient(VGradient::Type type)
25 mSpread(VGradient::Spread::Pad),
26 mMode(VGradient::Mode::Absolute)
30 void VGradient::setStops(const VGradientStops &stops)
35 VLinearGradient::VLinearGradient(const VPointF &start, const VPointF &stop)
36 : VGradient(VGradient::Type::Linear)
38 linear.x1 = start.x();
39 linear.y1 = start.y();
44 VLinearGradient::VLinearGradient(float xStart, float yStart, float xStop,
46 : VGradient(VGradient::Type::Linear)
54 VRadialGradient::VRadialGradient(const VPointF ¢er, float cradius,
55 const VPointF &focalPoint, float fradius)
56 : VGradient(VGradient::Type::Radial)
58 radial.cx = center.x();
59 radial.cy = center.y();
60 radial.fx = focalPoint.x();
61 radial.fy = focalPoint.y();
62 radial.cradius = cradius;
63 radial.fradius = fradius;
66 VRadialGradient::VRadialGradient(float cx, float cy, float cradius, float fx,
67 float fy, float fradius)
68 : VGradient(VGradient::Type::Radial)
74 radial.cradius = cradius;
75 radial.fradius = fradius;
78 VBrush::VBrush(const VColor &color) : mType(VBrush::Type::Solid), mColor(color)
82 VBrush::VBrush(int r, int g, int b, int a)
83 : mType(VBrush::Type::Solid), mColor(r, g, b, a)
88 VBrush::VBrush(const VGradient *gradient)
90 if (!gradient) return;
94 if (gradient->mType == VGradient::Type::Linear) {
95 mType = VBrush::Type::LinearGradient;
96 } else if (gradient->mType == VGradient::Type::Radial) {
97 mType = VBrush::Type::RadialGradient;
101 VBrush::VBrush(const VBitmap &texture)
103 if (!texture.valid()) return;
105 mType = VBrush::Type::Texture;
109 void VBrush::setMatrix(const VMatrix &m)