KHTML
SVGPreserveAspectRatio.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef SVGPreserveAspectRatio_h 00024 #define SVGPreserveAspectRatio_h 00025 00026 #if ENABLE(SVG) 00027 #include "PlatformString.h" 00028 #include "SVGNames.h" 00029 #include "Document.h" 00030 00031 #include <wtf/RefCounted.h> 00032 00033 //khtml 00034 #include <wtf/PassRefPtr.h> 00035 00036 namespace WebCore { 00037 00038 //class String; 00039 class AffineTransform; 00040 class SVGStyledElement; 00041 00042 class SVGPreserveAspectRatio : public RefCounted<SVGPreserveAspectRatio> { 00043 public: 00044 static PassRefPtr<SVGPreserveAspectRatio> create() { return adoptRef(new SVGPreserveAspectRatio); } 00045 00046 enum SVGPreserveAspectRatioType { 00047 SVG_PRESERVEASPECTRATIO_UNKNOWN = 0, 00048 SVG_PRESERVEASPECTRATIO_NONE = 1, 00049 SVG_PRESERVEASPECTRATIO_XMINYMIN = 2, 00050 SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3, 00051 SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4, 00052 SVG_PRESERVEASPECTRATIO_XMINYMID = 5, 00053 SVG_PRESERVEASPECTRATIO_XMIDYMID = 6, 00054 SVG_PRESERVEASPECTRATIO_XMAXYMID = 7, 00055 SVG_PRESERVEASPECTRATIO_XMINYMAX = 8, 00056 SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9, 00057 SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10 00058 }; 00059 00060 enum SVGMeetOrSliceType { 00061 SVG_MEETORSLICE_UNKNOWN = 0, 00062 SVG_MEETORSLICE_MEET = 1, 00063 SVG_MEETORSLICE_SLICE = 2 00064 }; 00065 00066 virtual ~SVGPreserveAspectRatio(); 00067 00068 void setAlign(unsigned short); 00069 unsigned short align() const; 00070 00071 void setMeetOrSlice(unsigned short); 00072 unsigned short meetOrSlice() const; 00073 00074 AffineTransform getCTM(double logicX, double logicY, 00075 double logicWidth, double logicHeight, 00076 double physX, double physY, 00077 double physWidth, double physHeight); 00078 00079 // Helper 00080 bool parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate = true); 00081 00082 const QualifiedName& associatedAttributeName() const { return SVGNames::preserveAspectRatioAttr; } 00083 00084 private: 00085 SVGPreserveAspectRatio(); 00086 00087 unsigned short m_align; 00088 unsigned short m_meetOrSlice; 00089 }; 00090 00091 } // namespace WebCore 00092 00093 #endif // ENABLE(SVG) 00094 #endif // SVGPreserveAspectRatio_h 00095
KDE 4.6 API Reference