Texture.h
Go to the documentation of this file.
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2015 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>
36 #include <SFML/System/Vector2.h>
37 #include <stddef.h>
38 
39 
49 CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int height);
50 
60 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);
61 
72 CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
73 
84 
95 
105 
113 
123 
133 
145 CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
146 
156 CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y);
157 
167 CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y);
168 
178 CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y);
179 
188 
198 
223 
233 
256 
266 
291 
304 CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
305 
327 CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);
328 
336 
337 
338 #endif // SFML_TEXTURE_H
#define CSFML_GRAPHICS_API
Definition: Rect.h:46
struct sfWindow sfWindow
Definition: Window/Types.h:30
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture *texture)
Tell whether a texture is repeated or not.
CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture *texture, sfBool repeated)
Enable or disable repeating for a texture.
CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize()
Get the maximum texture size allowed.
CSFML_GRAPHICS_API void sfTexture_destroy(sfTexture *texture)
Destroy an existing texture.
Set of callbacks that allow users to define custom file streams.
Definition: InputStream.h:44
int sfBool
Definition: Config.h:153
CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture *texture)
Get the underlying OpenGL handle of the texture.
CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture *texture, const sfWindow *window, unsigned int x, unsigned int y)
Update a texture from the contents of a window.
2-component vector of unsigned integers
Definition: Vector2.h:49
CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture *texture, const sfImage *image, unsigned int x, unsigned int y)
Update a texture from an image.
CSFML_GRAPHICS_API 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.
struct sfRenderWindow sfRenderWindow
CSFML_GRAPHICS_API sfImage * sfTexture_copyToImage(const sfTexture *texture)
Copy a texture&#39;s pixels to an image.
CSFML_GRAPHICS_API sfTexture * sfTexture_create(unsigned int width, unsigned int height)
Create a new texture.
CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture *texture)
Return the size of the texture.
struct sfImage sfImage
CSFML_GRAPHICS_API void sfTexture_setSrgb(sfTexture *texture, sfBool sRgb)
Enable or disable conversion from sRGB.
CSFML_GRAPHICS_API sfTexture * sfTexture_createFromImage(const sfImage *image, const sfIntRect *area)
Create a new texture from an image.
CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture *texture)
Generate a mipmap using the current texture data.
CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture *texture, const sfRenderWindow *renderWindow, unsigned int x, unsigned int y)
Update a texture from the contents of a render-window.
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture *texture)
Bind a texture for rendering.
CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture *texture, sfBool smooth)
Enable or disable the smooth filter on a texture.
CSFML_GRAPHICS_API sfTexture * sfTexture_createFromMemory(const void *data, size_t sizeInBytes, const sfIntRect *area)
Create a new texture from a file in memory.
CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture *texture)
Tell whether the texture source is converted from sRGB or not.
CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture *texture)
Tell whether the smooth filter is enabled or not for a texture.
unsigned char sfUint8
Definition: Config.h:168
struct sfTexture sfTexture
CSFML_GRAPHICS_API sfTexture * sfTexture_createFromFile(const char *filename, const sfIntRect *area)
Create a new texture from a file.
CSFML_GRAPHICS_API sfTexture * sfTexture_createFromStream(sfInputStream *stream, const sfIntRect *area)
Create a new texture from a custom stream.
CSFML_GRAPHICS_API sfTexture * sfTexture_copy(const sfTexture *texture)
Copy an existing texture.