00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifndef _WX_IMAGRGB_H_
00011 #define _WX_IMAGRGB_H_
00012
00013 #include "wx/image.h"
00014
00016 typedef struct _ImageRec
00017 {
00018 unsigned short imagic;
00019 unsigned short type;
00020 unsigned short dim;
00021 unsigned short xsize, ysize, zsize;
00022 unsigned int min, max;
00023 unsigned int wasteBytes;
00024 char name[80];
00025 unsigned long colorMap;
00026 FILE *file;
00027 unsigned char *tmp, *tmpR, *tmpG, *tmpB;
00028 unsigned long rleEnd;
00029 unsigned int *rowStart;
00030 int *rowSize;
00031 } ImageRec;
00032
00033
00034
00035
00036
00037
00039 class WXDLLEXPORT wxRGBHandler : public wxImageHandler
00040 {
00041 public:
00043 inline wxRGBHandler()
00044 {
00045 m_name = wxT("RGB file");
00046 m_extension = wxT("rgb");
00047 m_type = wxBITMAP_TYPE_ANY;
00048 m_mime = wxT("image/rgb");
00049 }
00050
00051 #if wxUSE_STREAMS
00053 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
00055 virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
00056 protected:
00058 virtual bool DoCanRead( wxInputStream& stream );
00059 #endif
00060
00061 private:
00062
00063
00064 void ConvertShort(unsigned short *array, long length);
00065 void ConvertLong(unsigned *array, long length);
00066 ImageRec *ImageOpen(wxBufferedInputStream &buf_stream);
00067 void ImageClose(ImageRec *img);
00068 void ImageGetRow(wxBufferedInputStream &buf_stream, ImageRec *img, unsigned char *buf, int y, int z);
00069 };
00070
00071
00072
00073 #endif
00074
00075