wxBitmap sim_area_widget::convert_to_bitmap(const image& img)
{
	std::vector<unsigned char> rgb;
	rgb.reserve(img.size_x() * img.size_y() * 3);
	std::vector<unsigned char> alpha;
	alpha.reserve(img.size_x() * img.size_y());

	for (int i = 0; i < img.size_x() * img.size_y(); ++i)
	{
		rgb.push_back(img.data()[i * 4]);
		rgb.push_back(img.data()[i * 4 + 1]);
		rgb.push_back(img.data()[i * 4 + 2]);
		alpha.push_back(img.data()[i * 4 + 3]);
	}
	
	return wxBitmap
		(wxImage(img.size_x(), img.size_y(), &rgb.front(), &alpha.front(), true));
}
Example #2
0
 //! @brief コピーコンストラクタ
 image(image const& img):
     size_(img.size()),
     internal_format_(img.internal_format_), pixel_format_(img.pixel_format_),
     data_(img.data()){}