Add WithAlpha method to COLOR4D

This is useful for taking a "base" color and making derived colours with
the given alpha, but the same RGB value.
This commit is contained in:
John Beard 2017-03-01 09:59:25 +08:00 committed by Maciej Suminski
parent 275ba503d1
commit e67882f0a3
1 changed files with 13 additions and 0 deletions

View File

@ -223,6 +223,19 @@ public:
a );
}
/**
* Function WithAlpha
* Returns a colour with the same colour, but the given alpha
* @param aAlpha specifies the alpha of the new color
* @return COLOR4D color with that alpha
*/
COLOR4D WithAlpha( double aAlpha ) const
{
assert( aAlpha >= 0.0 && aAlpha <= 1.0 );
return COLOR4D( r, g, b, aAlpha );
}
/**
* Function Inverted
* Returns an inverted color, alpha remains the same.