From 9d25e1d69dede7d79ca9115a4ce4e65af49b8ddc Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Wed, 22 Sep 2021 22:46:47 -0400 Subject: Colour blending Some amount of work went into finding appropriate integer arithmetic formulae that were reasonably accurate. At this point i've settled for the incorrect-but-faster version. The better-though-slower formulas are still there in case i change my mind. It would help to have an assumption such as, but not limited to, the surfaces are always going to be fully opaque. --- src/sfml/graphics/color.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sfml/graphics') diff --git a/src/sfml/graphics/color.zig b/src/sfml/graphics/color.zig index d6aa850..5555c22 100644 --- a/src/sfml/graphics/color.zig +++ b/src/sfml/graphics/color.zig @@ -55,7 +55,7 @@ pub const Color = packed struct { } /// Creates a color with rgba floats from 0 to 1 - fn fromFloats(red: f32, green: f32, blue: f32, alpha: f32) Color { + pub fn fromFloats(red: f32, green: f32, blue: f32, alpha: f32) Color { return Color{ .r = @floatToInt(u8, math.clamp(red, 0.0, 1.0) * 255.0), .g = @floatToInt(u8, math.clamp(green, 0.0, 1.0) * 255.0), -- cgit v1.3.1