- Fix output buffer overflow in wxBase64Decode() (Eric W. Savage).
- Added bilinear image resizing algorithm to wxImage (bishop).
- 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).
- Added wxMBConv::cMB2WC(wxCharBuffer) and cWC2MB(wxWCharBuffer) overloads.
- Added wxAny class; a modern, backwards-incompatible replacement for
bool HasAlpha() const { return GetAlpha() != NULL; }
void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
void InitAlpha();
+ void ClearAlpha();
// return true if this pixel is masked or has alpha less than specified
// threshold
*/
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.
}
}
+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
// ----------------------------------------------------------------------------