]>
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 | ||
d18868bb | 15 | #if wxUSE_STREAMS && wxUSE_ICO_CUR |
72045d57 VZ |
16 | |
17 | #include "wx/stream.h" | |
18 | #include "wx/image.h" | |
19 | #include "wx/animdecod.h" | |
20 | ||
21 | ||
22 | class /*WXDLLEXPORT*/ wxANIFrameInfo; | |
23 | ||
e07c1146 PC |
24 | WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); |
25 | WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); | |
72045d57 VZ |
26 | |
27 | // -------------------------------------------------------------------------- | |
28 | // wxANIDecoder class | |
29 | // -------------------------------------------------------------------------- | |
30 | ||
31 | class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder | |
32 | { | |
72045d57 VZ |
33 | public: |
34 | // constructor, destructor, etc. | |
35 | wxANIDecoder(); | |
36 | ~wxANIDecoder(); | |
37 | ||
72045d57 | 38 | |
870cf35c VZ |
39 | virtual wxSize GetFrameSize(unsigned int frame) const; |
40 | virtual wxPoint GetFramePosition(unsigned int frame) const; | |
41 | virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; | |
42 | virtual long GetDelay(unsigned int frame) const; | |
43 | virtual wxColour GetTransparentColour(unsigned int frame) const; | |
44 | ||
45 | // implementation of wxAnimationDecoder's pure virtuals | |
72045d57 VZ |
46 | virtual bool CanRead( wxInputStream& stream ) const; |
47 | virtual bool Load( wxInputStream& stream ); | |
48 | ||
870cf35c | 49 | bool ConvertToImage(unsigned int frame, wxImage *image) const; |
72045d57 VZ |
50 | |
51 | wxAnimationDecoder *Clone() const | |
52 | { return new wxANIDecoder; } | |
53 | wxAnimationType GetType() const | |
54 | { return wxANIMATION_TYPE_ANI; } | |
55 | ||
56 | private: | |
870cf35c VZ |
57 | // frames stored as wxImage(s): ANI files are meant to be used mostly for animated |
58 | // cursors and thus they do not use any optimization to encode differences between | |
59 | // two frames: they are just a list of images to display sequentially. | |
60 | wxImageArray m_images; | |
61 | ||
62 | // the info about each image stored in m_images. | |
63 | // NB: m_info.GetCount() may differ from m_images.GetCount()! | |
64 | wxANIFrameInfoArray m_info; | |
65 | ||
66 | // this is the wxCURHandler used to load the ICON chunk of the ANI files | |
67 | static wxCURHandler sm_handler; | |
68 | ||
69 | ||
72045d57 VZ |
70 | DECLARE_NO_COPY_CLASS(wxANIDecoder) |
71 | }; | |
72 | ||
73 | ||
d18868bb | 74 | #endif // wxUSE_STREAM && wxUSE_ICO_CUR |
72045d57 | 75 | |
d18868bb | 76 | #endif // _WX_ANIDECOD_H |