Пример #1
0
bool Image::get(int a_nWidth, int a_nHeight, RGB &a_rgbColor)
{
	if(a_nWidth < 0 || a_nWidth > m_nWidth) return false;
	if(a_nHeight < 0 || a_nHeight > m_nHeight) return false;
	
	a_rgbColor.set(m_rgbImage[a_nWidth][a_nHeight]);
	
	return true;	
}
Пример #2
0
void Image::gammaCorrect(float dGamma)
{
	RGB rgbTemp;
	float fPower = 1.0 / dGamma;
	
	for(int x = 0; x < m_nWidth; x++) {
		for(int y = 0; y < m_nHeight; y++) {
			rgbTemp.set(m_rgbImage[x][y]);
			
			rgbTemp.clamp(0.0, 1.0);
						
			m_rgbImage[x][y].R = pow(rgbTemp.r(), fPower);
			m_rgbImage[x][y].G = pow(rgbTemp.g(), fPower);
			m_rgbImage[x][y].B = pow(rgbTemp.b(), fPower);
		}
	}
}