00001 00003 00004 // 00005 // Copyright (c) 2002-2004 California Institute of Technology 00006 // Copyright (c) 2004-2007 University of Southern California 00007 // Rob Peters <rjpeters at usc dot edu> 00008 // 00009 // created: Tue Jun 15 11:30:24 1999 (as bitmap.h) 00010 // commit: $Id: gxpixmap.h 10065 2007-04-12 05:54:56Z rjpeters $ 00011 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/gfx/gxpixmap.h $ 00012 // 00013 // -------------------------------------------------------------------- 00014 // 00015 // This file is part of GroovX. 00016 // [http://ilab.usc.edu/rjpeters/groovx/] 00017 // 00018 // GroovX is free software; you can redistribute it and/or modify it 00019 // under the terms of the GNU General Public License as published by 00020 // the Free Software Foundation; either version 2 of the License, or 00021 // (at your option) any later version. 00022 // 00023 // GroovX is distributed in the hope that it will be useful, but 00024 // WITHOUT ANY WARRANTY; without even the implied warranty of 00025 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00026 // General Public License for more details. 00027 // 00028 // You should have received a copy of the GNU General Public License 00029 // along with GroovX; if not, write to the Free Software Foundation, 00030 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00031 // 00033 00034 #ifndef GROOVX_GFX_GXPIXMAP_H_UTC20050626084023_DEFINED 00035 #define GROOVX_GFX_GXPIXMAP_H_UTC20050626084023_DEFINED 00036 00037 #include "gfx/gxshapekit.h" 00038 00039 #include <iosfwd> 00040 00041 namespace geom 00042 { 00043 template <class V> class rect; 00044 template <class V> class vec2; 00045 } 00046 00047 namespace media 00048 { 00049 class bmap_data; 00050 } 00051 00052 class GxPixmapImpl; 00053 00054 // ####################################################### 00055 // ======================================================= 00056 00058 00059 class GxPixmap : public GxShapeKit 00060 { 00062 // creators // 00064 00065 protected: 00067 GxPixmap(); 00068 00069 public: 00071 static GxPixmap* make(); 00072 00074 virtual ~GxPixmap() throw(); 00075 00076 virtual io::version_id class_version_id() const; 00077 virtual void read_from(io::reader& reader); 00078 virtual void write_to(io::writer& writer) const; 00079 00081 // actions // 00083 00085 00086 void loadImage(const char* filename); 00087 00089 void loadImageStream(std::istream& ist); 00090 00092 00095 void reload(); 00096 00098 00100 void queueImage(const char* filename); 00101 00103 00104 void saveImage(const char* filename) const; 00105 00107 00109 void grabScreenRect(nub::soft_ref<Gfx::Canvas> canvas, 00110 const geom::rect<int>& rect); 00111 00113 void grabScreen(nub::soft_ref<Gfx::Canvas> canvas); 00114 00116 00118 void grabWorldRect(nub::soft_ref<Gfx::Canvas> canvas, 00119 const geom::rect<double>& rect); 00120 00122 00126 void flipContrast(); 00127 00129 00132 void flipVertical(); 00133 00135 // accessors // 00137 00139 geom::vec2<int> size() const; 00140 00142 geom::vec2<double> getZoom() const; 00143 00145 bool getUsingZoom() const; 00146 00148 00150 bool isPurgeable() const; 00151 00153 const char* filename() const; 00154 00156 bool getAsBitmap() const; 00157 00159 long int checkSum() const; 00160 00162 // manipulators // 00164 00166 media::bmap_data& data(); 00167 00169 void setZoom(geom::vec2<double> zoom); 00170 00172 void zoomTo(geom::vec2<int> sz); 00173 00175 void setUsingZoom(bool val); 00176 00178 void setPurgeable(bool val); 00179 00181 void setAsBitmap(bool val); 00182 00183 void scramble(int numsubcols, int numsubrows, int seed, 00184 bool allowMoveSubparts = true, 00185 bool allowFlipLeftRight = true, 00186 bool allowFlipTopBottom = true); 00187 00188 protected: 00190 virtual void grRender(Gfx::Canvas& canvas) const; 00191 00192 virtual void grGetBoundingBox(Gfx::Bbox& bbox) const; 00193 00194 private: 00195 GxPixmap(const GxPixmap&); 00196 GxPixmap& operator=(const GxPixmap&); 00197 00198 GxPixmapImpl* const rep; 00199 }; 00200 00201 static const char __attribute__((used)) vcid_groovx_gfx_gxpixmap_h_utc20050626084023[] = "$Id: gxpixmap.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file: 00202 #endif // !GROOVX_GFX_GXPIXMAP_H_UTC20050626084023_DEFINED