Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/pixmap/imagetile.h

Go to the documentation of this file.
00001 /*
00002  * lib/pixmap/imagetile.h
00003  * 
00004  * Stores the data of an image tile in memory provides pixel access functions. 
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #ifndef _PIXMAP_IMAGETILE_H_
00018 #define _PIXMAP_IMAGETILE_H_ 1
00019 
00027 #include <lib/sconfig.h>    /* MUST be first */
00028 #include <lib/pixmap/format.h>
00029 
00030 
00034 class PixmapImageTileInternal;
00035 
00056 class PixmapImageTile
00057 {
00058     friend class PixmapImageTileInternal;
00059     private:
00060         uint w,h;        
00061         size_t size;     
00062     public:
00063         char *data;      
00064     
00065     private:
00070         struct Methods
00071         {
00072             void (*getpixel8)(const PixmapImageTile *,uint x,uint y,uint8 *p);
00073             void (*getpixel16)(const PixmapImageTile *,uint x,uint y,uint16 *p);
00074             void (*getpixelF)(const PixmapImageTile *,uint x,uint y,flt *p);
00075             void (*putpixel8)(PixmapImageTile *,uint x,uint y,const uint8 *p);
00076             void (*putpixel16)(PixmapImageTile *,uint x,uint y,const uint16 *p);
00077             void (*putpixelF)(PixmapImageTile *,uint x,uint y,const flt *p);
00078             
00079             // NO METHODS!
00080         } meth;
00081         
00083         void _ZapPixelFuncs();
00084         
00089         int _SetPixelFuncs(const PixmapFormat &pf);
00090         
00092         PixmapImageTile(const PixmapImageTile &);
00093         void operator=(const PixmapImageTile &);
00094     public:
00098         PixmapImageTile();
00102         PixmapImageTile(const PixmapFormat &pf,uint width,uint height);
00103         
00104         ~PixmapImageTile();
00105         
00109         void setup(const PixmapFormat &pf,uint width,uint height);
00110         
00112         inline uint width() const   {  return(w);  }
00113         inline uint height() const  {  return(h);  }
00114         
00117         inline uint DataSize() const  {  return(size);  }
00118         
00131         inline void GetPixel8(uint x,uint y,uint8 *p) const
00132             {  (*meth.getpixel8)(this,x,y,p);  }
00133         inline void PutPixel8(uint x,uint y,const uint8 *p)
00134             {  (*meth.putpixel8)(this,x,y,p);  }
00135         inline void GetPixel16(uint x,uint y,uint16 *p) const
00136             {  (*meth.getpixel16)(this,x,y,p);  }
00137         inline void PutPixel16(uint x,uint y,const uint16 *p)
00138             {  (*meth.putpixel16)(this,x,y,p);  }
00139         
00145         inline void GetPixelF(uint x,uint y,flt *p) const
00146             {  (*meth.getpixelF)(this,x,y,p);  }
00147         inline void PutPixelF(uint x,uint y,const flt *p)
00148             {  (*meth.putpixelF)(this,x,y,p);  }
00149 };
00150 
00151 #endif  /* _PIXMAP_IMAGETILE_H_ */

Generated on Sat Feb 19 22:33:46 2005 for Ray by doxygen 1.3.5