#include "wx/wfstream.h"
#include "wx/intl.h"
+#ifdef __SALFORDC__
+#ifdef FAR
+#undef FAR
+#endif
+#endif
+
#ifdef __WXMSW__
#include <windows.h>
#endif
LoadFile( name, type );
}
+#if wxUSE_STREAMS
wxImage::wxImage( wxInputStream& stream, long type )
{
LoadFile( stream, type );
}
+#endif // wxUSE_STREAMS
wxImage::wxImage( const wxImage& image )
{
bool wxImage::LoadFile( const wxString& filename, long type )
{
+#if wxUSE_STREAMS
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
}
else {
- wxLogWarning( "Image file does not exist." );
+ 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 )
+ return SaveFile(stream, type);
+ else
+#endif // wxUSE_STREAMS
+ return FALSE;
+}
+
+#if wxUSE_STREAMS
bool wxImage::LoadFile( wxInputStream& stream, long type )
{
UnRef();
return handler->LoadFile( this, stream );
}
-bool wxImage::SaveFile( const wxString& filename, int type )
-{
- wxFileOutputStream stream(filename);
-
- if ( stream.LastError() == wxStream_NOERROR )
- return SaveFile(stream, type);
- else
- return FALSE;
-}
-
bool wxImage::SaveFile( wxOutputStream& stream, int type )
{
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
return handler->SaveFile( this, stream );
}
+#endif // wxUSE_STREAMS
void wxImage::AddHandler( wxImageHandler *handler )
{
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
- if (handler->GetName() == name) return handler;
+ if (handler->GetName().Cmp(name) == 0) return handler;
+
node = node->Next();
}
return (wxImageHandler *)NULL;
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
- if ( handler->GetExtension() == extension &&
+ if ( (handler->GetExtension().Cmp(extension) == 0) &&
(bitmapType == -1 || handler->GetType() == bitmapType) )
return handler;
node = node->Next();
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif
+#if wxUSE_STREAMS
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{
return FALSE;
{
return FALSE;
}
+#endif // wxUSE_STREAMS
//-----------------------------------------------------------------------------
// wxPNGHandler
#endif
+#if wxUSE_STREAMS
static void _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
{
((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
}
return TRUE;
}
+#endif // wxUSE_STREAMS
#endif
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif
+#if wxUSE_STREAMS
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{
unsigned char *data, *ptr;
return TRUE;
}
+#endif // wxUSE_STREAMS
#ifdef __WXMSW__