Simplify Image by flipping RADIANCE images. (#63)

* Simplify Image by flipping RADIANCE images.

Unit test for the new flip() method is forthcoming.

* Optimize image flipping.
This commit is contained in:
Philip Rideout
2018-08-09 17:30:17 -07:00
committed by Romain Guy
parent 0f20068775
commit 07c34ee833
8 changed files with 47 additions and 48 deletions

View File

@@ -475,18 +475,14 @@ void HDREncoder::encode(const Image& image) {
size_t width = image.getWidth();
size_t height = image.getHeight();
char sx = (image.getFlags() & Image::FLIP_X) ? '-' : '+';
// Experimentally, "-Y" means vertical origin at the top, "+Y" at the bottom
char sy = (image.getFlags() & Image::FLIP_Y) ? '+' : '-';
mStream << "#?RADIANCE" << std::endl;
mStream << "# cmgen" << std::endl;
mStream << "FORMAT=32-bit_rle_rgbe" << std::endl;
mStream << "GAMMA=" << std::to_string(1) << std::endl;
mStream << "EXPOSURE=" << std::to_string(0) << std::endl;
mStream << std::endl;
mStream << sy << "Y " << std::to_string(height) << " "
<< sx << "X " << std::to_string(width) << std::endl;
mStream << "-Y " << std::to_string(height) << " "
<< "+X " << std::to_string(width) << std::endl;
std::unique_ptr<uint8_t[]> rgbe(new uint8_t[width*4]);
uint8_t* const r = &rgbe[0];