//result lines
- dst_data[0] = r1 * dy1 + r2 * dy;
- dst_data[1] = g1 * dy1 + g2 * dy;
- dst_data[2] = b1 * dy1 + b2 * dy;
+ dst_data[0] = static_cast<unsigned char>(r1 * dy1 + r2 * dy);
+ dst_data[1] = static_cast<unsigned char>(g1 * dy1 + g2 * dy);
+ dst_data[2] = static_cast<unsigned char>(b1 * dy1 + b2 * dy);
dst_data += 3;
if ( src_alpha )
- *dst_alpha++ = a1 * dy1 + a2 * dy;
+ *dst_alpha++ = static_cast<unsigned char>(a1 * dy1 + a2 * dy);
}
}
}
}
+void wxImage::ClearAlpha()
+{
+ wxCHECK_RET( HasAlpha(), wxT("image already doesn't have an alpha channel") );
+
+ if ( !M_IMGDATA->m_staticAlpha )
+ free( M_IMGDATA->m_alpha );
+
+ M_IMGDATA->m_alpha = NULL;
+}
+
+
// ----------------------------------------------------------------------------
// mask support
// ----------------------------------------------------------------------------
if ( !handler.LoadFile(this, stream, true/*verbose*/, index) )
return false;
- M_IMGDATA->m_type = handler.GetType();
-
// rescale the image to the specified size if needed
if ( maxWidth || maxHeight )
{
Rescale(width, height, wxIMAGE_QUALITY_HIGH);
}
+ // Set this after Rescale, which currently does not preserve it
+ M_IMGDATA->m_type = handler.GetType();
+
return true;
}