]>
Commit | Line | Data |
---|---|---|
72045d57 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/anidecod.h | |
3 | // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation | |
4 | // Author: Francesco Montorsi | |
72045d57 VZ |
5 | // Copyright: (c) 2006 Francesco Montorsi |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef _WX_ANIDECOD_H | |
10 | #define _WX_ANIDECOD_H | |
11 | ||
12 | #include "wx/defs.h" | |
13 | ||
77b83d0a | 14 | #if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) |
72045d57 VZ |
15 | |
16 | #include "wx/stream.h" | |
17 | #include "wx/image.h" | |
18 | #include "wx/animdecod.h" | |
7e0bac9d | 19 | #include "wx/dynarray.h" |
72045d57 VZ |
20 | |
21 | ||
53a2db12 | 22 | class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail |
72045d57 | 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 | ||
53a2db12 | 31 | class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder |
72045d57 | 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 | |
03647350 | 46 | |
72045d57 VZ |
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: | |
8faef7cc FM |
57 | // wxAnimationDecoder pure virtual: |
58 | virtual bool DoCanRead( wxInputStream& stream ) const; | |
59 | // modifies current stream position (see wxAnimationDecoder::CanRead) | |
03647350 | 60 | |
870cf35c VZ |
61 | // frames stored as wxImage(s): ANI files are meant to be used mostly for animated |
62 | // cursors and thus they do not use any optimization to encode differences between | |
63 | // two frames: they are just a list of images to display sequentially. | |
64 | wxImageArray m_images; | |
65 | ||
66 | // the info about each image stored in m_images. | |
67 | // NB: m_info.GetCount() may differ from m_images.GetCount()! | |
68 | wxANIFrameInfoArray m_info; | |
69 | ||
70 | // this is the wxCURHandler used to load the ICON chunk of the ANI files | |
71 | static wxCURHandler sm_handler; | |
72 | ||
73 | ||
c0c133e1 | 74 | wxDECLARE_NO_COPY_CLASS(wxANIDecoder); |
72045d57 VZ |
75 | }; |
76 | ||
77 | ||
77b83d0a | 78 | #endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) |
72045d57 | 79 | |
d18868bb | 80 | #endif // _WX_ANIDECOD_H |