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:
parent
275ba503d1
commit
e67882f0a3
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue