2006-10-09 17:51:07 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/anidecod.h
|
|
|
|
// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
|
|
|
|
// Author: Francesco Montorsi
|
|
|
|
// Copyright: (c) 2006 Francesco Montorsi
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_ANIDECOD_H
|
|
|
|
#define _WX_ANIDECOD_H
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2011-01-19 12:28:31 +00:00
|
|
|
#if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
#include "wx/stream.h"
|
|
|
|
#include "wx/image.h"
|
|
|
|
#include "wx/animdecod.h"
|
2007-04-21 18:13:48 +00:00
|
|
|
#include "wx/dynarray.h"
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-10-10 17:35:49 +00:00
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
|
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
|
2006-10-09 17:51:07 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxANIDecoder class
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder
|
2006-10-09 17:51:07 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor, destructor, etc.
|
|
|
|
wxANIDecoder();
|
|
|
|
~wxANIDecoder();
|
|
|
|
|
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE;
|
|
|
|
virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE;
|
|
|
|
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE;
|
|
|
|
virtual long GetDelay(unsigned int frame) const wxOVERRIDE;
|
|
|
|
virtual wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE;
|
2006-12-10 14:18:37 +00:00
|
|
|
|
|
|
|
// implementation of wxAnimationDecoder's pure virtuals
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool Load( wxInputStream& stream ) wxOVERRIDE;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE;
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
wxAnimationDecoder *Clone() const wxOVERRIDE
|
2006-10-09 17:51:07 +00:00
|
|
|
{ return new wxANIDecoder; }
|
2014-03-30 00:02:23 +00:00
|
|
|
wxAnimationType GetType() const wxOVERRIDE
|
2006-10-09 17:51:07 +00:00
|
|
|
{ return wxANIMATION_TYPE_ANI; }
|
|
|
|
|
|
|
|
private:
|
2009-06-01 11:43:36 +00:00
|
|
|
// wxAnimationDecoder pure virtual:
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE;
|
2009-06-01 11:43:36 +00:00
|
|
|
// modifies current stream position (see wxAnimationDecoder::CanRead)
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2006-12-10 14:18:37 +00:00
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxANIDecoder);
|
2006-10-09 17:51:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-19 12:28:31 +00:00
|
|
|
#endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF)
|
2006-10-09 17:51:07 +00:00
|
|
|
|
2006-10-10 08:16:34 +00:00
|
|
|
#endif // _WX_ANIDECOD_H
|