1 // Copyright Timothy Goya 2007.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef UNISON_VIDEO_SDL_RENDERER_HPP
7 #define UNISON_VIDEO_SDL_RENDERER_HPP
9 #include <unison/video/backend/Renderer.hpp>
25 /// Does rendering tasks like blits and color fills using SDL
26 class Renderer : public Backend::Renderer
29 /// Default constructor
35 /// Initialize the backend
38 /// Cleanup the backend
41 /// Get the name of the renderer
42 /// \return the name of the renderer
43 std::string get_name();
45 /// Check if the backend is usable
46 /// \return Whether the backend is usable
49 Surface load_surface(const std::string &filename);
50 Surface load_surface(const std::string &filename, const Color &colorkey);
51 void save_surface(const Surface &surface, const std::string &filename);
53 /// Does a surface-to-surface blit
54 /// \param[in] src The source surface
55 /// \param[in] src_rect The part of the source surface to blit from
56 /// \param[in] dst The destination surface
57 /// \param[in] dst_pos The position to blit to
58 /// \param[in] options Extra blit options
59 void blit(const Surface &src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
61 /// Does a texture-to-surface blit
62 /// \param[in] src The source texture
63 /// \param[in] src_rect The part of the source texture to blit from
64 /// \param[in] dst The destination surface
65 /// \param[in] dst_pos The position to blit to
66 /// \param[in] options Extra blit options
67 void blit(Backend::Texture *src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
69 /// Fills a portion of a surface with the given color
70 /// \param[in] dst The destination surface
71 /// \param[in] color The color
72 /// \param[in] rect The portion to fill
73 void fill(Surface &dst, const Color &color, const Rect &rect);
75 /// Fills with alpha blend a portion of a surface with the given color
76 /// \param[in] dst The destination surface
77 /// \param[in] color The color
78 /// \param[in] rect The portion to fill
79 void fill_blend(Surface &dst, const Color &color, const Rect &rect);
82 /// \param[in] size The size of the window
83 /// \param[in] logical_size The logical size of the window
84 /// \param[in] fullscreen Whether to open in fullscreen mode
85 /// \return The created window
86 Backend::Window *create_window(const Area &size, const Area &logical_size, bool fullscreen);
88 /// Create a texture data for the given surface
89 /// \param[in] surface The surface to convert
90 /// \return The texture data for the surface
91 Backend::Texture *create_texture(const Surface &surface);