]>
Commit | Line | Data |
---|---|---|
72045d57 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/anidecod.h | |
3 | // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation | |
4 | // Author: Francesco Montorsi | |
5 | // CVS-ID: $Id$ | |
6 | // Copyright: (c) 2006 Francesco Montorsi | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_ANIDECOD_H | |
11 | #define _WX_ANIDECOD_H | |
12 | ||
13 | #include "wx/defs.h" | |
14 | ||
77b83d0a | 15 | #if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) |
72045d57 VZ |
16 | |
17 | #include "wx/stream.h" | |
18 | #include "wx/image.h" | |
19 | #include "wx/animdecod.h" | |
7e0bac9d | 20 | #include "wx/dynarray.h" |
72045d57 VZ |
21 | |
22 | ||
53a2db12 | 23 | class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail |
72045d57 | 24 | |
e07c1146 PC |
25 | WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); |
26 | WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); | |
72045d57 VZ |
27 | |
28 | // -------------------------------------------------------------------------- | |
29 | // wxANIDecoder class | |
30 | // -------------------------------------------------------------------------- | |
31 | ||
53a2db12 | 32 | class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder |
72045d57 | 33 | { |
72045d57 VZ |
34 | public: |
35 | // constructor, destructor, etc. | |
36 | wxANIDecoder(); | |
37 | ~wxANIDecoder(); | |
38 | ||
72045d57 | 39 | |
870cf35c VZ |
40 | virtual wxSize GetFrameSize(unsigned int frame) const; |
41 | virtual wxPoint GetFramePosition(unsigned int frame) const; | |
42 | virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; | |
43 | virtual long GetDelay(unsigned int frame) const; | |
44 | virtual wxColour GetTransparentColour(unsigned int frame) const; | |
45 | ||
46 | // implementation of wxAnimationDecoder's pure virtuals | |
03647350 | 47 | |
72045d57 VZ |
48 | virtual bool Load( wxInputStream& stream ); |
49 | ||
870cf35c | 50 | bool ConvertToImage(unsigned int frame, wxImage *image) const; |
72045d57 VZ |
51 | |
52 | wxAnimationDecoder *Clone() const | |
53 | { return new wxANIDecoder; } | |
54 | wxAnimationType GetType() const | |
55 | { return wxANIMATION_TYPE_ANI; } | |
56 | ||
57 | private: | |
8faef7cc FM |
58 | // wxAnimationDecoder pure virtual: |
59 | virtual bool DoCanRead( wxInputStream& stream ) const; | |
60 | // modifies current stream position (see wxAnimationDecoder::CanRead) | |
03647350 | 61 | |
870cf35c VZ |
62 | // frames stored as wxImage(s): ANI files are meant to be used mostly for animated |
63 | // cursors and thus they do not use any optimization to encode differences between | |
64 | // two frames: they are just a list of images to display sequentially. | |
65 | wxImageArray m_images; | |
66 | ||
67 | // the info about each image stored in m_images. | |
68 | // NB: m_info.GetCount() may differ from m_images.GetCount()! | |
69 | wxANIFrameInfoArray m_info; | |
70 | ||
71 | // this is the wxCURHandler used to load the ICON chunk of the ANI files | |
72 | static wxCURHandler sm_handler; | |
73 | ||
74 | ||
c0c133e1 | 75 | wxDECLARE_NO_COPY_CLASS(wxANIDecoder); |
72045d57 VZ |
76 | }; |
77 | ||
78 | ||
77b83d0a | 79 | #endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) |
72045d57 | 80 | |
d18868bb | 81 | #endif // _WX_ANIDECOD_H |