Add wxImage::ClearAlpha().
This simple method can be used to remove alpha channel from the image. See #10915. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -428,6 +428,7 @@ All:
|
|||||||
- Fix output buffer overflow in wxBase64Decode() (Eric W. Savage).
|
- Fix output buffer overflow in wxBase64Decode() (Eric W. Savage).
|
||||||
- Added bilinear image resizing algorithm to wxImage (bishop).
|
- Added bilinear image resizing algorithm to wxImage (bishop).
|
||||||
- Fix bug with position argument in wxImage::Size() (Byron Sorgdrager).
|
- Fix bug with position argument in wxImage::Size() (Byron Sorgdrager).
|
||||||
|
- Added wxImage::ClearAlpha() (Javier Torres).
|
||||||
- Fix bug with parsing concatenated switches in wxCmdLineParser (Mike Funduc).
|
- Fix bug with parsing concatenated switches in wxCmdLineParser (Mike Funduc).
|
||||||
- Added wxMBConv::cMB2WC(wxCharBuffer) and cWC2MB(wxWCharBuffer) overloads.
|
- Added wxMBConv::cMB2WC(wxCharBuffer) and cWC2MB(wxWCharBuffer) overloads.
|
||||||
- Added wxAny class; a modern, backwards-incompatible replacement for
|
- Added wxAny class; a modern, backwards-incompatible replacement for
|
||||||
|
@@ -451,6 +451,7 @@ public:
|
|||||||
bool HasAlpha() const { return GetAlpha() != NULL; }
|
bool HasAlpha() const { return GetAlpha() != NULL; }
|
||||||
void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
|
void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
|
||||||
void InitAlpha();
|
void InitAlpha();
|
||||||
|
void ClearAlpha();
|
||||||
|
|
||||||
// return true if this pixel is masked or has alpha less than specified
|
// return true if this pixel is masked or has alpha less than specified
|
||||||
// threshold
|
// threshold
|
||||||
|
@@ -1396,6 +1396,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetAlpha(int x, int y, unsigned char alpha);
|
void SetAlpha(int x, int y, unsigned char alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the alpha channel from the image.
|
||||||
|
|
||||||
|
This function should only be called if the image has alpha channel data,
|
||||||
|
use HasAlpha() to check for this.
|
||||||
|
|
||||||
|
@since 2.9.1
|
||||||
|
*/
|
||||||
|
void ClearAlpha();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the image data without performing checks.
|
Sets the image data without performing checks.
|
||||||
|
|
||||||
|
@@ -1857,6 +1857,17 @@ void wxImage::InitAlpha()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxImage::ClearAlpha()
|
||||||
|
{
|
||||||
|
wxCHECK_RET( HasAlpha(), wxT("image already doesn't have an alpha channel") );
|
||||||
|
|
||||||
|
if ( !M_IMGDATA->m_staticAlpha )
|
||||||
|
free( M_IMGDATA->m_alpha );
|
||||||
|
|
||||||
|
M_IMGDATA->m_alpha = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// mask support
|
// mask support
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user