The Battle for Wesnoth  1.17.4+dev
Classes | Typedefs | Functions
render_utils.hpp File Reference
#include "sdl/rect.hpp"
#include "sdl/texture.hpp"
#include "video.hpp"
#include <SDL2/SDL_rect.h>
#include <SDL2/SDL_render.h>
#include <cassert>
#include <functional>
Include dependency graph for render_utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  render_target_setter
 Sets the renderer output target to the specified texture. More...
class  render_raii_rect_setter_base< G, S >
 Base class for renderer RAII helpers that operate on SDL_Rects. More...


using sdl_rect_getter = void(*)(SDL_Renderer *, SDL_Rect *)
using sdl_rect_setter = int(*)(SDL_Renderer *, const SDL_Rect *)
using render_clip_rect_setter = render_raii_rect_setter_base< &SDL_RenderGetClipRect, &SDL_RenderSetClipRect >
 Sets the renderer clip rect. More...
using render_viewport_setter = render_raii_rect_setter_base< &SDL_RenderGetViewport, &SDL_RenderSetViewport >
 Sets the renderer viewport rect. More...


void set_draw_color (SDL_Renderer *renderer, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 Set renderer drawing color. More...
void set_draw_color (SDL_Renderer *renderer, color_t color)
 Set renderer drawing color. More...
void set_texture_alpha (texture &t, uint8_t amount)
void set_texture_blend_color (texture &t, uint8_t r, uint8_t g, uint8_t b)
void set_texture_blend_mode (texture &t, SDL_BlendMode mode)
void set_texture_scale_quality (const std::string &value)
 Sets the texture scale quality. More...

Typedef Documentation

◆ render_clip_rect_setter

using render_clip_rect_setter = render_raii_rect_setter_base< &SDL_RenderGetClipRect, &SDL_RenderSetClipRect>

Sets the renderer clip rect.

Definition at line 105 of file render_utils.hpp.

◆ render_viewport_setter

using render_viewport_setter = render_raii_rect_setter_base< &SDL_RenderGetViewport, &SDL_RenderSetViewport>

Sets the renderer viewport rect.

Definition at line 112 of file render_utils.hpp.

◆ sdl_rect_getter

using sdl_rect_getter = void (*)(SDL_Renderer*, SDL_Rect*)

Definition at line 58 of file render_utils.hpp.

◆ sdl_rect_setter

using sdl_rect_setter = int (*)(SDL_Renderer*, const SDL_Rect*)

Definition at line 59 of file render_utils.hpp.

Function Documentation

◆ set_draw_color() [1/2]

void set_draw_color ( SDL_Renderer *  renderer,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a 

Set renderer drawing color.

Definition at line 118 of file render_utils.hpp.

Referenced by set_draw_color().

◆ set_draw_color() [2/2]

void set_draw_color ( SDL_Renderer *  renderer,
color_t  color 

Set renderer drawing color.

Definition at line 126 of file render_utils.hpp.

References color_t::a, color_t::b, color_t::g, color_t::r, and set_draw_color().

◆ set_texture_alpha()

void set_texture_alpha ( texture t,
uint8_t  amount 

Definition at line 136 of file render_utils.hpp.

◆ set_texture_blend_color()

void set_texture_blend_color ( texture t,
uint8_t  r,
uint8_t  g,
uint8_t  b 

Definition at line 141 of file render_utils.hpp.

◆ set_texture_blend_mode()

void set_texture_blend_mode ( texture t,
SDL_BlendMode  mode 

Definition at line 146 of file render_utils.hpp.

Referenced by texture::finalize().

◆ set_texture_scale_quality()

void set_texture_scale_quality ( const std::string &  value)

Sets the texture scale quality.

Note this should be called before a texture is created, since the hint has no effect on existing textures or render ops.

valueThe scaling mode. Use either 'linear' or 'nearest'.

Definition at line 157 of file render_utils.hpp.