- // access to invidividual colour components
- ChannelType& Red() { return m_pRGB[PixelFormat::RED]; }
- ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; }
- ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; }
- ChannelType& Alpha() { return *m_pAlpha; }
+ // access to individual colour components
+ PixelFormat::ChannelType& Red() { return m_pRGB[PixelFormat::RED]; }
+ PixelFormat::ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; }
+ PixelFormat::ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; }
+ PixelFormat::ChannelType& Alpha() { return *m_pAlpha; }
+
+ // address the pixel contents directly (always RGB, without alpha)
+ //
+ // 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; }