X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85fcb94fc99880e8fdb127ea1fc6cb0aefa6986d..05f4dfa7268b60d2f56a685933c49f3d3d4be745:/include/wx/imaggif.h?ds=sidebyside diff --git a/include/wx/imaggif.h b/include/wx/imaggif.h index 7912cf956f..0f30653699 100644 --- a/include/wx/imaggif.h +++ b/include/wx/imaggif.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/imaggif.h // Purpose: wxImage GIF handler -// Author: Vaclav Slavik & Guillermo Rodriguez Garcia +// Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K // RCS-ID: $Id$ -// Copyright: (c) Guillermo Rodriguez Garcia +// Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,6 +19,12 @@ #if wxUSE_GIF +#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment") + +struct wxRGB; +struct GifHashTableType; +class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h + class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler { public: @@ -28,6 +34,7 @@ public: m_extension = wxT("gif"); m_type = wxBITMAP_TYPE_GIF; m_mime = wxT("image/gif"); + m_hashTable = NULL; } #if wxUSE_STREAMS @@ -35,10 +42,47 @@ public: bool verbose = true, int index = -1); virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); - virtual int GetImageCount(wxInputStream& stream); + + // Save animated gif + bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, + bool verbose = true, int delayMilliSecs = 1000); + protected: + virtual int DoGetImageCount(wxInputStream& stream); virtual bool DoCanRead(wxInputStream& stream); + + bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, + bool first, int delayMilliSecs, bool loop, + const wxRGB *pal, int palCount, + int mask_index); #endif // wxUSE_STREAMS +protected: + + // Declarations for saving + + unsigned long m_crntShiftDWord; /* For bytes decomposition into codes. */ + int m_pixelCount; + struct GifHashTableType *m_hashTable; + wxInt16 + m_EOFCode, /* The EOF LZ code. */ + m_clearCode, /* The CLEAR LZ code. */ + m_runningCode, /* The next code algorithm can generate. */ + m_runningBits, /* The number of bits required to represent RunningCode. */ + m_maxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ + m_crntCode, /* Current algorithm code. */ + m_crntShiftState; /* Number of bits in CrntShiftDWord. */ + wxUint8 m_LZBuf[256]; /* Compressed input is buffered here. */ + + bool InitHashTable(); + void ClearHashTable(); + void InsertHashTable(unsigned long key, int code); + int ExistsHashTable(unsigned long key); + +#if wxUSE_STREAMS + bool CompressOutput(wxOutputStream *, int code); + bool SetupCompress(wxOutputStream *, int bpp); + bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen); +#endif private: DECLARE_DYNAMIC_CLASS(wxGIFHandler)