store palette information from XPM in wxImage (#9763)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -112,6 +112,7 @@ All (GUI):
|
|||||||
now sets the cursor to the next line after pressing Shift+Enter.
|
now sets the cursor to the next line after pressing Shift+Enter.
|
||||||
- Fix crash when reading malformed PCX images.
|
- Fix crash when reading malformed PCX images.
|
||||||
- Fix bug with wrong transparency in GIF animations (troelsk).
|
- Fix bug with wrong transparency in GIF animations (troelsk).
|
||||||
|
- Store palette information for XPM images in wxImage (troelsk).
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -808,6 +808,24 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_PALETTE
|
||||||
|
unsigned char* r = new unsigned char[colors_cnt];
|
||||||
|
unsigned char* g = new unsigned char[colors_cnt];
|
||||||
|
unsigned char* b = new unsigned char[colors_cnt];
|
||||||
|
|
||||||
|
for (it = clr_tbl.begin(), i = 0; it != clr_tbl.end(); it++, i++)
|
||||||
|
{
|
||||||
|
r[i] = it->second.R;
|
||||||
|
g[i] = it->second.G;
|
||||||
|
b[i] = it->second.B;
|
||||||
|
}
|
||||||
|
wxASSERT(i == colors_cnt);
|
||||||
|
img.SetPalette(wxPalette(colors_cnt, r, g, b));
|
||||||
|
delete[] r;
|
||||||
|
delete[] g;
|
||||||
|
delete[] b;
|
||||||
|
#endif // wxUSE_PALETTE
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user