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#ifndef SFML_TEXTURE_H
26#define SFML_TEXTURE_H
27
29// Headers
32#include <SFML/Graphics/Rect.h>
33#include <SFML/Graphics/Types.h>
34#include <SFML/Window/Types.h>
36#include <SFML/System/Vector2.h>
37#include <stddef.h>
38
48
58CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int height);
59
70
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
128
139
150
161
171
179
189
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
272
282
295
318
328
353
362
376
399
407
408
409#endif // SFML_TEXTURE_H
int sfBool
Definition Config.h:153
unsigned char sfUint8
Definition Config.h:168
#define CSFML_GRAPHICS_API
struct sfRenderWindow sfRenderWindow
struct sfImage sfImage
struct sfTexture sfTexture
sfTexture * sfTexture_createSrgbFromImage(const sfImage *image, const sfIntRect *area)
Create a new sRGB-enabled texture from an image.
unsigned int sfTexture_getNativeHandle(const sfTexture *texture)
Get the underlying OpenGL handle of the texture.
sfTexture * sfTexture_create(unsigned int width, unsigned int height)
Create a new texture.
void sfTexture_swap(sfTexture *left, sfTexture *right)
Swap the contents of a texture with those of another.
void sfTexture_setRepeated(sfTexture *texture, sfBool repeated)
Enable or disable repeating for a texture.
void sfTexture_updateFromImage(sfTexture *texture, const sfImage *image, unsigned int x, unsigned int y)
Update a texture from an image.
sfTexture * sfTexture_copy(const sfTexture *texture)
Copy an existing texture.
sfBool sfTexture_isSrgb(const sfTexture *texture)
Tell whether the texture source is converted from sRGB or not.
sfBool sfTexture_isSmooth(const sfTexture *texture)
Tell whether the smooth filter is enabled or not for a texture.
sfTexture * sfTexture_createSrgbFromFile(const char *filename, const sfIntRect *area)
Create a new sRGB-enabled texture from a file.
void sfTexture_updateFromTexture(sfTexture *destination, const sfTexture *source, unsigned int x, unsigned int y)
Update a part of this texture from another texture.
sfBool sfTexture_generateMipmap(sfTexture *texture)
Generate a mipmap using the current texture data.
void sfTexture_updateFromRenderWindow(sfTexture *texture, const sfRenderWindow *renderWindow, unsigned int x, unsigned int y)
Update a texture from the contents of a render-window.
sfImage * sfTexture_copyToImage(const sfTexture *texture)
Copy a texture's pixels to an image.
sfTexture * sfTexture_createFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new texture from a custom stream.
void sfTexture_updateFromWindow(sfTexture *texture, const sfWindow *window, unsigned int x, unsigned int y)
Update a texture from the contents of a window.
void sfTexture_bind(const sfTexture *texture, sfTextureCoordinateType type)
Bind a texture for rendering.
sfBool sfTexture_isRepeated(const sfTexture *texture)
Tell whether a texture is repeated or not.
sfVector2u sfTexture_getSize(const sfTexture *texture)
Return the size of the texture.
sfTextureCoordinateType
Types of texture coordinates that can be used for rendering.
Definition Texture.h:44
@ sfTexturePixels
sfTexture coordinates in range [0 .. size].
Definition Texture.h:46
@ sfTextureNormalized
sfTexture coordinates in range [0 .. 1].
Definition Texture.h:45
sfTexture * sfTexture_createFromImage(const sfImage *image, const sfIntRect *area)
Create a new texture from an image.
sfTexture * sfTexture_createFromFile(const char *filename, const sfIntRect *area)
Create a new texture from a file.
unsigned int sfTexture_getMaximumSize(void)
Get the maximum texture size allowed.
sfTexture * sfTexture_createSrgbFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new sRGB-enabled texture from a custom stream.
void sfTexture_setSmooth(sfTexture *texture, sfBool smooth)
Enable or disable the smooth filter on a texture.
void sfTexture_destroy(sfTexture *texture)
Destroy an existing texture.
sfTexture * sfTexture_createFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new texture from a file in memory.
void sfTexture_updateFromPixels(sfTexture *texture, const sfUint8 *pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y)
Update a texture from an array of pixels.
sfTexture * sfTexture_createSrgbFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new sRGB-enabled texture from a file in memory.
struct sfWindow sfWindow
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