Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint32_t red_to_green(int val, bool for_text){
- const std::vector<uint32_t>& color_scale = for_text ? red_green_scale_text : red_green_scale;
- SDL_Color a = int_to_color(*color_scale.begin());
- SDL_Color b = int_to_color(*color_scale.end() - 1);
- val = std::max<int>(0, std::min<int>(val, 100));
- return
- (((a.r * val + b.r * (1 - val)) ) ) +
- (((a.g * val + b.g * (1 - val)) ) ) +
- (((a.b * val + b.b * (1 - val)) ) ) +
- SDL_ALPHA_OPAQUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement