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
31
33#include <CSFML/Graphics/Rect.h>
37#include <CSFML/Window/Types.h>
38
39#include <stddef.h>
40
50
60
71
94
105CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
106
117CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
118
129
140
151
162
172
180
190
200
210CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset);
211
228
238
248
258
267
277
290
313
323
348
357
371
395
sfCoordinateType
Types of texture coordinates that can be used for rendering.
#define CSFML_GRAPHICS_API
struct sfRenderWindow sfRenderWindow
struct sfImage sfImage
struct sfTexture sfTexture
void sfTexture_destroy(const sfTexture *texture)
Destroy an existing texture.
sfTexture * sfTexture_createSrgbFromImage(const sfImage *image, const sfIntRect *area)
Create a new sRGB-enabled texture from an image.
void sfTexture_updateFromImage(sfTexture *texture, const sfImage *image, sfVector2u offset)
Update a texture from an image.
unsigned int sfTexture_getNativeHandle(const sfTexture *texture)
Get the underlying OpenGL handle of the texture.
void sfTexture_updateFromPixels(sfTexture *texture, const uint8_t *pixels, sfVector2u size, sfVector2u offset)
Update a texture from an array of pixels.
void sfTexture_swap(sfTexture *left, sfTexture *right)
Swap the contents of a texture with those of another.
sfTexture * sfTexture_copy(const sfTexture *texture)
Copy an existing texture.
sfTexture * sfTexture_create(sfVector2u size)
Create a new texture.
void sfTexture_setRepeated(sfTexture *texture, bool repeated)
Enable or disable repeating for a texture.
sfTexture * sfTexture_createSrgbFromFile(const char *filename, const sfIntRect *area)
Create a new sRGB-enabled texture from a file.
void sfTexture_updateFromWindow(sfTexture *texture, const sfWindow *window, sfVector2u offset)
Update a texture from the contents of a window.
sfImage * sfTexture_copyToImage(const sfTexture *texture)
Copy a texture's pixels to an image.
bool sfTexture_isSmooth(const sfTexture *texture)
Tell whether the smooth filter is enabled or not for a texture.
sfTexture * sfTexture_createFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new texture from a custom stream.
bool sfTexture_isSrgb(const sfTexture *texture)
Tell whether the texture source is converted from sRGB or not.
void sfTexture_setSmooth(sfTexture *texture, bool smooth)
Enable or disable the smooth filter on a texture.
bool 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.
void sfTexture_updateFromRenderWindow(sfTexture *texture, const sfRenderWindow *renderWindow, sfVector2u offset)
Update a texture from the contents of a render-window.
bool sfTexture_generateMipmap(sfTexture *texture)
Generate a mipmap using the current texture data.
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.
void sfTexture_bind(const sfTexture *texture, sfCoordinateType type)
Bind a texture for rendering.
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_updateFromTexture(sfTexture *destination, const sfTexture *source, sfVector2u offset)
Update a part of this texture from another texture.
sfTexture * sfTexture_createFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new texture from a file in memory.
sfTexture * sfTexture_createSrgb(sfVector2u size)
Create a new sRGB-enabled texture.
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:46
2-component vector of unsigned integers
Definition Vector2.h:49