- int w = image.GetWidth();
- int h = image.GetHeight();
-
- wxMemoryDC memDC;
- memDC.SelectObject(*this);
-
- wxColour pixelCol;
-
- // Warning: this is very inefficient.
- // TODO: use GrReadArea to get an array of pixels
- int i, j;
- for (i = 0; i < w; i++)
- {
- for (j = 0; j < h; j++)
- {
- memDC.GetPixel(i, j, & pixelCol);
-
- // TODO: make wxColour accessors more efficient
- // by inlining, if possible
- image.SetRGB(i, j,
- pixelCol.Red(), pixelCol.Green(),
- pixelCol.Blue());
- }
- }
- memDC.SelectObject(wxNullBitmap);
-
+ wxGetImageFromDrawable((Pixmap) GetPixmap(), 0, 0, GetWidth(), GetHeight(), image);