wxBMP_24BPP
};
- static const wxString bppchoices[] =
+ const wxString bppchoices[] =
{
_T("1 bpp color"),
_T("1 bpp B&W"),
wxPNG_TYPE_GREY_RED,
};
- static const wxString pngchoices[] =
+ const wxString pngchoices[] =
{
_T("Colour 8bpp"),
_T("Colour 16bpp"),
return;
}
-// data.UseAlpha();
+ data.UseAlpha();
Data::Iterator p(data);
for ( int x = 0; x < REAL_SIZE; ++x )
{
- p.Red() = r;
- p.Green() = g;
- p.Blue() = b;
- p.Alpha() = (Data::Iterator::ChannelType)((x*255.)/REAL_SIZE);
+ // note that RGB must be premultiplied by alpha
+ unsigned a = (Data::Iterator::ChannelType)((x*255.)/REAL_SIZE);
+ p.Red() = r * a / 256;
+ p.Green() = g * a / 256;
+ p.Blue() = b * a / 256;
+ p.Alpha() = a;
++p; // same as p.OffsetX(1)
}