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 Viewbox(const Region& region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00103
00104 static 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);
00105
00106 static pointer create(const Region& region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00107
00108 ~Viewbox();
00109
00110 Viewbox& operator=( const Region& other );
00111
00112 Viewbox& operator=( const Viewbox& other );
00113
00114 bool operator==( const Region& other );
00115
00116 bool operator==( const Viewbox& other );
00117
00118 void set_preserve_aspect_ratio(ALIGN align, MEET_OR_SLICE meet_or_slice = MEET);
00119
00120 ALIGN alignment() const;
00121
00122 MEET_OR_SLICE meet_or_slice() const;
00123
00124 Cairo::Matrix transformation_matrix(const Region& box) const;
00125
00126 protected:
00127 ALIGN m_align;
00128 MEET_OR_SLICE m_meet_or_slice;
00129
00130 };
00131
00132 }
00133
00134 #endif