]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
Applied patch [ 1428990 ] wxUniv: patch for toolbar button remain in pressed status
[wxWidgets.git] / src / common / image.cpp
index 02df26fdd920c31c18bc6770c99a1f6035211581..125e97613a11d3e05d236caa6a552934bcad8061 100644 (file)
@@ -148,17 +148,6 @@ wxImage::wxImage( wxInputStream& stream, const wxString& mimetype, int index )
 }
 #endif // wxUSE_STREAMS
 
-wxImage::wxImage( const wxImage& image )
-    : wxObject()
-{
-    Ref(image);
-}
-
-wxImage::wxImage( const wxImage* image )
-{
-    if (image) Ref(*image);
-}
-
 wxImage::wxImage( const char** xpmData )
 {
     Create(xpmData);
@@ -261,9 +250,18 @@ wxImage wxImage::Copy() const
     image.SetMask( M_IMGDATA->m_hasMask );
 
     memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 );
-
-    // also copy the image options
+    
     wxImageRefData *imgData = (wxImageRefData *)image.m_refData;
+    
+    // also copy the alpha channel
+    if (HasAlpha())
+    {
+        image.SetAlpha();
+        unsigned char* alpha = image.GetAlpha();
+        memcpy( alpha, GetAlpha(), M_IMGDATA->m_width*M_IMGDATA->m_height );
+    }
+    
+    // also copy the image options
     imgData->m_optionNames = M_IMGDATA->m_optionNames;
     imgData->m_optionValues = M_IMGDATA->m_optionValues;