added wxImage::IsTransparent(x, y)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-04-02 21:30:22 +00:00
parent 60b1fda237
commit 21dc4be5d2
4 changed files with 81 additions and 17 deletions

View File

@@ -46,6 +46,13 @@ enum
wxIMAGE_RESOLUTION_CM = 2
};
// alpha channel values: fully transparent, default threshold separating
// transparent pixels from opaque for a few functions dealing with alpha and
// fully opaque
const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0;
const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80;
const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff;
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
@@ -240,7 +247,7 @@ public:
// converts image's alpha channel to mask, if it has any, does nothing
// otherwise:
bool ConvertAlphaToMask(unsigned char threshold = 128);
bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
// This method converts an image where the original alpha
// information is only available as a shades of a colour
@@ -290,6 +297,11 @@ public:
void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
void InitAlpha();
// return true if this pixel is masked or has alpha less than specified
// threshold
bool IsTransparent(int x, int y,
unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const;
// Mask functions
void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
// Get the current mask colour or find a suitable colour