git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54774
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
ChannelType& Alpha() { return *m_pAlpha; }
// address the pixel contents directly (always RGB, without alpha)
ChannelType& Alpha() { return *m_pAlpha; }
// address the pixel contents directly (always RGB, without alpha)
- typename PixelFormat::PixelType& Data()
+ //
+ // this can't be used to modify the image as assigning a 32bpp
+ // value to 24bpp pixel would overwrite an extra byte in the next
+ // pixel or beyond the end of image
+ const typename PixelFormat::PixelType& Data()
{ return *(typename PixelFormat::PixelType *)m_pRGB; }
// private: -- see comment in the beginning of the file
{ return *(typename PixelFormat::PixelType *)m_pRGB; }
// private: -- see comment in the beginning of the file
// address the pixel contents directly
//
// warning: the format is platform dependent
// address the pixel contents directly
//
// warning: the format is platform dependent
+ //
+ // warning 2: assigning to Data() only works correctly for 16bpp or
+ // 32bpp formats but using it for 24bpp ones overwrites
+ // one extra byte and so can't be done
typename PixelFormat::PixelType& Data()
{ return *(typename PixelFormat::PixelType *)m_ptr; }
typename PixelFormat::PixelType& Data()
{ return *(typename PixelFormat::PixelType *)m_ptr; }