- "Alt" key (VK_MENU) now results in WXK_ALT keyboard event, not WXK_MENU
- wxFFile::ReadAll() now takes an optional wxMBConv parameter
- wxCommandProcessor::MarkAsSaved() and IsDirty() added (Angela Wrobel)
+- added wxStackWalker and related classes (Win32 and some Unix versions only)
All (GUI):
of the progress (with new "Skip" button in dialog)
- wxGenericListCtrl::SetItemState(-1) now changes the state of all items as
in wxMSW version (Gunnar Roth)
+- added wxImage::InitAlpha()
Unix:
\helpref{wxImage::GetOptionInt}{wximagegetoptionint}
+\membersection{wxImage::InitAlpha}\label{wximageinitalpha}
+
+\func{void}{InitAlpha}{\void}
+
+Initializes the image alpha channel data. It is an error to call it
+if the image already has alpha data. If it doesn't, alpha data will be
+by default initialized to all pixels being fully opaque. But if the image has a
+a mask colour, all mask pixels will be completely transparent.
+
+
\membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
\func{static void}{InitStandardHandlers}{\void}
unsigned char *GetAlpha() const; // may return NULL!
bool HasAlpha() const { return GetAlpha() != NULL; }
void SetAlpha(unsigned char *alpha = NULL);
+ void InitAlpha();
// Mask functions
void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
return M_IMGDATA->m_alpha;
}
+void wxImage::InitAlpha()
+{
+ wxCHECK_RET( !HasAlpha(), wxT("image already has an alpha channel") );
+
+ // initialize memory for alpha channel
+ SetAlpha();
+
+ unsigned char *alpha = M_IMGDATA->m_alpha;
+ const size_t lenAlpha = M_IMGDATA->m_width * M_IMGDATA->m_height;
+
+ static const unsigned char ALPHA_TRANSPARENT = 0;
+ static const unsigned char ALPHA_OPAQUE = 0xff;
+ if ( HasMask() )
+ {
+ // use the mask to initialize the alpha channel.
+ const unsigned char * const alphaEnd = alpha + lenAlpha;
+
+ const unsigned char mr = M_IMGDATA->m_maskRed;
+ const unsigned char mg = M_IMGDATA->m_maskGreen;
+ const unsigned char mb = M_IMGDATA->m_maskBlue;
+ for ( unsigned char *src = M_IMGDATA->m_data;
+ alpha < alphaEnd;
+ src += 3, alpha++ )
+ {
+ *alpha = (src[0] == mr && src[1] == mg && src[2] == mb)
+ ? ALPHA_TRANSPARENT
+ : ALPHA_OPAQUE;
+ }
+
+ M_IMGDATA->m_hasMask = false;
+ }
+ else // no mask
+ {
+ // make the image fully opaque
+ memset(alpha, ALPHA_OPAQUE, lenAlpha);
+ }
+}
+
// ----------------------------------------------------------------------------
// mask support
// ----------------------------------------------------------------------------