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     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

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1