X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3964e424bf6b70e43b7cf53ef41d279e4da5c037..aa4d3151d6218dd21cc9cd6e77ddc0181aa3414c:/include/wx/rawbmp.h?ds=sidebyside diff --git a/include/wx/rawbmp.h b/include/wx/rawbmp.h index dbdddcee3f..105c85714c 100644 --- a/include/wx/rawbmp.h +++ b/include/wx/rawbmp.h @@ -104,7 +104,7 @@ template - + struct WXDLLEXPORT wxPixelFormat { // iterator over pixels is usually of type "ChannelType *" @@ -120,7 +120,7 @@ struct WXDLLEXPORT wxPixelFormat enum { BitsPerPixel = Bpp }; // size of one pixel in ChannelType units (usually bytes) - enum { SizePixel = BitsPerPixel / (8 * sizeof(ChannelType)) }; + enum { SizePixel = Bpp / (8 * sizeof(Channel)) }; // the channels indices inside the pixel enum @@ -143,29 +143,32 @@ struct WXDLLEXPORT wxPixelFormat typedef wxPixelFormat wxImagePixelFormat; // the (most common) native bitmap format without alpha support -typedef wxPixelFormat wxNativePixelFormat; +#if defined(__WXMSW__) + // under MSW the RGB components are inversed, they're in BGR order + typedef wxPixelFormat wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXMAC__) + // under Mac, first component is unused but still present, hence we use + // 32bpp, not 24 + typedef wxPixelFormat wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 0 +#elif defined(__WXCOCOA__) + // Cocoa is standard RGB or RGBA (normally it is RGBA) + typedef wxPixelFormat wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#endif // the (most common) native format for bitmaps with alpha channel -typedef wxPixelFormat wxAlphaPixelFormat; +#ifdef wxPIXEL_FORMAT_ALPHA + typedef wxPixelFormat wxAlphaPixelFormat; +#endif // wxPIXEL_FORMAT_ALPHA // we also define the (default/best) pixel format for the given class: this is // used as default value for the pixel format in wxPixelIterator template @@ -198,6 +201,8 @@ public: int GetWidth() const { return m_width; } int GetHeight() const { return m_height; } + wxSize GetSize() const { return wxSize(m_width, m_height); } + // the distance between two rows int GetRowStride() const { return m_stride; } @@ -569,10 +574,9 @@ struct WXDLLEXPORT wxPixelDataOut // private: -- see comment in the beginning of the file - // NB: for efficiency reasons this class must *not* have any other - // fields, otherwise it won't be put into a CPU register (as it - // should inside the inner loops) by some compilers, notably - // gcc + // for efficiency reasons this class should not have any other + // fields, otherwise it won't be put into a CPU register (as it + // should inside the inner loops) by some compilers, notably gcc ChannelType *m_ptr; }; @@ -587,7 +591,7 @@ struct WXDLLEXPORT wxPixelDataOut wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) : m_bmp(bmp), m_pixels(bmp, *this) { - InitRect(rect.GetPositions(), rect.GetSize()); + InitRect(rect.GetPosition(), rect.GetSize()); } wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz)