X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e4b8154a65be71ca58edf394546b19b0d3516438..498a1eeb8d044ef64815352ecabe4c223adf8c6a:/include/wx/gifdecod.h diff --git a/include/wx/gifdecod.h b/include/wx/gifdecod.h index 09a8927f99..f61739ed7e 100644 --- a/include/wx/gifdecod.h +++ b/include/wx/gifdecod.h @@ -11,11 +11,11 @@ #ifndef _WX_GIFDECOD_H #define _WX_GIFDECOD_H -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface "gifdecod.h" #endif -#include "wx/setup.h" +#include "wx/defs.h" #if wxUSE_STREAMS && wxUSE_GIF @@ -24,10 +24,26 @@ // -------------------------------------------------------------------------- -// constants +// Constants // -------------------------------------------------------------------------- -// disposal method +// Error codes: +// Note that the error code wxGIF_TRUNCATED means that the image itself +// is most probably OK, but the decoder didn't reach the end of the data +// stream; this means that if it was not reading directly from file, +// the stream will not be correctly positioned. the +// +enum +{ + wxGIF_OK = 0, /* everything was OK */ + wxGIF_INVFORMAT, /* error in gif header */ + wxGIF_MEMERR, /* error allocating memory */ + wxGIF_TRUNCATED /* file appears to be truncated */ +}; + +// Disposal method +// Experimental; subject to change. +// enum { wxGIF_D_UNSPECIFIED = -1, /* not specified */ @@ -36,13 +52,6 @@ enum wxGIF_D_TOPREVIOUS = 2 /* restore to previous image */ }; -// error codes -enum -{ - wxGIF_OK = 0, /* everything was OK */ - wxGIF_INVFORMAT = 1, /* error in gif header */ - wxGIF_MEMERR = 2 /* error allocating memory */ -}; #define MAX_BLOCK_SIZE 256 /* max. block size */ @@ -55,6 +64,9 @@ enum class GIFImage { public: + // def ctor + GIFImage(); + unsigned int w; /* width */ unsigned int h; /* height */ unsigned int left; /* x coord (in logical screen) */ @@ -66,6 +78,8 @@ public: unsigned char *pal; /* palette */ GIFImage *next; /* next image */ GIFImage *prev; /* prev image */ + + DECLARE_NO_COPY_CLASS(GIFImage) }; @@ -99,7 +113,7 @@ private: int getcode(int bits, int abfin); int dgif(GIFImage *img, int interl, int bits); -protected: +public: // get data of current frame int GetFrameIndex() const; unsigned char* GetData() const; @@ -122,13 +136,13 @@ protected: // move through the animation bool GoFirstFrame(); bool GoLastFrame(); - bool GoNextFrame(bool cyclic = FALSE); - bool GoPrevFrame(bool cyclic = FALSE); + bool GoNextFrame(bool cyclic = false); + bool GoPrevFrame(bool cyclic = false); bool GoFrame(int which); public: // constructor, destructor, etc. - wxGIFDecoder(wxInputStream *s, bool anim = FALSE); + wxGIFDecoder(wxInputStream *s, bool anim = false); ~wxGIFDecoder(); bool CanRead(); int ReadGIF(); @@ -136,6 +150,8 @@ public: // convert current frame to wxImage bool ConvertToImage(wxImage *image) const; + + DECLARE_NO_COPY_CLASS(wxGIFDecoder) };