papyrus logo

viewbox.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
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     // TODO Add support for Object id constructors
00102     // TODO review whether the constructor needs to be made protected
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

Generated on Fri Apr 16 12:40:11 2010 for papyrus by doxygen 1.6.1