X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..228146b08230df0b1d1e8c52783d9322ae74ad4a:/src/common/imagpnm.cpp diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp index cea78ca07e..ce31404d45 100644 --- a/src/common/imagpnm.cpp +++ b/src/common/imagpnm.cpp @@ -68,17 +68,13 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose switch (c) { - case wxT('2'): - if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented.")); - return FALSE; - case wxT('5'): - if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented.")); - return FALSE; - case wxT('3'): - case wxT('6'): break; + case wxT('2'): // ASCII Grey + case wxT('3'): // ASCII RGB + case wxT('5'): // RAW Grey + case wxT('6'): break; default: if (verbose) wxLogError(_("PNM: File format is not recognized.")); - return FALSE; + return false; } text_stream.ReadLine(); // for the \n @@ -94,9 +90,26 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose { if (verbose) wxLogError( _("PNM: Couldn't allocate memory.") ); - return FALSE; + return false; } + + if (c=='2') // Ascii GREY + { + wxUint32 value, size=width*height; + for (wxUint32 i=0; iSetMask( FALSE ); + image->SetMask( false ); const wxStreamError err = buf_stream.GetLastError(); return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF; @@ -146,11 +176,11 @@ bool wxPNMHandler::DoCanRead( wxInputStream& stream ) { case '3': case '6': - return TRUE; + return true; } } - return FALSE; + return false; }