applied ANI images patch and added wxUSE_ICO_CUR

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2002-01-13 12:01:42 +00:00
parent fafcf1271d
commit 658974ae66
16 changed files with 992 additions and 696 deletions

1422
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -814,6 +814,7 @@ if test $DEBUG_CONFIGURE = 1; then
DEFAULT_wxUSE_PCX=no DEFAULT_wxUSE_PCX=no
DEFAULT_wxUSE_PNM=no DEFAULT_wxUSE_PNM=no
DEFAULT_wxUSE_XPM=no DEFAULT_wxUSE_XPM=no
DEFAULT_wxUSE_ICO_CUR=no
else else
DEFAULT_wxUSE_UNIVERSAL=no DEFAULT_wxUSE_UNIVERSAL=no
@@ -984,6 +985,7 @@ else
DEFAULT_wxUSE_PCX=yes DEFAULT_wxUSE_PCX=yes
DEFAULT_wxUSE_PNM=yes DEFAULT_wxUSE_PNM=yes
DEFAULT_wxUSE_XPM=yes DEFAULT_wxUSE_XPM=yes
DEFAULT_wxUSE_ICO_CUR=yes
fi fi
dnl WX_ARG_WITH should be used to select whether an external package will be dnl WX_ARG_WITH should be used to select whether an external package will be
@@ -1358,6 +1360,7 @@ WX_ARG_ENABLE(gif, [ --enable-gif use gif images (GIF file f
WX_ARG_ENABLE(pcx, [ --enable-pcx use pcx images (PCX file format)], wxUSE_PCX) WX_ARG_ENABLE(pcx, [ --enable-pcx use pcx images (PCX file format)], wxUSE_PCX)
WX_ARG_ENABLE(pnm, [ --enable-pnm use pnm images (PNM file format)], wxUSE_PNM) WX_ARG_ENABLE(pnm, [ --enable-pnm use pnm images (PNM file format)], wxUSE_PNM)
WX_ARG_ENABLE(xpm, [ --enable-xpm use xpm images (XPM file format)], wxUSE_XPM) WX_ARG_ENABLE(xpm, [ --enable-xpm use xpm images (XPM file format)], wxUSE_XPM)
WX_ARG_ENABLE(ico_cur, [ --enable-icocur use Windows ICO and CUR formats], wxUSE_ICO_CUR)
fi fi
dnl for GUI only dnl for GUI only
@@ -4717,6 +4720,10 @@ if test "$wxUSE_XPM" = "yes" ; then
AC_DEFINE(wxUSE_XPM) AC_DEFINE(wxUSE_XPM)
fi fi
if test "$wxUSE_ICO_CUR" = "yes" ; then
AC_DEFINE(wxUSE_ICO_CUR)
fi
if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_MSLU" = "yes" ; then if test "$wxUSE_UNICODE" = "yes" -a "$wxUSE_UNICODE_MSLU" = "yes" ; then
dnl Must be done this late because -lunicows must be before all the other libs dnl Must be done this late because -lunicows must be before all the other libs
LIBS=" -lunicows $LIBS" LIBS=" -lunicows $LIBS"

View File

@@ -34,6 +34,7 @@ handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
\twocolitem{\indexit{wxXPMHandler}}{For loading and saving.} \twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
\twocolitem{\indexit{wxICOHandler}}{For loading and saving.} \twocolitem{\indexit{wxICOHandler}}{For loading and saving.}
\twocolitem{\indexit{wxCURHandler}}{For loading and saving.} \twocolitem{\indexit{wxCURHandler}}{For loading and saving.}
\twocolitem{\indexit{wxANIHandler}}{For loading and saving.}
\end{twocollist} \end{twocollist}
When saving in PCX format, {\bf wxPCXHandler} will count the number of When saving in PCX format, {\bf wxPCXHandler} will count the number of
@@ -122,6 +123,7 @@ Loads an image from an input stream.
\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.} \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}} \end{twocollist}}
@@ -352,6 +354,7 @@ available images.
\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.} \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}} \end{twocollist}}
@@ -534,6 +537,7 @@ Loads an image from an input stream.
\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.} \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
\twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
\twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} \twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}} \end{twocollist}}

View File

@@ -348,6 +348,14 @@
# endif # endif
#endif /* !defined(wxUSE_HTML) */ #endif /* !defined(wxUSE_HTML) */
#ifndef wxUSE_ICO_CUR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ICO_CUR must be defined."
# else
# define wxUSE_ICO_CUR 0
# endif
#endif /* !defined(wxUSE_ICO_CUR) */
#ifndef wxUSE_IMAGLIST #ifndef wxUSE_IMAGLIST
# ifdef wxABORT_ON_CONFIG_ERROR # ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_IMAGLIST must be defined." # error "wxUSE_IMAGLIST must be defined."

View File

@@ -78,6 +78,7 @@ enum wxBitmapType
wxBITMAP_TYPE_PICT_RESOURCE, wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON, wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE, wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_ANI,
wxBITMAP_TYPE_MACCURSOR, wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE, wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50 wxBITMAP_TYPE_ANY = 50

View File

@@ -113,6 +113,10 @@
/* /*
* Use iODBC * Use iODBC
*/ */
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
#define wxUSE_ODBC 0 #define wxUSE_ODBC 0
#define wxODBC_FWD_ONLY_CURSORS 1 #define wxODBC_FWD_ONLY_CURSORS 1
/* /*

View File

@@ -113,6 +113,10 @@
/* /*
* Use iODBC * Use iODBC
*/ */
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
#define wxUSE_ODBC 0 #define wxUSE_ODBC 0
#define wxODBC_FWD_ONLY_CURSORS 1 #define wxODBC_FWD_ONLY_CURSORS 1
/* /*

View File

@@ -67,7 +67,7 @@ private:
DECLARE_DYNAMIC_CLASS(wxBMPHandler) DECLARE_DYNAMIC_CLASS(wxBMPHandler)
}; };
#if wxUSE_ICO_CUR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxICOHandler // wxICOHandler
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -85,7 +85,8 @@ public:
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS
@@ -126,5 +127,32 @@ public:
private: private:
DECLARE_DYNAMIC_CLASS(wxCURHandler) DECLARE_DYNAMIC_CLASS(wxCURHandler)
}; };
// ----------------------------------------------------------------------------
// wxANIHandler
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxANIHandler : public wxCURHandler
{
public:
wxANIHandler()
{
m_name = _T("Windows animated cursor file");
m_extension = _T("ani");
m_type = wxBITMAP_TYPE_ANI;
m_mime = _T("image/x-ani");
};
#if wxUSE_STREAMS
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ) {return FALSE ;};
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream );
#endif // wxUSE_STREAMS
private:
DECLARE_DYNAMIC_CLASS(wxANIHandler)
};
#endif // wxUSE_ICO_CUR
#endif // _WX_IMAGBMP_H_ #endif // _WX_IMAGBMP_H_

View File

@@ -869,6 +869,9 @@
// Set to 1 for XPM format support // Set to 1 for XPM format support
#define wxUSE_XPM 1 #define wxUSE_XPM 1
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
// Set to 1 to compile in wxPalette class // Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1 #define wxUSE_PALETTE 1

View File

@@ -73,6 +73,10 @@
* Use PNM * Use PNM
*/ */
#define wxUSE_PNM 1 #define wxUSE_PNM 1
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
/* /*
* Use iODBC * Use iODBC
*/ */

View File

@@ -934,6 +934,9 @@
// Set to 1 for XPM format support // Set to 1 for XPM format support
#define wxUSE_XPM 1 #define wxUSE_XPM 1
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
// Set to 1 to compile in wxPalette class // Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1 #define wxUSE_PALETTE 1

View File

@@ -921,6 +921,9 @@
// Set to 1 for XPM format support // Set to 1 for XPM format support
#define wxUSE_XPM 1 #define wxUSE_XPM 1
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_ICO_CUR 1
// Set to 1 to compile in wxPalette class // Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1 #define wxUSE_PALETTE 1

View File

@@ -250,6 +250,10 @@
#define wxUSE_XPM 1 #define wxUSE_XPM 1
// Set to 1 for XPM format support // Set to 1 for XPM format support
#define wxUSE_ICO_CUR 1
// Set to 1 for MS Icons and Cursors format support
#define wxUSE_SERIAL 1 #define wxUSE_SERIAL 1
// Use serialization (requires utils/serialize) // Use serialization (requires utils/serialize)
#define wxUSE_TOOLTIPS 1 #define wxUSE_TOOLTIPS 1

View File

@@ -179,6 +179,9 @@
#define wxUSE_GIF 0 #define wxUSE_GIF 0
#define wxUSE_PNM 0 #define wxUSE_PNM 0
#define wxUSE_PCX 0 #define wxUSE_PCX 0
#define wxUSE_ICO_CUR 1
#define wxUSE_MFC 0 #define wxUSE_MFC 0
#define wxUSE_OLE 0 #define wxUSE_OLE 0
#define wxUSE_CTL3D 0 #define wxUSE_CTL3D 0
@@ -333,6 +336,9 @@
#define wxUSE_GIF 0 #define wxUSE_GIF 0
#define wxUSE_PNM 0 #define wxUSE_PNM 0
#define wxUSE_PCX 0 #define wxUSE_PCX 0
#define wxUSE_ICO_CUR 1
#define wxUSE_MFC 0 #define wxUSE_MFC 0
#define wxUSE_OLE 0 #define wxUSE_OLE 0
#define wxUSE_CTL3D 0 #define wxUSE_CTL3D 0
@@ -494,6 +500,9 @@
#define wxUSE_GIF 0 #define wxUSE_GIF 0
#define wxUSE_PNM 0 #define wxUSE_PNM 0
#define wxUSE_PCX 0 #define wxUSE_PCX 0
#define wxUSE_ICO_CUR 1
#define wxUSE_MFC 0 #define wxUSE_MFC 0
#define wxUSE_OLE 0 #define wxUSE_OLE 0
#define wxUSE_CTL3D 0 #define wxUSE_CTL3D 0

View File

@@ -55,8 +55,11 @@ void wxInitAllImageHandlers()
#if wxUSE_XPM #if wxUSE_XPM
wxImage::AddHandler( new wxXPMHandler ); wxImage::AddHandler( new wxXPMHandler );
#endif #endif
#if wxUSE_ICO_CUR
wxImage::AddHandler( new wxICOHandler ); wxImage::AddHandler( new wxICOHandler );
wxImage::AddHandler( new wxCURHandler ); wxImage::AddHandler( new wxCURHandler );
wxImage::AddHandler( new wxANIHandler );
#endif
} }
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE

View File

@@ -882,7 +882,7 @@ bool wxBMPHandler::DoCanRead(wxInputStream& stream)
} }
#if wxUSE_ICO_CUR
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxICOHandler // wxICOHandler
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1108,12 +1108,20 @@ bool wxICOHandler::SaveFile(wxImage *image,
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index) bool verbose, int index)
{
stream.SeekI(0);
return DoLoadFile(image, stream, verbose, index);
}
bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index)
{ {
bool bResult = FALSE; bool bResult = FALSE;
bool IsBmp = FALSE; bool IsBmp = FALSE;
ICONDIR IconDir; ICONDIR IconDir;
stream.SeekI(0);
off_t iPos = stream.TellI();
stream.Read(&IconDir, sizeof(IconDir)); stream.Read(&IconDir, sizeof(IconDir));
wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount); wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount);
// nType is 1 for Icons, 2 for Cursors: // nType is 1 for Icons, 2 for Cursors:
@@ -1161,9 +1169,10 @@ bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
{ {
// seek to selected icon: // seek to selected icon:
pCurrentEntry = pIconDirEntry + iSel; pCurrentEntry = pIconDirEntry + iSel;
stream.SeekI(wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart); stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart);
bResult = LoadDib(image, stream, TRUE, IsBmp); bResult = LoadDib(image, stream, TRUE, IsBmp);
if ( bResult && this->GetType() == wxBITMAP_TYPE_CUR && nType == 2 ) bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI);
if ( bResult && bIsCursorType && nType == 2 )
{ {
// it is a cursor, so let's set the hotspot: // it is a cursor, so let's set the hotspot:
image->SetOption(wxCUR_HOTSPOT_X, wxUINT16_SWAP_ON_BE(pCurrentEntry->wPlanes)); image->SetOption(wxCUR_HOTSPOT_X, wxUINT16_SWAP_ON_BE(pCurrentEntry->wPlanes));
@@ -1177,19 +1186,21 @@ bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
int wxICOHandler::GetImageCount(wxInputStream& stream) int wxICOHandler::GetImageCount(wxInputStream& stream)
{ {
ICONDIR IconDir; ICONDIR IconDir;
off_t iPos = stream.TellI();
stream.SeekI(0); stream.SeekI(0);
stream.Read(&IconDir, sizeof(IconDir)); stream.Read(&IconDir, sizeof(IconDir));
wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount); wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount);
stream.SeekI(iPos);
return (int)nIcons; return (int)nIcons;
} }
bool wxICOHandler::DoCanRead(wxInputStream& stream) bool wxICOHandler::DoCanRead(wxInputStream& stream)
{ {
unsigned char hdr[4]; unsigned char hdr[4];
off_t iPos = stream.TellI();
stream.SeekI (0); stream.SeekI (0);
stream.Read(hdr, 4); stream.Read(hdr, 4);
stream.SeekI(-4, wxFromCurrent); stream.SeekI(iPos);
//hdr[2] is one for an icon and two for a cursor //hdr[2] is one for an icon and two for a cursor
return (hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0'); return (hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0');
} }
@@ -1205,12 +1216,162 @@ IMPLEMENT_DYNAMIC_CLASS(wxCURHandler, wxICOHandler)
bool wxCURHandler::DoCanRead(wxInputStream& stream) bool wxCURHandler::DoCanRead(wxInputStream& stream)
{ {
unsigned char hdr[4]; unsigned char hdr[4];
off_t iPos = stream.TellI();
stream.SeekI (0); stream.SeekI (0);
stream.Read(hdr, 4); stream.Read(hdr, 4);
stream.SeekI(-4, wxFromCurrent); stream.SeekI(iPos);
//hdr[2] is one for an icon and two for a cursor //hdr[2] is one for an icon and two for a cursor
return (hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0'); return (hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0');
} }
//-----------------------------------------------------------------------------
// wxANIHandler
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler)
bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index)
{
wxInt32 FCC1, FCC2;
wxUint32 datalen;
static const char *rifftxt = "RIFF";
static const char *listtxt = "LIST";
static const char *icotxt = "icon";
wxInt32 *riff32 = (wxInt32 *) rifftxt;
wxInt32 *list32 = (wxInt32 *) listtxt;
wxInt32 *ico32 = (wxInt32 *) icotxt;
int iIcon = 0;
stream.SeekI(0);
stream.Read(&FCC1, 4);
if ( FCC1 != *riff32 )
return FALSE;
// we have a riff file:
while (stream.IsOk())
{
// we always have a data size
stream.Read(&datalen, 4);
//now either data or a FCC
if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{
stream.Read(&FCC2, 4);
}
else
{
if (FCC1 == *ico32 && iIcon >= index)
{
return DoLoadFile(image, stream, verbose, -1);
}
else
{
stream.SeekI(stream.TellI() + datalen);
if ( FCC1 == *ico32 )
iIcon ++;
}
}
// try to read next data chunk:
stream.Read(&FCC1, 4);
}
return FALSE;
}
bool wxANIHandler::DoCanRead(wxInputStream& stream)
{
wxInt32 FCC1, FCC2;
wxUint32 datalen ;
static const char *rifftxt = "RIFF";
static const char *listtxt = "LIST";
static const char *anihtxt = "anih";
wxInt32 *riff32 = (wxInt32 *) rifftxt;
wxInt32 *list32 = (wxInt32 *) listtxt;
wxInt32 *anih32 = (wxInt32 *) anihtxt;
stream.SeekI(0);
stream.Read(&FCC1, 4);
if ( FCC1 != *riff32 )
return FALSE;
// we have a riff file:
while ( stream.IsOk() )
{
if ( FCC1 != *anih32 )
return TRUE;
// we always have a data size:
stream.Read(&datalen, 4);
// now either data or a FCC:
if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{
stream.Read(&FCC2, 4);
}
else
{
stream.SeekI(stream.TellI() + datalen);
}
// try to read next data chunk:
stream.Read(&FCC1, 4);
}
return FALSE;
}
int wxANIHandler::GetImageCount(wxInputStream& stream)
{
wxInt32 FCC1, FCC2;
wxUint32 datalen ;
static const char *rifftxt = "RIFF";
static const char *listtxt = "LIST";
static const char *anihtxt = "anih";
wxInt32 *riff32 = (wxInt32 *) rifftxt;
wxInt32 *list32 = (wxInt32 *) listtxt;
wxInt32 *anih32 = (wxInt32 *) anihtxt;
stream.SeekI(0);
stream.Read(&FCC1, 4);
if ( FCC1 != *riff32 )
return wxNOT_FOUND;
// we have a riff file:
while ( stream.IsOk() )
{
// we always have a data size:
stream.Read(&datalen, 4);
// now either data or a FCC:
if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{
stream.Read(&FCC2, 4);
}
else
{
if ( FCC1 == *anih32 )
{
wxUint32 *pData = new wxUint32[datalen/4];
stream.Read(pData, datalen);
int nIcons = *(pData + 1);
delete[] pData;
return nIcons;
}
else
stream.SeekI(stream.TellI() + datalen);
}
// try to read next data chunk:
stream.Read(&FCC1, 4);
}
return wxNOT_FOUND;
}
#endif // wxUSE_ICO_CUR
#endif // wxUSE_IMAGE && wxUSE_STREAMS #endif // wxUSE_IMAGE && wxUSE_STREAMS