Applied Chris' patch for support for ICO loading.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2001-11-18 09:43:06 +00:00
parent 990578f892
commit 52b64b0a78
5 changed files with 385 additions and 88 deletions

View File

@@ -41,22 +41,58 @@ enum
class WXDLLEXPORT wxBMPHandler : public wxImageHandler
{
public:
wxBMPHandler()
{
m_name = _T("BMP file");
m_extension = _T("bmp");
m_type = wxBITMAP_TYPE_BMP;
m_mime = _T("image/bmp");
};
wxBMPHandler()
{
m_name = _T("BMP file");
m_extension = _T("bmp");
m_type = wxBITMAP_TYPE_BMP;
m_mime = _T("image/bmp");
};
#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 DoCanRead( wxInputStream& stream );
protected:
bool DoLoadDib (wxImage * image, int width, int height, int bpp, int ncolors, int comp,
off_t bmpOffset, wxInputStream& stream,
bool verbose, bool IsBmp, bool hasPalette ) ;
bool LoadDib( wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp ) ;
#endif // wxUSE_STREAMS
DECLARE_DYNAMIC_CLASS(wxBMPHandler)
private:
DECLARE_DYNAMIC_CLASS(wxBMPHandler)
};
// ----------------------------------------------------------------------------
// wxICOHandler
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxICOHandler : public wxBMPHandler
{
public:
wxICOHandler()
{
m_name = _T("ICO file");
m_extension = _T("ico");
m_type = wxBITMAP_TYPE_ICO;
m_mime = _T("image/icon");
};
#if wxUSE_STREAMS
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 DoCanRead( wxInputStream& stream );
#endif // wxUSE_STREAMS
private:
DECLARE_DYNAMIC_CLASS(wxBMPHandler)
};

View File

@@ -151,6 +151,10 @@ public:
unsigned char GetGreen( int x, int y ) const;
unsigned char GetBlue( int x, int y ) const;
// used to manipulate the icons while extracting from .ico files
bool GetUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b );
bool ApplyMask( const wxImage & mask );
static bool CanRead( const wxString& name );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY );
virtual bool LoadFile( const wxString& name, const wxString& mimetype );