viewbox.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
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

Generated on Sun Jan 7 22:53:57 2007 by  doxygen 1.5.1