Texture.h
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2023 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#ifndef SFML_TEXTURE_H
26#define SFML_TEXTURE_H
27
29// Headers
31#include <SFML/Graphics/Export.h>
32#include <SFML/Graphics/Rect.h>
33#include <SFML/Graphics/Types.h>
34#include <SFML/Window/Types.h>
35#include <SFML/System/InputStream.h>
36#include <SFML/System/Vector2.h>
37#include <stddef.h>
38
43typedef enum
44{
45 sfTextureNormalized,
46 sfTexturePixels
47} sfTextureCoordinateType;
48
58CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int height);
59
69CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);
70
92CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromFile(const char* filename, const sfIntRect* area);
93
104CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
105
116CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
117
127CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area);
128
138CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect* area);
139
149CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);
150
160CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect* area);
161
170CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
171
178CSFML_GRAPHICS_API void sfTexture_destroy(sfTexture* texture);
179
188CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
189
198CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
199
211CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
212
229CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, unsigned int x, unsigned int y);
230
240CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y);
241
251CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y);
252
262CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y);
263
271CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);
272
281CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture);
282
294CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture* texture);
295
317CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeated);
318
327CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
328
352CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture);
353
361CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
362
375CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
376
398CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfTextureCoordinateType type);
399
406CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize(void);
407
408
409#endif // SFML_TEXTURE_H
Set of callbacks that allow users to define custom file streams.
Definition InputStream.h:45
2-component vector of unsigned integers
Definition Vector2.h:50