From 062b84dd49ed5d6f494727df9db9d43d20928dda Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Mar 2005 18:00:58 +0000 Subject: [PATCH] use image mask colour if any instead of guessing that (0, 0) is always transparent in wxCreateGreyedImage() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/tbarbase.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 40c84a74cc..edfff6c1f2 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -740,8 +740,19 @@ bool wxCreateGreyedImage(const wxImage& in, wxImage& out) { out = in.Copy(); - // assuming the pixels along the edges are of the background color - wxColour bgCol(in.GetRed(0, 0), in.GetGreen(0, 0), in.GetBlue(0, 0)); + unsigned char r, g, b; + if ( in.HasMask() ) + { + in.GetOrFindMaskColour(&r, &g, &b); + } + else // assuming the pixels along the edges are of the background color + { + r = in.GetRed(0, 0); + g = in.GetGreen(0, 0); + b = in.GetBlue(0, 0); + } + + wxColour bgCol(r, g, b); wxColour darkCol = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW) ; wxColour lightCol = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT) ; -- 2.45.2