From 10b41b53cb6049edac26dd0a3210d2a44e9066ff Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Apr 2003 13:45:20 +0000 Subject: [PATCH] added wxBitmap::UseAlpha() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/bitmap.h | 4 +++- include/wx/rawbmp.h | 3 +++ samples/image/image.cpp | 2 ++ src/msw/bitmap.cpp | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index 536a62b307..cd67008e6b 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -146,8 +146,10 @@ public: bool operator==(const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; } bool operator!=(const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } - // this function is internal and shouldn't be used, it risks to disappear + // these functions are internal and shouldn't be used, they risk to + // disappear in the future bool HasAlpha() const; + void UseAlpha(); #if WXWIN_COMPATIBILITY_2_4 // these functions do nothing and are only there for backwards diff --git a/include/wx/rawbmp.h b/include/wx/rawbmp.h index 5af914e4a4..a7fa177ede 100644 --- a/include/wx/rawbmp.h +++ b/include/wx/rawbmp.h @@ -90,6 +90,9 @@ public: m_bmp.UngetRawData(this); } + // call this to indicate that we should use the alpha channel + void UseAlpha() { m_bmp.UseAlpha(); } + // accessors unsigned char *GetPixels() const { return m_pixels; } int GetWidth() const { return m_width; } diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 3dfe14841f..584dda7848 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -267,6 +267,8 @@ public: return; } + data.UseAlpha(); + wxRawBitmapIterator p(data); p.Offset(BORDER, BORDER); diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 8cc1e1b180..564f1f33f1 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -1096,6 +1096,12 @@ int wxBitmap::GetQuality() const #endif // WXWIN_COMPATIBILITY_2_4 +void wxBitmap::UseAlpha() +{ + if ( GetBitmapData() ) + GetBitmapData()->m_hasAlpha = true; +} + bool wxBitmap::HasAlpha() const { return GetBitmapData() && GetBitmapData()->m_hasAlpha; -- 2.45.2