color_t: added an empty() function

This commit is contained in:
Charles Dang 2016-11-30 15:40:19 +11:00
parent fa3c4682db
commit 9aff81a89c

View file

@ -188,6 +188,11 @@ struct color_t
/** Alpha value */
uint8_t a;
bool empty(const bool check_alpha = true) const
{
return r ==0 && g == 0 && b == 0 && (check_alpha ? a == 0 : true);
}
bool operator==(const color_t& c) const
{
return r == c.r && g == c.g && b == c.b && a == c.a;