2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #ifndef SVGPreserveAspectRatio_h
24 #define SVGPreserveAspectRatio_h
28 #include <wtf/RefCounted.h>
29 #include <PlatformString.h>
34 class AffineTransform;
35 class SVGStyledElement;
37 class SVGPreserveAspectRatio : public RefCounted<SVGPreserveAspectRatio> {
39 enum SVGPreserveAspectRatioType {
40 SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
41 SVG_PRESERVEASPECTRATIO_NONE = 1,
42 SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
43 SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
44 SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
45 SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
46 SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
47 SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
48 SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
49 SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
50 SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
53 enum SVGMeetOrSliceType {
54 SVG_MEETORSLICE_UNKNOWN = 0,
55 SVG_MEETORSLICE_MEET = 1,
56 SVG_MEETORSLICE_SLICE = 2
59 SVGPreserveAspectRatio();
60 virtual ~SVGPreserveAspectRatio();
62 void setAlign(unsigned short);
63 unsigned short align() const;
65 void setMeetOrSlice(unsigned short);
66 unsigned short meetOrSlice() const;
68 AffineTransform getCTM(double logicX, double logicY,
69 double logicWidth, double logicHeight,
70 double physX, double physY,
71 double physWidth, double physHeight);
74 bool parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate = true);
77 unsigned short m_align;
78 unsigned short m_meetOrSlice;
81 } // namespace WebCore
84 #endif // SVGPreserveAspectRatio_h