X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd38c87578df7a24a491401c943988e2bc89b62b..653eafdf4f51116c8c0aecd02c6ba20eaf44a8bb:/samples/image/image.cpp diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 734eadf90e..b5b394ba3e 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -34,8 +34,12 @@ #if !defined(__WINDOWS__) || wxUSE_XPM_IN_MSW #include "smile.xpm" #endif -#include "wx/rawbmp.h" +#if defined(__WXMSW__) || defined(__WXMAC__) + #ifdef wxHAVE_RAW_BITMAP + #include "wx/rawbmp.h" + #endif +#endif // derived classes @@ -258,9 +262,11 @@ public: { SetClientSize(SIZE, SIZE); - wxAlphaPixelData data(m_bitmap, - wxPoint(BORDER, BORDER), - wxSize(REAL_SIZE, REAL_SIZE)); + // another possibility: wxNativePixelData (don't forget to remove code + // setting alpha in the loop below then) + typedef wxAlphaPixelData Data; + + Data data(m_bitmap, wxPoint(BORDER, BORDER), wxSize(REAL_SIZE, REAL_SIZE)); if ( !data ) { wxLogError(_T("Failed to gain raw access to bitmap data")); @@ -269,11 +275,11 @@ public: data.UseAlpha(); - wxAlphaPixelData::Iterator p(data); + Data::Iterator p(data); for ( int y = 0; y < REAL_SIZE; ++y ) { - wxAlphaPixelData::Iterator rowStart = p; + Data::Iterator rowStart = p; int r = y < REAL_SIZE/3 ? 255 : 0, g = (REAL_SIZE/3 <= y) && (y < 2*(REAL_SIZE/3)) ? 255 : 0, @@ -284,7 +290,7 @@ public: p.Red() = r; p.Green() = g; p.Blue() = b; - p.Alpha() = (x*255.)/REAL_SIZE; + p.Alpha() = (Data::Iterator::ChannelType)((x*255.)/REAL_SIZE); ++p; // same as p.OffsetX(1) } @@ -891,7 +897,7 @@ void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) ) #ifdef wxHAVE_RAW_BITMAP -void MyFrame::OnTestRawBitmap( wxCommandEvent &event ) +void MyFrame::OnTestRawBitmap( wxCommandEvent &WXUNUSED(event) ) { (new MyRawBitmapFrame(this))->Show(); }