]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/iffdecod.h
2 // iffdecod.h - image handler for IFF/ILBM images
4 // (c) Steffen Gutmann, 2002
6 // Creation date: 08.01.2002
7 // Last modified: 12.01.2002
10 #ifndef WX_IIF_DECODE_H
11 #define WX_IIF_DECODE_H
14 #pragma interface "iffdecod.h"
20 #if wxUSE_STREAMS && wxUSE_IFF
22 #include "wx/stream.h"
25 // --------------------------------------------------------------------------
27 // --------------------------------------------------------------------------
30 // Note that the error code wxIFF_TRUNCATED means that the image itself
31 // is most probably OK, but the decoder didn't reach the end of the data
32 // stream; this means that if it was not reading directly from file,
33 // the stream will not be correctly positioned.
38 wxIFF_OK
= 0, /* everything was OK */
39 wxIFF_INVFORMAT
, /* error in iff header */
40 wxIFF_MEMERR
, /* error allocating memory */
41 wxIFF_TRUNCATED
/* file appears to be truncated */
44 // --------------------------------------------------------------------------
46 // --------------------------------------------------------------------------
48 // internal class for storing IFF image data
52 unsigned int w
; /* width */
53 unsigned int h
; /* height */
54 int transparent
; /* transparent color (-1 = none) */
55 int colors
; /* number of colors */
56 unsigned char *p
; /* bitmap */
57 unsigned char *pal
; /* palette */
59 IFFImage() : w(0), h(0), colors(0), p(0), pal(0) {}
60 ~IFFImage() { delete [] p
; delete [] pal
; }
63 class WXDLLEXPORT wxIFFDecoder
66 IFFImage
*m_image
; // image data
67 wxInputStream
*m_f
; // input stream
68 unsigned char *databuf
;
69 unsigned char *picptr
;
70 unsigned char *decomp_mem
;
75 // get data of current frame
76 unsigned char* GetData() const;
77 unsigned char* GetPalette() const;
78 int GetNumColors() const;
79 unsigned int GetWidth() const;
80 unsigned int GetHeight() const;
81 int GetTransparentColour() const;
83 // constructor, destructor, etc.
84 wxIFFDecoder(wxInputStream
*s
);
85 ~wxIFFDecoder() { Destroy(); }
88 bool ConvertToImage(wxImage
*image
) const;
92 #endif // wxUSE_STREAM && wxUSE_IFF
93 #endif // _WX_IFFDECOD_H