00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PAPYRUSVIEWBOX_H
00020 #define PAPYRUSVIEWBOX_H
00021
00022 #include <papyrus/smart_pointer.h>
00023
00024 #include <papyrus/region.h>
00025
00026 namespace Papyrus {
00027
00077 class ViewBox : public Region {
00078 public:
00079
00080 typedef enum ALIGN {
00081 ALIGN_NONE,
00082 ALIGN_XMIN_YMIN,
00083 ALIGN_XMID_YMIN,
00084 ALIGN_XMAX_YMIN,
00085 ALIGN_XMIN_YMID,
00086 ALIGN_XMID_YMID,
00087 ALIGN_XMAX_YMID,
00088 ALIGN_XMIN_YMAX,
00089 ALIGN_XMID_YMAX,
00090 ALIGN_XMAX_YMAX,
00091 } ALIGN;
00092
00093 typedef enum MEET_OR_SLICE {
00094 MEET,
00095 SLICE
00096 } MEET_OR_SLICE;
00097
00098 typedef PapyrusSmartPointer<ViewBox> pointer;
00099
00100 ViewBox(double x=0.0, double y=0.0, double w=0.0, double h=0.0, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00101
00102 static ViewBox::pointer create(double x=0.0, double y=0.0, double w=0.0, double h=0.0, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00103
00104 ~ViewBox();
00105
00106 void set_preserve_aspect_ratio(ALIGN align, MEET_OR_SLICE meet_or_slice = MEET);
00107
00108 ALIGN alignment() const;
00109
00110 MEET_OR_SLICE meet_or_slice() const;
00111
00112 Cairo::Matrix transformation_matrix(const Region& box) const;
00113
00114 protected:
00115 ALIGN m_align;
00116 MEET_OR_SLICE m_meet_or_slice;
00117
00118 };
00119
00120 }
00121
00122 #endif