From 0ff2a74d0cc65f081aafcff79bcd3fd14638814f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 15 Feb 2005 20:27:46 +0000 Subject: [PATCH] Implemented wxBitmap::HasAlpha() and ::UseAlpha(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32086 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/bitmap.tex | 5 +++-- include/wx/gtk/bitmap.h | 4 ++-- include/wx/gtk1/bitmap.h | 4 ++-- src/gtk/bitmap.cpp | 17 +++++++++++++++++ src/gtk1/bitmap.cpp | 17 +++++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/latex/wx/bitmap.tex b/docs/latex/wx/bitmap.tex index 3dc40bc738..6be3fcce5e 100644 --- a/docs/latex/wx/bitmap.tex +++ b/docs/latex/wx/bitmap.tex @@ -3,7 +3,7 @@ %\overview{Overview}{wxbitmapoverview} % This class encapsulates the concept of a platform-dependent bitmap, -either monochrome or colour. +either monochrome or colour or colour with alpha channel support. \wxheading{Derived from} @@ -72,7 +72,8 @@ bitmaps from static data. Creates a new bitmap. A depth of -1 indicates the depth of the current screen or visual. Some platforms only support 1 for monochrome and -1 for the current -colour setting. +colour setting. Beginning with version 2.5.4 of wxWidgets a depth if 32 including +an alpha channel is supported under MSW, Mac and GTK+. \func{}{wxBitmap}{\param{const char**}{ bits}} diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 3dccd3668f..c3058826d5 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -137,8 +137,8 @@ public: void *GetRawData(wxPixelDataBase& data, int bpp); void UngetRawData(wxPixelDataBase& data); - bool HasAlpha() const { return true; } - void UseAlpha() { } + bool HasAlpha() const; + void UseAlpha(); protected: bool CreateFromXpm(const char **bits); diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 3dccd3668f..c3058826d5 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -137,8 +137,8 @@ public: void *GetRawData(wxPixelDataBase& data, int bpp); void UngetRawData(wxPixelDataBase& data); - bool HasAlpha() const { return true; } - void UseAlpha() { } + bool HasAlpha() const; + void UseAlpha(); protected: bool CreateFromXpm(const char **bits); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 25483b1ee3..df7af69140 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -1597,6 +1597,23 @@ void wxBitmap::UngetRawData(wxPixelDataBase& data) { } + +bool wxBitmap::HasAlpha() const +{ +#ifdef __WXGTK20__ + return HasPixbuf(); +#else + return false; +#endif +} + +void wxBitmap::UseAlpha() +{ +#ifdef __WXGTK20__ + GetPixbuf(); +#endif +} + //----------------------------------------------------------------------------- // wxBitmapHandler //----------------------------------------------------------------------------- diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 25483b1ee3..df7af69140 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -1597,6 +1597,23 @@ void wxBitmap::UngetRawData(wxPixelDataBase& data) { } + +bool wxBitmap::HasAlpha() const +{ +#ifdef __WXGTK20__ + return HasPixbuf(); +#else + return false; +#endif +} + +void wxBitmap::UseAlpha() +{ +#ifdef __WXGTK20__ + GetPixbuf(); +#endif +} + //----------------------------------------------------------------------------- // wxBitmapHandler //----------------------------------------------------------------------------- -- 2.49.0