00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _PIXMAP_IMAGETILE_H_
00018 #define _PIXMAP_IMAGETILE_H_ 1
00019
00027 #include <lib/sconfig.h>
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
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