00001 #ifndef COIN_SBIMAGE_H
00002 #define COIN_SBIMAGE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/SbVec2s.h>
00028 #include <Inventor/SbVec3s.h>
00029 #include <Inventor/SbString.h>
00030 #include <stddef.h>
00031
00032 class SbImage;
00033
00034 typedef SbBool SbImageScheduleReadCB(const SbString &, SbImage *, void *);
00035
00036 class COIN_DLL_API SbImage {
00037 public:
00038 SbImage(void);
00039 SbImage(const unsigned char * bytes,
00040 const SbVec2s & size, const int bytesperpixel);
00041 SbImage(const unsigned char * bytes,
00042 const SbVec3s & size, const int bytesperpixel);
00043 ~SbImage();
00044
00045 void setValue(const SbVec2s & size, const int bytesperpixel,
00046 const unsigned char * bytes);
00047 void setValue(const SbVec3s & size, const int bytesperpixel,
00048 const unsigned char * bytes);
00049 void setValuePtr(const SbVec2s & size, const int bytesperpixel,
00050 const unsigned char * bytes);
00051 void setValuePtr(const SbVec3s & size, const int bytesperpixel,
00052 const unsigned char * bytes);
00053 unsigned char * getValue(SbVec2s & size, int & bytesperpixel) const;
00054 unsigned char * getValue(SbVec3s & size, int & bytesperpixel) const;
00055 SbVec3s getSize(void) const;
00056
00057 SbBool readFile(const SbString & filename,
00058 const SbString * const * searchdirectories = NULL,
00059 const int numdirectories = 0);
00060
00061 int operator==(const SbImage & image) const;
00062 int operator!=(const SbImage & image) const {
00063 return ! operator == (image);
00064 }
00065 SbImage & operator=(const SbImage & image);
00066
00067 static SbString searchForFile(const SbString & basename,
00068 const SbString * const * dirlist,
00069 const int numdirs);
00070
00071 SbBool hasData(void) const;
00072
00073 private:
00074
00075 class SbImageP * pimpl;
00076
00077 public:
00078
00079
00080 void readLock(void) const;
00081 void readUnlock(void) const;
00082
00083 SbBool scheduleReadFile(SbImageScheduleReadCB * cb,
00084 void * closure,
00085 const SbString & filename,
00086 const SbString * const * searchdirectories = NULL,
00087 const int numdirectories = 0);
00088 };
00089
00090 #endif // !COIN_SBIMAGE_H