1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
4 // Author: Francesco Montorsi
6 // Copyright: (c) 2006 Francesco Montorsi
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_ANIDECOD_H
11 #define _WX_ANIDECOD_H
15 #if wxUSE_STREAMS && wxUSE_ICO_CUR
17 #include "wx/stream.h"
19 #include "wx/animdecod.h"
20 #include "wx/dynarray.h"
23 class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo
; // private implementation detail
25 WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo
, wxANIFrameInfoArray
);
26 WX_DECLARE_EXPORTED_OBJARRAY(wxImage
, wxImageArray
);
28 // --------------------------------------------------------------------------
30 // --------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxANIDecoder
: public wxAnimationDecoder
35 // constructor, destructor, etc.
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;
46 // implementation of wxAnimationDecoder's pure virtuals
47 virtual bool CanRead( wxInputStream
& stream
) const;
48 virtual bool Load( wxInputStream
& stream
);
50 bool ConvertToImage(unsigned int frame
, wxImage
*image
) const;
52 wxAnimationDecoder
*Clone() const
53 { return new wxANIDecoder
; }
54 wxAnimationType
GetType() const
55 { return wxANIMATION_TYPE_ANI
; }
58 // frames stored as wxImage(s): ANI files are meant to be used mostly for animated
59 // cursors and thus they do not use any optimization to encode differences between
60 // two frames: they are just a list of images to display sequentially.
61 wxImageArray m_images
;
63 // the info about each image stored in m_images.
64 // NB: m_info.GetCount() may differ from m_images.GetCount()!
65 wxANIFrameInfoArray m_info
;
67 // this is the wxCURHandler used to load the ICON chunk of the ANI files
68 static wxCURHandler sm_handler
;
71 wxDECLARE_NO_COPY_CLASS(wxANIDecoder
);
75 #endif // wxUSE_STREAMS && wxUSE_ICO_CUR
77 #endif // _WX_ANIDECOD_H