MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / AverageColour

Function AverageColour

LibLemon/src/gfx/graphics.cpp:51–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 }
50
51 rgba_colour_t AverageColour(rgba_colour_t c1, rgba_colour_t c2){
52 int r = static_cast<int>(c1.r) + c2.r;
53 int g = static_cast<int>(c1.g) + c2.g;
54 int b = static_cast<int>(c1.b) + c2.b;
55 int a = static_cast<int>(c1.a) + c2.a;
56
57 return {static_cast<uint8_t>(r / 2), static_cast<uint8_t>(g / 2), static_cast<uint8_t>(b / 2), static_cast<uint8_t>(a / 2)};
58 }
59
60 void DrawRect(rect_t rect, rgba_colour_t colour, surface_t* surface, rect_t mask){
61 DrawRect(rect.pos.x, rect.pos.y, rect.size.x, rect.size.y, colour, surface, mask);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected