wxBitmap TexturePackPanel::GetFrameBitmap(const Frame& frame, int zoom) { wxSize imgSize = frame.GetSize(); imgSize *= zoom; wxMemoryDC srcDC; srcDC.SelectObject(m_bitmap); wxBitmap frameBmp(imgSize, m_bitmap.GetDepth()); wxMemoryDC dstDC; dstDC.SelectObject(frameBmp); dstDC.SetBackground(wxBrush(m_colourPicker->GetColour())); dstDC.Clear(); dstDC.StretchBlit(wxPoint(0, 0), imgSize, &srcDC, frame.GetOffset(), frame.GetSize(), wxCOPY, true); return frameBmp; }