114 explicit
Texture(const std::filesystem::path& filename,
bool sRgb = false);
154 Texture(const
void* data, std::
size_t size,
bool sRgb = false);
304 [[nodiscard]]
bool loadFromFile(const std::filesystem::path& filename,
bool sRgb = false, const
IntRect& area = {});
732 [[nodiscard]]
static unsigned int getValidSize(
unsigned int size);
741 void invalidateMipmap();
748 unsigned int m_texture{};
752 mutable bool m_pixelsFlipped{};
753 bool m_fboAttachment{};
755 std::uint64_t m_cacheId;
#define SFML_GRAPHICS_API
Definition Export.hpp:42
GlResource()
Default constructor.
Class for loading, manipulating and saving images.
Definition Image.hpp:55
Image living on the graphics card that can be used for drawing.
Definition Texture.hpp:56
void update(const Image &image)
Update the texture from an image.
static unsigned int getMaximumSize()
Get the maximum texture size allowed.
void setSmooth(bool smooth)
Enable or disable the smooth filter.
friend class RenderTexture
Definition Texture.hpp:716
static void bind(const Texture *texture, CoordinateType coordinateType=CoordinateType::Normalized)
Bind a texture for rendering.
Texture()
Default constructor.
bool isSmooth() const
Tell whether the smooth filter is enabled or not.
void update(const std::uint8_t *pixels, Vector2u size, Vector2u dest)
Update a part of the texture from an array of pixels.
void update(const Texture &texture, Vector2u dest)
Update a part of this texture from another texture.
Texture(const Texture ©)
Copy constructor.
Texture & operator=(const Texture &)
Copy assignment operator.
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the texture.
bool loadFromStream(InputStream &stream, bool sRgb=false, const IntRect &area={})
Load the texture from a custom stream.
bool generateMipmap()
Generate a mipmap using the current texture data.
Image copyToImage() const
Copy the texture pixels to an image.
Texture(Texture &&) noexcept
Move constructor.
bool loadFromFile(const std::filesystem::path &filename, bool sRgb=false, const IntRect &area={})
Load the texture from a file on disk.
bool isSrgb() const
Tell whether the texture source is converted from sRGB or not.
Vector2u getSize() const
Return the size of the texture.
void swap(Texture &right) noexcept
Swap the contents of this texture with those of another.
bool loadFromMemory(const void *data, std::size_t size, bool sRgb=false, const IntRect &area={})
Load the texture from a file in memory.
friend class RenderTarget
Definition Texture.hpp:717
void setRepeated(bool repeated)
Enable or disable repeating.
void update(const Window &window, Vector2u dest)
Update a part of the texture from the contents of a window.
void update(const Image &image, Vector2u dest)
Update a part of the texture from an image.
void update(const Window &window)
Update the texture from the contents of a window.
void update(const std::uint8_t *pixels)
Update the whole texture from an array of pixels.
friend class Text
Definition Texture.hpp:715
bool loadFromImage(const Image &image, bool sRgb=false, const IntRect &area={})
Load the texture from an image.
bool isRepeated() const
Tell whether the texture is repeated or not.
void update(const Texture &texture)
Update a part of this texture from another texture.
bool resize(Vector2u size, bool sRgb=false)
Resize the texture.
Window that serves as a target for OpenGL rendering.
Definition Window.hpp:56
Definition BlendMode.hpp:34
SFML_GRAPHICS_API void swap(Texture &left, Texture &right) noexcept
Swap the contents of one texture with those of another.
CoordinateType
Types of texture coordinates that can be used for rendering.
Definition CoordinateType.hpp:38
@ Normalized
Texture coordinates in range [0 .. 1].
Definition CoordinateType.hpp:39
Vector2< unsigned int > Vector2u
Definition Vector2.hpp:225
Rect< int > IntRect
Definition Rect.hpp:153