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"
22 class /*WXDLLEXPORT*/ wxANIFrameInfo
;
24 WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo
, wxANIFrameInfoArray
);
25 WX_DECLARE_EXPORTED_OBJARRAY(wxImage
, wxImageArray
);
27 // --------------------------------------------------------------------------
29 // --------------------------------------------------------------------------
31 class WXDLLEXPORT wxANIDecoder
: public wxAnimationDecoder
35 // frames stored as wxImage(s): ANI files are meant to be used mostly for animated
36 // cursors and thus they do not use any optimization to encode differences between
37 // two frames: they are just a list of images to display sequentially.
38 wxImageArray m_images
;
40 // the info about each image stored in m_images.
41 // NB: m_info.GetCount() may differ from m_images.GetCount()!
42 wxANIFrameInfoArray m_info
;
44 // this is the wxCURHandler used to load the ICON chunk of the ANI files
45 static wxCURHandler sm_handler
;
48 virtual wxSize
GetFrameSize(size_t frame
) const;
49 virtual wxPoint
GetFramePosition(size_t frame
) const;
50 virtual wxAnimationDisposal
GetDisposalMethod(size_t frame
) const;
51 virtual long GetDelay(size_t frame
) const;
52 virtual wxColour
GetTransparentColour(size_t frame
) const;
55 // constructor, destructor, etc.
59 public: // implementation of wxAnimationDecoder's pure virtuals
61 virtual bool CanRead( wxInputStream
& stream
) const;
62 virtual bool Load( wxInputStream
& stream
);
64 bool ConvertToImage(size_t frame
, wxImage
*image
) const;
66 wxAnimationDecoder
*Clone() const
67 { return new wxANIDecoder
; }
68 wxAnimationType
GetType() const
69 { return wxANIMATION_TYPE_ANI
; }
72 DECLARE_NO_COPY_CLASS(wxANIDecoder
)
76 #endif // wxUSE_STREAM && wxUSE_ICO_CUR
78 #endif // _WX_ANIDECOD_H