-void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
-{
- wxCHECK_RET( Ok(), wxT("invalid image") );
-
- M_IMGDATA->m_maskRed = r;
- M_IMGDATA->m_maskGreen = g;
- M_IMGDATA->m_maskBlue = b;
- M_IMGDATA->m_hasMask = TRUE;
-}
-
-unsigned char wxImage::GetMaskRed() const
-{
- wxCHECK_MSG( Ok(), 0, wxT("invalid image") );
-
- return M_IMGDATA->m_maskRed;
-}
-
-unsigned char wxImage::GetMaskGreen() const
-{
- wxCHECK_MSG( Ok(), 0, wxT("invalid image") );
-
- return M_IMGDATA->m_maskGreen;
-}
-
-unsigned char wxImage::GetMaskBlue() const
-{
- wxCHECK_MSG( Ok(), 0, wxT("invalid image") );
-
- return M_IMGDATA->m_maskBlue;
-}
-
-void wxImage::SetMask( bool mask )
-{
- wxCHECK_RET( Ok(), wxT("invalid image") );
-
- M_IMGDATA->m_hasMask = mask;
-}
-
-bool wxImage::HasMask() const
-{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid image") );
-
- return M_IMGDATA->m_hasMask;
-}
-
-int wxImage::GetWidth() const
-{
- wxCHECK_MSG( Ok(), 0, wxT("invalid image") );
-
- return M_IMGDATA->m_width;
-}
-
-int wxImage::GetHeight() const
-{
- wxCHECK_MSG( Ok(), 0, wxT("invalid image") );
-
- return M_IMGDATA->m_height;
-}
-
-bool wxImage::LoadFile( const wxString& filename, long type )
-{
-#if wxUSE_STREAMS
- if (wxFileExists(filename))
- {
- wxFileInputStream stream(filename);
- wxBufferedInputStream bstream( stream );
- return LoadFile(bstream, type);
- }
- else
- {
- wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
-
- return FALSE;
- }
-#else // !wxUSE_STREAMS
- return FALSE;
-#endif // wxUSE_STREAMS
-}
-
-bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
-{
-#if wxUSE_STREAMS
- if (wxFileExists(filename))
- {
- wxFileInputStream stream(filename);
- wxBufferedInputStream bstream( stream );
- return LoadFile(bstream, mimetype);
- }
- else
- {
- wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
-
- return FALSE;
- }
-#else // !wxUSE_STREAMS
- return FALSE;
-#endif // wxUSE_STREAMS
-}
-
-bool wxImage::SaveFile( const wxString& filename, int type )
-{
-#if wxUSE_STREAMS
- wxFileOutputStream stream(filename);
-
- if ( stream.LastError() == wxStream_NOERROR )
- {
- wxBufferedOutputStream bstream( stream );
- return SaveFile(bstream, type);
- }
- else
-#endif // wxUSE_STREAMS
- return FALSE;
-}
-
-bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype )
-{
-#if wxUSE_STREAMS
- wxFileOutputStream stream(filename);
-
- if ( stream.LastError() == wxStream_NOERROR )
- {
- wxBufferedOutputStream bstream( stream );
- return SaveFile(bstream, mimetype);
- }
- else
-#endif // wxUSE_STREAMS
- return FALSE;
-}
-
-bool wxImage::CanRead( const wxString &name )
-{
-#if wxUSE_STREAMS
- wxFileInputStream stream(name);
- return CanRead(stream);
-#else
- return FALSE;
-#endif
-}
-
-#if wxUSE_STREAMS
-
-bool wxImage::CanRead( wxInputStream &stream )
-{
- wxList &list=GetHandlers();
-
- for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
- {
- wxImageHandler *handler=(wxImageHandler*)node->GetData();
- if (handler->CanRead( stream ))
- return TRUE;
- }
-
- return FALSE;
-}
-
-bool wxImage::LoadFile( wxInputStream& stream, long type )
-{
- UnRef();
-
- m_refData = new wxImageRefData;
-
- wxImageHandler *handler;
-
- if (type==wxBITMAP_TYPE_ANY)
- {
- wxList &list=GetHandlers();
-
- for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
- {
- handler=(wxImageHandler*)node->GetData();
- if (handler->CanRead( stream ))
- return handler->LoadFile( this, stream );
-
- }
-
- wxLogWarning( _("No handler found for image type.") );
- return FALSE;
- }
-
- handler = FindHandler(type);
-
- if (handler == NULL)
- {
- wxLogWarning( _("No image handler for type %d defined."), type );
-
- return FALSE;
- }
-
- return handler->LoadFile( this, stream );
-}
-
-bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype )
-{
- UnRef();
-
- m_refData = new wxImageRefData;
-
- wxImageHandler *handler = FindHandlerMime(mimetype);
-
- if (handler == NULL)
- {
- wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
-
- return FALSE;
- }
-
- return handler->LoadFile( this, stream );
-}
-
-bool wxImage::SaveFile( wxOutputStream& stream, int type )
-{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid image") );
-
- wxImageHandler *handler = FindHandler(type);
-
- if (handler == NULL)