+#endif
+}
+
+#ifdef wxHAS_RAW_BITMAP
+wxBitmap BitmapFromRGBAImage(int width, int height, const unsigned char *pixelsImage)
+{
+ int x, y;
+ wxBitmap bmp(width, height, 32);
+ wxAlphaPixelData pixData(bmp);
+
+ wxAlphaPixelData::Iterator p(pixData);
+ for (y=0; y<height; y++) {
+ p.MoveTo(pixData, 0, y);
+ for (x=0; x<width; x++) {
+ unsigned char red = *pixelsImage++;
+ unsigned char green = *pixelsImage++;
+ unsigned char blue = *pixelsImage++;
+ unsigned char alpha = *pixelsImage++;
+
+ p.Red() = wxPy_premultiply(red, alpha);
+ p.Green() = wxPy_premultiply(green, alpha);
+ p.Blue() = wxPy_premultiply(blue, alpha);
+ p.Alpha() = alpha;
+ ++p;
+ }
+ }
+ return bmp;
+}
+#endif
+
+
+void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height,
+ const unsigned char *pixelsImage)
+{
+#ifdef wxHAS_RAW_BITMAP
+ wxRect r = wxRectFromPRectangle(rc);
+ wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage);
+ hdc->DrawBitmap(bmp, r.x, r.y, true);
+#endif