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_OPENGL_RENDERER_HPP
7 #define UNISON_VIDEO_OPENGL_RENDERER_HPP
9 #include <unison/video/backend/Renderer.hpp>
26 /// Does rendering tasks like blits and color fills using OpenGL
27 class Renderer : public Backend::Renderer
30 /// Default constructor
36 /// Initialize the backend
39 /// Cleanup the backend
42 /// Get the name of the renderer
43 /// \return the name of the renderer
44 std::string get_name();
46 /// Check if the backend is usable
47 /// \return Whether the backend is usable
50 Surface load_surface(const std::string &filename);
51 Surface load_surface(const std::string &filename, const Color &colorkey);
52 void save_surface(const Surface &surface, const std::string &filename);
54 /// Does a surface-to-surface blit
55 /// \param[in] src The source surface
56 /// \param[in] src_rect The part of the source surface to blit from
57 /// \param[in] dst The destination surface
58 /// \param[in] dst_pos The position to blit to
59 /// \param[in] options Extra blit options
60 void blit(const Surface &src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
62 /// Does a texture-to-surface blit
63 /// \param[in] src The source texture
64 /// \param[in] src_rect The part of the source texture to blit from
65 /// \param[in] dst The destination surface
66 /// \param[in] dst_pos The position to blit to
67 /// \param[in] options Extra blit options
68 void blit(Backend::Texture *src, const Rect &src_rect, Surface &dst, const Point &dst_pos, const RenderOptions &options);
70 /// Fills a portion of a surface with the given color
71 /// \param[in] dst The destination surface
72 /// \param[in] color The color
73 /// \param[in] rect The portion to fill
74 void fill(Surface &dst, const Color &color, const Rect &rect);
76 /// Fills with alpha blend a portion of a surface with the given color
77 /// \param[in] dst The destination surface
78 /// \param[in] color The color
79 /// \param[in] rect The portion to fill
80 void fill_blend(Surface &dst, const Color &color, const Rect &rect);
83 /// \param[in] size The size of the window
84 /// \param[in] logical_size The logical size of the window
85 /// \param[in] fullscreen Whether to open in fullscreen mode
86 /// \return The created window
87 Backend::Window *create_window(const Area &size, const Area &logical_size, bool fullscreen);
89 /// Create a texture for the given surface
90 /// \param[in] surface The surface to convert
91 /// \return The texture for the surface
92 Backend::Texture *create_texture(const Surface &surface);