]> git.saurik.com Git - wxWidgets.git/blame - include/wx/imaggif.h
doing WakeUp in osx_carbon differently for the main event as well
[wxWidgets.git] / include / wx / imaggif.h
CommitLineData
8f493002 1/////////////////////////////////////////////////////////////////////////////
85fcb94f 2// Name: wx/imaggif.h
8f493002 3// Purpose: wxImage GIF handler
77b83d0a 4// Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K
8f493002 5// RCS-ID: $Id$
77b83d0a 6// Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K
65571936 7// Licence: wxWindows licence
8f493002
VS
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_IMAGGIF_H_
11#define _WX_IMAGGIF_H_
12
8f493002
VS
13#include "wx/image.h"
14
15
16//-----------------------------------------------------------------------------
17// wxGIFHandler
18//-----------------------------------------------------------------------------
19
20#if wxUSE_GIF
21
491da411
DS
22#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment")
23
77b83d0a
DS
24struct wxRGB;
25struct GifHashTableType;
26class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h
27
53a2db12 28class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler
8f493002 29{
8f493002 30public:
2b5f62a0
VZ
31 inline wxGIFHandler()
32 {
33 m_name = wxT("GIF file");
34 m_extension = wxT("gif");
35 m_type = wxBITMAP_TYPE_GIF;
36 m_mime = wxT("image/gif");
77b83d0a 37 m_hashTable = NULL;
2b5f62a0 38 }
8f493002
VS
39
40#if wxUSE_STREAMS
85fcb94f
VZ
41 virtual bool LoadFile(wxImage *image, wxInputStream& stream,
42 bool verbose = true, int index = -1);
43 virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
44 bool verbose=true);
8faef7cc 45
77b83d0a
DS
46 // Save animated gif
47 bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream,
491da411 48 bool verbose = true, int delayMilliSecs = 1000);
77b83d0a 49
6f02a879 50protected:
8faef7cc 51 virtual int DoGetImageCount(wxInputStream& stream);
85fcb94f 52 virtual bool DoCanRead(wxInputStream& stream);
77b83d0a
DS
53
54 bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose,
55 bool first, int delayMilliSecs, bool loop,
56 const wxRGB *pal, int palCount,
491da411 57 int mask_index);
85fcb94f 58#endif // wxUSE_STREAMS
77b83d0a
DS
59protected:
60
61 // Declarations for saving
2b5f62a0 62
77b83d0a
DS
63 unsigned long m_crntShiftDWord; /* For bytes decomposition into codes. */
64 int m_pixelCount;
65 struct GifHashTableType *m_hashTable;
66 wxInt16
67 m_EOFCode, /* The EOF LZ code. */
68 m_clearCode, /* The CLEAR LZ code. */
69 m_runningCode, /* The next code algorithm can generate. */
70 m_runningBits, /* The number of bits required to represent RunningCode. */
71 m_maxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */
72 m_crntCode, /* Current algorithm code. */
73 m_crntShiftState; /* Number of bits in CrntShiftDWord. */
74 wxUint8 m_LZBuf[256]; /* Compressed input is buffered here. */
75
76 bool InitHashTable();
77 void ClearHashTable();
78 void InsertHashTable(unsigned long key, int code);
79 int ExistsHashTable(unsigned long key);
80
81#if wxUSE_STREAMS
82 bool CompressOutput(wxOutputStream *, int code);
83 bool SetupCompress(wxOutputStream *, int bpp);
84 bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen);
85#endif
491da411 86
2b5f62a0
VZ
87private:
88 DECLARE_DYNAMIC_CLASS(wxGIFHandler)
8f493002 89};
8f493002 90
85fcb94f 91#endif // wxUSE_GIF
8f493002 92
85fcb94f 93#endif // _WX_IMAGGIF_H_
8f493002 94