Loading...
Searching...
No Matches
RenderTexture.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
31
34
36
38
39#include <memory>
40
41
42namespace sf
43{
44namespace priv
45{
46class RenderTextureImpl;
47}
48
54{
55public:
65
83 RenderTexture(Vector2u size, const ContextSettings& settings = {});
84
89 ~RenderTexture() override;
90
95 RenderTexture(const RenderTexture&) = delete;
96
102
108
113 RenderTexture& operator=(RenderTexture&&) noexcept;
114
132 [[nodiscard]] bool resize(Vector2u size, const ContextSettings& settings = {});
133
140 [[nodiscard]] static unsigned int getMaximumAntiAliasingLevel();
141
153 void setSmooth(bool smooth);
154
163 [[nodiscard]] bool isSmooth() const;
164
176 void setRepeated(bool repeated);
177
186 [[nodiscard]] bool isRepeated() const;
187
202 [[nodiscard]] bool generateMipmap();
203
219 [[nodiscard]] bool setActive(bool active = true) override;
220
230 void display();
231
241 [[nodiscard]] Vector2u getSize() const override;
242
252 [[nodiscard]] bool isSrgb() const override;
253
268 [[nodiscard]] const Texture& getTexture() const;
269
270private:
272 // Member data
274 std::unique_ptr<priv::RenderTextureImpl> m_impl;
275 Texture m_texture;
276};
277
278} // namespace sf
279
280
#define SFML_GRAPHICS_API
Base class for all render targets (window, texture, ...)
Target for off-screen 2D rendering into a texture.
RenderTexture()
Default constructor.
RenderTexture & operator=(const RenderTexture &)=delete
Deleted copy assignment.
bool setActive(bool active=true) override
Activate or deactivate the render-texture for rendering.
~RenderTexture() override
Destructor.
RenderTexture(RenderTexture &&) noexcept
Move constructor.
bool isSmooth() const
Tell whether the smooth filtering is enabled or not.
const Texture & getTexture() const
Get a read-only reference to the target texture.
RenderTexture(const RenderTexture &)=delete
Deleted copy constructor.
Vector2u getSize() const override
Return the size of the rendering region of the texture.
bool isRepeated() const
Tell whether the texture is repeated or not.
bool generateMipmap()
Generate a mipmap using the current texture data.
static unsigned int getMaximumAntiAliasingLevel()
Get the maximum anti-aliasing level supported by the system.
RenderTexture(Vector2u size, const ContextSettings &settings={})
Construct a render-texture.
bool isSrgb() const override
Tell if the render-texture will use sRGB encoding when drawing on it.
void setSmooth(bool smooth)
Enable or disable texture smoothing.
void setRepeated(bool repeated)
Enable or disable texture repeating.
void display()
Update the contents of the target texture.
Image living on the graphics card that can be used for drawing.
Definition Texture.hpp:56
Structure defining the settings of the OpenGL context attached to a window.