added alpha support to wxImage::Paste() (patch 1883497, bug 1831612)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,6 +114,7 @@ All (GUI):
|
|||||||
charset in ANSI build.
|
charset in ANSI build.
|
||||||
- wxGrid now indicates focus by using different colour for selection
|
- wxGrid now indicates focus by using different colour for selection
|
||||||
and hiding cell cursor when it doesn't have focus.
|
and hiding cell cursor when it doesn't have focus.
|
||||||
|
- Added alpha support to wxImage::Paste() (Steven Van Ingelgem)
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -1289,6 +1289,26 @@ void wxImage::Paste( const wxImage &image, int x, int y )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy over the alpha channel from the original image
|
||||||
|
if ( image.HasAlpha() )
|
||||||
|
{
|
||||||
|
if ( !HasAlpha() )
|
||||||
|
InitAlpha();
|
||||||
|
|
||||||
|
unsigned char* source_data = image.GetAlpha() + xx + yy*image.GetWidth();
|
||||||
|
int source_step = image.GetWidth();
|
||||||
|
|
||||||
|
unsigned char* target_data = GetAlpha() + (x+xx) + (y+yy)*M_IMGDATA->m_width;
|
||||||
|
int target_step = M_IMGDATA->m_width;
|
||||||
|
|
||||||
|
for (int j = 0; j < height; j++,
|
||||||
|
source_data += source_step,
|
||||||
|
target_data += target_step)
|
||||||
|
{
|
||||||
|
memcpy( target_data, source_data, width );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!HasMask() && image.HasMask())
|
if (!HasMask() && image.HasMask())
|
||||||
{
|
{
|
||||||
unsigned char r = image.GetMaskRed();
|
unsigned char r = image.GetMaskRed();
|
||||||
|
Reference in New Issue
Block a user