viewbox.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 #ifndef PAPYRUSVIEWBOX_H
00021 #define PAPYRUSVIEWBOX_H
00022
00023 #include <papyrus/pointer.h>
00024 #include <papyrus/region.h>
00025 #include <papyrus/matrix.h>
00026
00027 namespace Papyrus {
00028
00078 class Viewbox : public Region {
00079 public:
00080
00081 typedef enum ALIGN {
00082 ALIGN_NONE,
00083 ALIGN_XMIN_YMIN,
00084 ALIGN_XMID_YMIN,
00085 ALIGN_XMAX_YMIN,
00086 ALIGN_XMIN_YMID,
00087 ALIGN_XMID_YMID,
00088 ALIGN_XMAX_YMID,
00089 ALIGN_XMIN_YMAX,
00090 ALIGN_XMID_YMAX,
00091 ALIGN_XMAX_YMAX,
00092 } ALIGN;
00093
00094 typedef enum MEET_OR_SLICE {
00095 MEET,
00096 SLICE
00097 } MEET_OR_SLICE;
00098
00099 typedef PapyrusPointer<Viewbox> pointer;
00100
00101
00102
00103
00104 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);
00105
00106 Viewbox(const Region& region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00107
00108 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);
00109
00110 static pointer create(const Region& region, ALIGN align=ALIGN_NONE, MEET_OR_SLICE meet_or_slice = MEET);
00111
00112 virtual ~Viewbox();
00113
00114 Viewbox& operator=( const Region& other );
00115
00116 Viewbox& operator=( const Viewbox& other );
00117
00118 bool operator==( const Region& other );
00119
00120 bool operator==( const Viewbox& other );
00121
00122 void set_preserve_aspect_ratio(ALIGN align, MEET_OR_SLICE meet_or_slice = MEET);
00123
00124 ALIGN alignment() const;
00125
00126 MEET_OR_SLICE meet_or_slice() const;
00127
00129 Matrix transformation_matrix(const Region& box) const;
00130
00131 protected:
00132 ALIGN m_align;
00133 MEET_OR_SLICE m_meet_or_slice;
00134
00135 };
00136
00137 }
00138
00139 #endif