+ if ( image.HasAlpha() )
+ {
+ unsigned char *alpha = image.GetAlpha();
+
+ wxColour maskcolor(image.GetMaskRed(), image.GetMaskGreen(), image.GetMaskBlue());
+ RGBColor color ;
+ wxBitmap maskBitmap ;
+
+ maskBitmap.Create( width, height, 24);
+ LockPixels( GetGWorldPixMap( (GWorldPtr) maskBitmap.GetHBITMAP()) );
+ SetGWorld( (GWorldPtr) maskBitmap.GetHBITMAP(), NULL);
+
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ memset( &color , 255 - *alpha , sizeof( color ) );
+ SetCPixel(x,y, &color);
+
+ alpha += 1 ;
+ }
+ } // for height
+ SetGWorld( (GWorldPtr) GetHBITMAP(), NULL);
+ SetMask(new wxMask( maskBitmap ));
+ UnlockPixels( GetGWorldPixMap( (GWorldPtr) maskBitmap.GetHBITMAP()) );
+ }
+ else if ( image.HasMask() )