Beispiel #1
0
// static
void FormatConversion::image4fToImage3ub( const Image4f& source, Image3ub& destination, bool flipUpDown )
{
	int width = source.width();
	int height = source.height();

	for( int y = 0; y < height; ++y )
	{
		int yy = y;
		if( flipUpDown )
		{
			yy = height - y - 1;
		}

		for( int x = 0; x < width; ++x )
		{
			Vector4f input = source.pixel( x, y );
			Vector3i output = ColorUtils::floatToInt( input ).xyz();
			destination.setPixel( x, yy, output );
		}
	}
}