X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fec19ea9ff590f401ad17b1e2109b1e95d2f5e91..e1b8d4d841979b9fed749e1f8a18abc58975a4d9:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index ef7c6c123e..fbf84266bb 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -18,6 +18,10 @@ #pragma hdrstop #endif +#include "wx/defs.h" + +#if wxUSE_IMAGE + #include "wx/image.h" #include "wx/bitmap.h" #include "wx/debug.h" @@ -410,31 +414,31 @@ void wxImage::Paste( const wxImage &image, int x, int y ) } return; } - + if (!HasMask() && image.HasMask()) { unsigned char r = image.GetMaskRed(); unsigned char g = image.GetMaskGreen(); unsigned char b = image.GetMaskBlue(); - + width *= 3; unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth(); int source_step = image.GetWidth()*3; unsigned char* target_data = GetData() + (x+xx)*3 + (y+yy)*3*M_IMGDATA->m_width; int target_step = M_IMGDATA->m_width*3; - + for (int j = 0; j < height; j++) { for (int i = 0; i < width; i+=3) { - if ((source_data[i] != r) && - (source_data[i+1] != g) && + if ((source_data[i] != r) && + (source_data[i+1] != g) && (source_data[i+2] != b)) { memcpy( target_data+i, source_data+i, 3 ); } - } + } source_data += source_step; target_data += target_step; } @@ -464,7 +468,7 @@ void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1, } } -wxImage wxImage::ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) +wxImage wxImage::ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const { wxImage image; @@ -1019,7 +1023,10 @@ wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) void wxImage::InitStandardHandlers() { - AddHandler( new wxBMPHandler ); + AddHandler(new wxBMPHandler); +#if !defined(__WXGTK__) && !defined(__WXMOTIF__) + AddHandler(new wxXPMHandler); +#endif } void wxImage::CleanUpHandlers() @@ -1084,7 +1091,7 @@ bool wxImageHandler::CanRead( const wxString& name ) #if wxUSE_GUI #ifdef __WXGTK__ -wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue ) +wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue ) const { wxImage mono = this->ConvertToMono( red, green, blue ); wxBitmap bitmap( mono, 1 ); @@ -1136,7 +1143,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) { wxHashTable h; wxObject dummy; - unsigned char r, g, b, *p; + unsigned char r, g, b; + unsigned char *p; unsigned long size, nentries, key; p = GetData(); @@ -1170,7 +1178,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) // unsigned long wxImage::ComputeHistogram( wxHashTable &h ) { - unsigned char r, g, b, *p; + unsigned char r, g, b; + unsigned char *p; unsigned long size, nentries, key; wxHNode *hnode; @@ -1460,3 +1469,4 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i return rotated; } +#endif // wxUSE_IMAGE