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