2006-10-09 13:51:07 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/anidecod.h
|
|
|
|
// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
|
|
|
|
// Author: Francesco Montorsi
|
|
|
|
// CVS-ID: $Id$
|
|
|
|
// Copyright: (c) 2006 Francesco Montorsi
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_ANIDECOD_H
|
|
|
|
#define _WX_ANIDECOD_H
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2006-10-10 04:16:34 -04:00
|
|
|
#if wxUSE_STREAMS && wxUSE_ICO_CUR
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
#include "wx/stream.h"
|
|
|
|
#include "wx/image.h"
|
|
|
|
#include "wx/animdecod.h"
|
|
|
|
|
|
|
|
|
|
|
|
class /*WXDLLEXPORT*/ wxANIFrameInfo;
|
|
|
|
|
2006-10-10 13:35:49 -04:00
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
|
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxANIDecoder class
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
// frames stored as wxImage(s): ANI files are meant to be used mostly for animated
|
|
|
|
// cursors and thus they do not use any optimization to encode differences between
|
|
|
|
// two frames: they are just a list of images to display sequentially.
|
|
|
|
wxImageArray m_images;
|
|
|
|
|
|
|
|
// the info about each image stored in m_images.
|
|
|
|
// NB: m_info.GetCount() may differ from m_images.GetCount()!
|
|
|
|
wxANIFrameInfoArray m_info;
|
|
|
|
|
|
|
|
// this is the wxCURHandler used to load the ICON chunk of the ANI files
|
|
|
|
static wxCURHandler sm_handler;
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual wxSize GetFrameSize(size_t frame) const;
|
|
|
|
virtual wxPoint GetFramePosition(size_t frame) const;
|
|
|
|
virtual wxAnimationDisposal GetDisposalMethod(size_t frame) const;
|
|
|
|
virtual long GetDelay(size_t frame) const;
|
2006-10-11 12:09:39 -04:00
|
|
|
virtual wxColour GetTransparentColour(size_t frame) const;
|
2006-10-09 13:51:07 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
// constructor, destructor, etc.
|
|
|
|
wxANIDecoder();
|
|
|
|
~wxANIDecoder();
|
|
|
|
|
|
|
|
public: // implementation of wxAnimationDecoder's pure virtuals
|
|
|
|
|
|
|
|
virtual bool CanRead( wxInputStream& stream ) const;
|
|
|
|
virtual bool Load( wxInputStream& stream );
|
|
|
|
|
|
|
|
bool ConvertToImage(size_t frame, wxImage *image) const;
|
|
|
|
|
|
|
|
wxAnimationDecoder *Clone() const
|
|
|
|
{ return new wxANIDecoder; }
|
|
|
|
wxAnimationType GetType() const
|
|
|
|
{ return wxANIMATION_TYPE_ANI; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_NO_COPY_CLASS(wxANIDecoder)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-10-10 04:16:34 -04:00
|
|
|
#endif // wxUSE_STREAM && wxUSE_ICO_CUR
|
2006-10-09 13:51:07 -04:00
|
|
|
|
2006-10-10 04:16:34 -04:00
|
|
|
#endif // _WX_ANIDECOD_H
|