KHtml

SVGPreserveAspectRatio.h
1 /*
2  Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
6 
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.
11 
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.
16 
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.
21 */
22 
23 #ifndef SVGPreserveAspectRatio_h
24 #define SVGPreserveAspectRatio_h
25 
26 #if ENABLE(SVG)
27 #include "PlatformString.h"
28 #include "SVGNames.h"
29 #include "Document.h"
30 
31 #include <wtf/RefCounted.h>
32 
33 //khtml
34 #include <wtf/PassRefPtr.h>
35 
36 namespace WebCore
37 {
38 
39 //class String;
40 class AffineTransform;
41 class SVGStyledElement;
42 
43 class SVGPreserveAspectRatio : public RefCounted<SVGPreserveAspectRatio>
44 {
45 public:
46  static PassRefPtr<SVGPreserveAspectRatio> create()
47  {
48  return adoptRef(new SVGPreserveAspectRatio);
49  }
50 
51  enum SVGPreserveAspectRatioType {
52  SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
53  SVG_PRESERVEASPECTRATIO_NONE = 1,
54  SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
55  SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
56  SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
57  SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
58  SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
59  SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
60  SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
61  SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
62  SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
63  };
64 
65  enum SVGMeetOrSliceType {
66  SVG_MEETORSLICE_UNKNOWN = 0,
67  SVG_MEETORSLICE_MEET = 1,
68  SVG_MEETORSLICE_SLICE = 2
69  };
70 
71  virtual ~SVGPreserveAspectRatio();
72 
73  void setAlign(unsigned short);
74  unsigned short align() const;
75 
76  void setMeetOrSlice(unsigned short);
77  unsigned short meetOrSlice() const;
78 
79  AffineTransform getCTM(double logicX, double logicY,
80  double logicWidth, double logicHeight,
81  double physX, double physY,
82  double physWidth, double physHeight);
83 
84  // Helper
85  bool parsePreserveAspectRatio(const UChar *&currParam, const UChar *end, bool validate = true);
86 
87  const QualifiedName &associatedAttributeName() const
88  {
89  return SVGNames::preserveAspectRatioAttr;
90  }
91 
92 private:
93  SVGPreserveAspectRatio();
94 
95  unsigned short m_align;
96  unsigned short m_meetOrSlice;
97 };
98 
99 } // namespace WebCore
100 
101 #endif // ENABLE(SVG)
102 #endif // SVGPreserveAspectRatio_h
103 
QAction * create(StandardAction id, const QObject *recvr, Func slot, QObject *parent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.