void Image3uint8::copyArray(const Color4* src, int w, int h) { resize(w, h); int N = w * h; Color3uint8* dst = getCArray(); for (int i = 0; i < N; ++i) { dst[i] = Color3uint8(src[i].rgb()); } }
/** Saves in any of the formats supported by G3D::GImage. */ void Image3::save(const std::string& filename, GImage::Format fmt) { GImage im(width(), height(), 3); int N = im.width() * im.height(); Color3uint8* dst = im.pixel3(); for (int i = 0; i < N; ++i) { dst[i] = Color3uint8(data[i]); } im.save(filename, fmt); }