average
Average two colors component-wise
Parameters
Source
Implementation
pub fn average(self: Color, other: Color) Color {
return Color{
.r = @intCast((@as(u9, @intCast(self.r)) + other.r) / 2),
.g = @intCast((@as(u9, @intCast(self.g)) + other.g) / 2),
.b = @intCast((@as(u9, @intCast(self.b)) + other.b) / 2),
.a = @intCast((@as(u9, @intCast(self.a)) + other.a) / 2),
};
}