CSFML - C binding of the Simple and Fast Multimedia Library

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-2026 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
192 CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size);
193
205 CSFML_GRAPHICS_API bool sfTexture_resizeSrgb(sfTexture* texture, sfVector2u size);
206
215 CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
216
225 CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
226
236 CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset);
237
253 CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, sfVector2u offset);
254
263 CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, sfVector2u offset);
264
273 CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, sfVector2u offset);
274
283 CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, sfVector2u offset);
284
292 CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, bool smooth);
293
302 CSFML_GRAPHICS_API bool sfTexture_isSmooth(const sfTexture* texture);
303
315 CSFML_GRAPHICS_API bool sfTexture_isSrgb(const sfTexture* texture);
316
338 CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, bool repeated);
339
348 CSFML_GRAPHICS_API bool sfTexture_isRepeated(const sfTexture* texture);
349
373 CSFML_GRAPHICS_API bool sfTexture_generateMipmap(sfTexture* texture);
374
382 CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
383
396 CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
397
420 CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfCoordinateType type);
421
428 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_resize
bool sfTexture_resize(sfTexture *texture, sfVector2u size)
Resize the texture.
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_resizeSrgb
bool sfTexture_resizeSrgb(sfTexture *texture, sfVector2u size)
Resize the texture with sRGB-enabled.
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_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