CSFML 3.0.0
Loading...
Searching...
No Matches
Texture.h
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
30#include <CSFML/Graphics/Export.h>
31
32#include <CSFML/Graphics/CoordinateType.h>
33#include <CSFML/Graphics/Rect.h>
34#include <CSFML/Graphics/Types.h>
35#include <CSFML/System/InputStream.h>
36#include <CSFML/System/Vector2.h>
37#include <CSFML/Window/Types.h>
38
39#include <stddef.h>
40
49 CSFML_GRAPHICS_API sfTexture* sfTexture_create(sfVector2u size);
50
59 CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgb(sfVector2u size);
60
70 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);
71
93 CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromFile(const char* filename, const sfIntRect* area);
94
105 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
106
117 CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
118
128 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area);
129
139 CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect* area);
140
150 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);
151
161 CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect* area);
162
171 CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
172
179 CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
180
193 CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb);
194
203 CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
204
213 CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
214
224 CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset);
225
241 CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, sfVector2u offset);
242
251 CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, sfVector2u offset);
252
261 CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, sfVector2u offset);
262
271 CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, sfVector2u offset);
272
280 CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, bool smooth);
281
290 CSFML_GRAPHICS_API bool sfTexture_isSmooth(const sfTexture* texture);
291
303 CSFML_GRAPHICS_API bool sfTexture_isSrgb(const sfTexture* texture);
304
326 CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, bool repeated);
327
336 CSFML_GRAPHICS_API bool sfTexture_isRepeated(const sfTexture* texture);
337
361 CSFML_GRAPHICS_API bool sfTexture_generateMipmap(sfTexture* texture);
362
370 CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
371
384 CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
385
408 CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfCoordinateType type);
409
416 CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize(void);
CoordinateType.h
sfCoordinateType
sfCoordinateType
Types of texture coordinates that can be used for rendering.
Definition CoordinateType.h:32
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:42
Types.h
sfRenderWindow
struct sfRenderWindow sfRenderWindow
Definition Graphics/Types.h:35
sfImage
struct sfImage sfImage
Definition Graphics/Types.h:31
sfTexture
struct sfTexture sfTexture
Definition Graphics/Types.h:39
InputStream.h
Rect.h
sfTexture_destroy
void sfTexture_destroy(const sfTexture *texture)
Destroy an existing texture.
sfTexture_createSrgbFromImage
sfTexture * sfTexture_createSrgbFromImage(const sfImage *image, const sfIntRect *area)
Create a new sRGB-enabled texture from an image.
sfTexture_updateFromImage
void sfTexture_updateFromImage(sfTexture *texture, const sfImage *image, sfVector2u offset)
Update a texture from an image.
sfTexture_getNativeHandle
unsigned int sfTexture_getNativeHandle(const sfTexture *texture)
Get the underlying OpenGL handle of the texture.
sfTexture_updateFromPixels
void sfTexture_updateFromPixels(sfTexture *texture, const uint8_t *pixels, sfVector2u size, sfVector2u offset)
Update a texture from an array of pixels.
sfTexture_swap
void sfTexture_swap(sfTexture *left, sfTexture *right)
Swap the contents of a texture with those of another.
sfTexture_copy
sfTexture * sfTexture_copy(const sfTexture *texture)
Copy an existing texture.
sfTexture_create
sfTexture * sfTexture_create(sfVector2u size)
Create a new texture.
sfTexture_setRepeated
void sfTexture_setRepeated(sfTexture *texture, bool repeated)
Enable or disable repeating for a texture.
sfTexture_createSrgbFromFile
sfTexture * sfTexture_createSrgbFromFile(const char *filename, const sfIntRect *area)
Create a new sRGB-enabled texture from a file.
sfTexture_updateFromWindow
void sfTexture_updateFromWindow(sfTexture *texture, const sfWindow *window, sfVector2u offset)
Update a texture from the contents of a window.
sfTexture_copyToImage
sfImage * sfTexture_copyToImage(const sfTexture *texture)
Copy a texture's pixels to an image.
sfTexture_isSmooth
bool sfTexture_isSmooth(const sfTexture *texture)
Tell whether the smooth filter is enabled or not for a texture.
sfTexture_createFromStream
sfTexture * sfTexture_createFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new texture from a custom stream.
sfTexture_isSrgb
bool sfTexture_isSrgb(const sfTexture *texture)
Tell whether the texture source is converted from sRGB or not.
sfTexture_setSmooth
void sfTexture_setSmooth(sfTexture *texture, bool smooth)
Enable or disable the smooth filter on a texture.
sfTexture_isRepeated
bool sfTexture_isRepeated(const sfTexture *texture)
Tell whether a texture is repeated or not.
sfTexture_getSize
sfVector2u sfTexture_getSize(const sfTexture *texture)
Return the size of the texture.
sfTexture_updateFromRenderWindow
void sfTexture_updateFromRenderWindow(sfTexture *texture, const sfRenderWindow *renderWindow, sfVector2u offset)
Update a texture from the contents of a render-window.
sfTexture_generateMipmap
bool sfTexture_generateMipmap(sfTexture *texture)
Generate a mipmap using the current texture data.
sfTexture_createFromImage
sfTexture * sfTexture_createFromImage(const sfImage *image, const sfIntRect *area)
Create a new texture from an image.
sfTexture_createFromFile
sfTexture * sfTexture_createFromFile(const char *filename, const sfIntRect *area)
Create a new texture from a file.
sfTexture_bind
void sfTexture_bind(const sfTexture *texture, sfCoordinateType type)
Bind a texture for rendering.
sfTexture_getMaximumSize
unsigned int sfTexture_getMaximumSize(void)
Get the maximum texture size allowed.
sfTexture_createSrgbFromStream
sfTexture * sfTexture_createSrgbFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new sRGB-enabled texture from a custom stream.
sfTexture_resize
bool sfTexture_resize(sfTexture *texture, sfVector2u size, bool sRgb)
Resize the texture.
sfTexture_updateFromTexture
void sfTexture_updateFromTexture(sfTexture *destination, const sfTexture *source, sfVector2u offset)
Update a part of this texture from another texture.
sfTexture_createFromMemory
sfTexture * sfTexture_createFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new texture from a file in memory.
sfTexture_createSrgb
sfTexture * sfTexture_createSrgb(sfVector2u size)
Create a new sRGB-enabled texture.
sfTexture_createSrgbFromMemory
sfTexture * sfTexture_createSrgbFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new sRGB-enabled texture from a file in memory.
Vector2.h
Types.h
sfWindow
struct sfWindow sfWindow
Definition Window/Types.h:30
sfInputStream
Set of callbacks that allow users to define custom file streams.
Definition InputStream.h:46
sfIntRect
Definition Rect.h:46
sfVector2u
2-component vector of unsigned integers
Definition Vector2.h:49