KHTML
SVGPreserveAspectRatio.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00034 #include <wtf/PassRefPtr.h>
00035
00036 namespace WebCore {
00037
00038
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
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 }
00092
00093 #endif // ENABLE(SVG)
00094 #endif // SVGPreserveAspectRatio_h
00095