bmapdata.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 2000-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Wed Jan 19 17:25:51 2000
00011 // commit: $Id: bmapdata.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/media/bmapdata.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_MEDIA_BMAPDATA_H_UTC20050626084018_DEFINED
00036 #define GROOVX_MEDIA_BMAPDATA_H_UTC20050626084018_DEFINED
00037 
00038 namespace rutz
00039 {
00040   template <class T> class shared_ptr;
00041 }
00042 
00043 namespace geom
00044 {
00045   template <class V> class vec2;
00046 }
00047 
00048 namespace media
00049 {
00051 
00063 
00064 
00065   class bmap_data
00066   {
00067   public:
00069     class update_func
00070     {
00071     public:
00073       virtual ~update_func();
00074 
00077       virtual void update(bmap_data& update_me) = 0;
00078     };
00079 
00081     enum row_order
00082       {
00083         TOP_FIRST,
00084         BOTTOM_FIRST
00085       };
00086 
00087     //---------------------------------------------------------
00088     //
00089     // Creators
00090     //
00091     //---------------------------------------------------------
00092 
00094     bmap_data();
00095 
00097     bmap_data(const geom::vec2<int>& dims,
00098               int bits_per_pixel,
00099               int byte_alignment);
00100 
00102     bmap_data(const bmap_data& other);
00103 
00105     bmap_data& operator=(const bmap_data& other)
00106     {
00107       bmap_data copy(other);
00108       this->swap(copy);
00109       return *this;
00110     }
00111 
00113     ~bmap_data();
00114 
00115     //---------------------------------------------------------
00116     //
00117     // Accessors
00118     //
00119     //---------------------------------------------------------
00120 
00122     unsigned char* bytes_ptr() const;
00123 
00125 
00127     unsigned char* row_ptr(unsigned int row) const;
00128 
00130     long int bytes_sum() const;
00131 
00133     int width() const;
00134 
00136     int height() const;
00137 
00139     geom::vec2<int> size() const;
00140 
00142     int bits_per_pixel() const;
00143 
00145 
00149     int bits_per_component() const;
00150 
00152 
00154     int byte_alignment() const;
00155 
00157 
00159     unsigned int byte_count() const;
00160 
00162     unsigned int bytes_per_row() const;
00163 
00165     row_order get_row_order() const;
00166 
00167     //---------------------------------------------------------
00168     //
00169     // Manipulators
00170     //
00171     //---------------------------------------------------------
00172 
00174     void flip_contrast();
00175 
00177     void flip_vertical();
00178 
00180     void clear();
00181 
00183     void swap(bmap_data& other);
00184 
00186 
00188     void queue_update(rutz::shared_ptr<update_func> updater) const;
00189 
00191     void update_if_needed() const;
00192 
00194     void clear_queued_update() const;
00195 
00197 
00199     void set_row_order(row_order order) const;
00200 
00202     void specify_row_order(row_order order) const;
00203 
00205     rutz::shared_ptr<bmap_data>
00206     make_scrambled(int numsubcols, int numsubrows,
00207                    int seed,
00208                    bool allow_move_subparts = true,
00209                    bool allow_flip_left_right = true,
00210                    bool allow_flip_top_bottom = true) const;
00211 
00212   private:
00213     class impl;
00214     impl* rep;
00215   };
00216 
00217 } // end namespace media
00218 
00219 static const char __attribute__((used)) vcid_groovx_media_bmapdata_h_utc20050626084018[] = "$Id: bmapdata.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00220 #endif // !GROOVX_MEDIA_BMAPDATA_H_UTC20050626084018_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:39 2008 by Doxygen version 1.5.5.