Added sfTexture, renamed sfRenderImage to sfRenderTexture, removed sfSprite_GetPixel, added sfImage_FlipHorizontally and sfImage_FlipVertically

This commit is contained in:
Laurent Gomila committed 2011-08-06 14:50:14 +02:00
1 parent 29663b351d
commit f4eda513af
22 files changed
+1032 -530

No files matched your search

+2 -1
View File
@@ -35,11 +35,12 @@
#include <SFML/Graphics/Image.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/RenderImage.h>
#include <SFML/Graphics/RenderTexture.h>
#include <SFML/Graphics/Shader.h>
#include <SFML/Graphics/Shape.h>
#include <SFML/Graphics/Sprite.h>
#include <SFML/Graphics/Text.h>
#include <SFML/Graphics/Texture.h>
#include <SFML/Graphics/View.h>
+3 -3
View File
@@ -122,15 +122,15 @@ CSFML_API int sfFont_GetKerning(sfFont* font, sfUint32 first, sfUint32 second, u
CSFML_API int sfFont_GetLineSpacing(sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// Get the image containing the glyphs of a given size in a font
/// Get the texture containing the glyphs of a given size in a font
///
/// \param font : Source font
/// \param characterSize : Character size, in pixels
///
/// \return Read-only pointer to the image
/// \return Read-only pointer to the texture
///
////////////////////////////////////////////////////////////
CSFML_API const sfImage* sfFont_GetImage(sfFont* font, unsigned int characterSize);
CSFML_API const sfTexture* sfFont_GetTexture(sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// Get the built-in default font (Arial)
+11 -50
View File
@@ -144,19 +144,6 @@ CSFML_API void sfImage_CreateMaskFromColor(sfImage* image, sfColor colorKey, sfU
////////////////////////////////////////////////////////////
CSFML_API void sfImage_CopyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect);
////////////////////////////////////////////////////////////
/// Create the image from the current contents of the
/// given window
///
/// \param image : Destination image
/// \param window : Window to capture
/// \param sourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)
///
/// \return True if creation was successful
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfImage_CopyScreen(sfImage* image, sfRenderWindow* window, sfIntRect sourceRect);
////////////////////////////////////////////////////////////
/// Change the color of a pixel of an image
///
@@ -192,38 +179,6 @@ CSFML_API sfColor sfImage_GetPixel(const sfImage* image, unsigned int x, unsigne
////////////////////////////////////////////////////////////
CSFML_API const sfUint8* sfImage_GetPixelsPtr(const sfImage* image);
////////////////////////////////////////////////////////////
/// Update a sub-rectangle of the image from an array of pixels
///
/// Warning: for performances reasons, this function doesn't
/// perform any check; thus you're responsible of ensuring that
/// \a rectangle does not exceed the image size, and that
/// \a pixels contains enough elements.
///
/// \param image : Image to update
/// \param rectangle : Sub-rectangle of the image to update
/// \param pixels : Array of pixels to write to the image
///
////////////////////////////////////////////////////////////
CSFML_API void sfImage_UpdatePixels(const sfImage* image, const sfUint8* pixels, sfIntRect rectangle);
////////////////////////////////////////////////////////////
/// Bind the image for rendering
///
/// \param image : Image to bind
///
////////////////////////////////////////////////////////////
CSFML_API void sfImage_Bind(const sfImage* image);
////////////////////////////////////////////////////////////
/// Enable or disable image smooth filter
///
/// \param image : Image to modify
/// \param smooth : sfTrue to enable smoothing filter, false to disable it
///
////////////////////////////////////////////////////////////
CSFML_API void sfImage_SetSmooth(sfImage* image, sfBool smooth);
////////////////////////////////////////////////////////////
/// Return the width of the image
///
@@ -245,14 +200,20 @@ CSFML_API unsigned int sfImage_GetWidth(const sfImage* image);
CSFML_API unsigned int sfImage_GetHeight(const sfImage* image);
////////////////////////////////////////////////////////////
/// Tells whether the smoothing filter is enabled or not on an image
/// Flip an image horizontally (left <-> right)
///
/// \param image : Image to read
///
/// \return sfTrue if the smoothing filter is enabled
/// \param image : Image to flip
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfImage_IsSmooth(const sfImage* image);
CSFML_API void sfImage_FlipHorizontally(sfImage* image);
////////////////////////////////////////////////////////////
/// Flip an image vertically (top <-> bottom)
///
/// \param image : Image to flip
///
////////////////////////////////////////////////////////////
CSFML_API void sfImage_FlipVertically(sfImage* image);
#endif // SFML_IMAGE_H
@@ -22,8 +22,8 @@
//
////////////////////////////////////////////////////////////
#ifndef SFML_RENDERIMAGE_H
#define SFML_RENDERIMAGE_H
#ifndef SFML_RENDERTEXTURE_H
#define SFML_RENDERTEXTURE_H
////////////////////////////////////////////////////////////
// Headers
@@ -35,53 +35,53 @@
////////////////////////////////////////////////////////////
/// Construct a new renderimage
/// Construct a new rendertexture
///
/// \param width : Width of the renderimage
/// \param height : Height of the renderimage
/// \param depthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the renderimage)
/// \param width : Width of the rendertexture
/// \param height : Height of the rendertexture
/// \param depthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture)
///
////////////////////////////////////////////////////////////
CSFML_API sfRenderImage* sfRenderImage_Create(unsigned int width, unsigned int height, sfBool depthBuffer);
CSFML_API sfRenderTexture* sfRenderTexture_Create(unsigned int width, unsigned int height, sfBool depthBuffer);
////////////////////////////////////////////////////////////
/// Destroy an existing renderimage
/// Destroy an existing rendertexture
///
/// \param renderImage : renderimage to destroy
/// \param renderTexture : rendertexture to destroy
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_Destroy(sfRenderImage* renderImage);
CSFML_API void sfRenderTexture_Destroy(sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Get the width of the rendering region of a renderimage
/// Get the width of the rendering region of a rendertexture
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Rendertexture object
///
/// \return Width in pixels
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfRenderImage_GetWidth(const sfRenderImage* renderImage);
CSFML_API unsigned int sfRenderTexture_GetWidth(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Get the height of the rendering region of a renderimage
/// Get the height of the rendering region of a rendertexture
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Rendertexture object
///
/// \return Height in pixels
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfRenderImage_GetHeight(const sfRenderImage* renderImage);
CSFML_API unsigned int sfRenderTexture_GetHeight(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Activate or deactivate a renderimage as the current target for rendering
/// Activate or deactivate a rendertexture as the current target for rendering
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Rendertexture object
/// \param active : sfTrue to activate, sfFalse to deactivate
///
/// \return True if operation was successful, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfRenderImage_SetActive(sfRenderImage* renderImage, sfBool active);
CSFML_API sfBool sfRenderTexture_SetActive(sfRenderTexture* renderTexture, sfBool active);
////////////////////////////////////////////////////////////
/// Save the current OpenGL render states and matrices
@@ -89,7 +89,7 @@ CSFML_API sfBool sfRenderImage_SetActive(sfRenderImage* renderImage, sfBool acti
/// \param renderWindow : Renderwindow object
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_SaveGLStates(sfRenderImage* renderImage);
CSFML_API void sfRenderTexture_SaveGLStates(sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Restore the previously saved OpenGL render states and matrices
@@ -97,110 +97,110 @@ CSFML_API void sfRenderImage_SaveGLStates(sfRenderImage* renderImage);
/// \param renderWindow : Renderwindow object
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_RestoreGLStates(sfRenderImage* renderImage);
CSFML_API void sfRenderTexture_RestoreGLStates(sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Update the contents of the target image
/// Update the contents of the target texture
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Rendertexture object
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_Display(sfRenderImage* renderImage);
CSFML_API void sfRenderTexture_Display(sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Draw something on a renderimage
/// Draw something on a rendertexture
///
/// \param renderImage : Renderimage to draw in
/// \param renderTexture : Rendertexture to draw in
/// \param sprite / text / shape : Object to draw
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* renderImage, const sfSprite* sprite);
CSFML_API void sfRenderImage_DrawShape (sfRenderImage* renderImage, const sfShape* shape);
CSFML_API void sfRenderImage_DrawText (sfRenderImage* renderImage, const sfText* text);
CSFML_API void sfRenderTexture_DrawSprite(sfRenderTexture* renderTexture, const sfSprite* sprite);
CSFML_API void sfRenderTexture_DrawShape (sfRenderTexture* renderTexture, const sfShape* shape);
CSFML_API void sfRenderTexture_DrawText (sfRenderTexture* renderTexture, const sfText* text);
////////////////////////////////////////////////////////////
/// Draw something on a renderimage with a shader
/// Draw something on a rendertexture with a shader
///
/// \param renderImage : Renderimage to draw in
/// \param renderTexture : Rendertexture to draw in
/// \param sprite / text / shape : Object to draw
/// \param shader : Shader to use
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, const sfSprite* sprite, const sfShader* shader);
CSFML_API void sfRenderImage_DrawShapeWithShader (sfRenderImage* renderImage, const sfShape* shape, const sfShader* shader);
CSFML_API void sfRenderImage_DrawTextWithShader (sfRenderImage* renderImage, const sfText* text, const sfShader* shader);
CSFML_API void sfRenderTexture_DrawSpriteWithShader(sfRenderTexture* renderTexture, const sfSprite* sprite, const sfShader* shader);
CSFML_API void sfRenderTexture_DrawShapeWithShader (sfRenderTexture* renderTexture, const sfShape* shape, const sfShader* shader);
CSFML_API void sfRenderTexture_DrawTextWithShader (sfRenderTexture* renderTexture, const sfText* text, const sfShader* shader);
////////////////////////////////////////////////////////////
/// Clear the renderimage with the given color
/// Clear the rendertexture with the given color
///
/// \param renderImage : Renderimage to modify
/// \param renderTexture : Rendertexture to modify
/// \param color : Fill color
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_Clear(sfRenderImage* renderImage, sfColor color);
CSFML_API void sfRenderTexture_Clear(sfRenderTexture* renderTexture, sfColor color);
////////////////////////////////////////////////////////////
/// Change the current active view of a renderimage
/// Change the current active view of a rendertexture
///
/// \param renderImage : Renderimage to modify
/// \param renderTexture : Rendertexture to modify
/// \param view : Pointer to the new view
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_SetView(sfRenderImage* renderImage, const sfView* view);
CSFML_API void sfRenderTexture_SetView(sfRenderTexture* renderTexture, const sfView* view);
////////////////////////////////////////////////////////////
/// Get the current active view of a renderimage
/// Get the current active view of a rendertexture
///
/// \param renderImage : Renderimage
/// \param renderTexture : Rendertexture
///
/// \return Current active view
///
////////////////////////////////////////////////////////////
CSFML_API const sfView* sfRenderImage_GetView(const sfRenderImage* renderImage);
CSFML_API const sfView* sfRenderTexture_GetView(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Get the default view of a renderimage
/// Get the default view of a rendertexture
///
/// \param renderImage : Renderimage
/// \param renderTexture : Rendertexture
///
/// \return Default view of the renderimage
/// \return Default view of the rendertexture
///
////////////////////////////////////////////////////////////
CSFML_API const sfView* sfRenderImage_GetDefaultView(const sfRenderImage* renderImage);
CSFML_API const sfView* sfRenderTexture_GetDefaultView(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// Get the viewport of a view applied to this target
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Rendertexture object
/// \param view : Target view
///
/// \return Viewport rectangle, expressed in pixels in the current target
///
////////////////////////////////////////////////////////////
CSFML_API sfIntRect sfRenderImage_GetViewport(const sfRenderImage* renderImage, const sfView* view);
CSFML_API sfIntRect sfRenderTexture_GetViewport(const sfRenderTexture* renderTexture, const sfView* view);
////////////////////////////////////////////////////////////
/// Convert a point in image coordinates into view coordinates
/// Convert a point in texture coordinates into view coordinates
///
/// \param renderImage : Renderimage object
/// \param windowX : X coordinate of the point to convert, relative to the image
/// \param windowY : Y coordinate of the point to convert, relative to the image
/// \param renderTexture : Rendertexture object
/// \param windowX : X coordinate of the point to convert, relative to the texture
/// \param windowY : Y coordinate of the point to convert, relative to the texture
/// \param viewX : Pointer to fill with the X coordinate of the converted point
/// \param viewY : Pointer to fill with the Y coordinate of the converted point
/// \param targetView : Target view to convert the point to (pass NULL to use the current view)
///
////////////////////////////////////////////////////////////
CSFML_API void sfRenderImage_ConvertCoords(const sfRenderImage* renderImage, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
CSFML_API void sfRenderTexture_ConvertCoords(const sfRenderTexture* renderTexture, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
////////////////////////////////////////////////////////////
/// Get the target image
/// Get the target texture
///
/// \param renderImage : Renderimage object
/// \param renderTexture : Render-texture object
///
/// \return Pointer to the target image
/// \return Pointer to the target texture
///
////////////////////////////////////////////////////////////
CSFML_API const sfImage* sfRenderImage_GetImage(const sfRenderImage* renderImage);
CSFML_API const sfTexture* sfRenderTexture_GetTexture(const sfRenderTexture* renderTexture);
#endif // SFML_RENDERIMAGE_H
#endif // SFML_RENDERTEXTURE_H
+18
View File
@@ -371,5 +371,23 @@ CSFML_API sfIntRect sfRenderWindow_GetViewport(const sfRenderWindow* renderWindo
////////////////////////////////////////////////////////////
CSFML_API void sfRenderWindow_ConvertCoords(const sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
////////////////////////////////////////////////////////////
/// Copy the current contents of a window to an image
///
/// This is a slow operation, whose main purpose is to make
/// screenshots of the application. If you want to update an
/// image with the contents of the window and then use it for
/// drawing, you should rather use a sfTexture and its
/// Update(sfWindow*) function.
/// You can also draw things directly to a texture with the
/// sfRenderTexture class.
///
/// \param renderWindow : Render window to capture
///
/// \return New image containing the captured contents
///
////////////////////////////////////////////////////////////
sfImage* sfRenderWindow_Capture(const sfRenderWindow* renderWindow);
#endif // SFML_RENDERWINDOW_H
+2 -2
View File
@@ -126,10 +126,10 @@ CSFML_API void sfShader_SetParameter4(sfShader* shader, const char* name, float
///
/// \param shader : Shader to modify
/// \param name : Texture name in the effect
/// \param texture : Image to set
/// \param texture : Texture to set
///
////////////////////////////////////////////////////////////
CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture);
CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Set the current texture parameter in a shader
+7 -19
View File
@@ -301,14 +301,14 @@ CSFML_API void sfSprite_TransformToLocal(const sfSprite* sprite, float pointX, f
CSFML_API void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, float pointY, float* x, float* y);
////////////////////////////////////////////////////////////
/// Change the image of a sprite
/// Change the texture of a sprite
///
/// \param sprite : Sprite to modify
/// \param image : New image
/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new image
/// \param texture : New texture
/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new texture
///
////////////////////////////////////////////////////////////
CSFML_API void sfSprite_SetImage(sfSprite* sprite, const sfImage* image, sfBool adjustToNewSize);
CSFML_API void sfSprite_SetTexture(sfSprite* sprite, const sfTexture* texture, sfBool adjustToNewSize);
////////////////////////////////////////////////////////////
/// Set the sub-rectangle of a sprite inside the source image
@@ -348,14 +348,14 @@ CSFML_API void sfSprite_FlipX(sfSprite* sprite, sfBool flipped);
CSFML_API void sfSprite_FlipY(sfSprite* sprite, sfBool flipped);
////////////////////////////////////////////////////////////
/// Get the source image of a sprite
/// Get the source texture of a sprite
///
/// \param sprite : Sprite to read
///
/// \return Pointer to the image (can be NULL)
/// \return Pointer to the texture (can be NULL)
///
////////////////////////////////////////////////////////////
CSFML_API const sfImage* sfSprite_GetImage(const sfSprite* sprite);
CSFML_API const sfTexture* sfSprite_GetTexture(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// Get the sub-rectangle of a sprite inside the source image
@@ -387,17 +387,5 @@ CSFML_API float sfSprite_GetWidth(const sfSprite* sprite);
////////////////////////////////////////////////////////////
CSFML_API float sfSprite_GetHeight(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// Get the color of a given pixel in a sprite
///
/// \param sprite : Sprite to read
/// \param x : X coordinate of the pixel to get
/// \param y : Y coordinate of the pixel to get
///
/// \return Color of pixel (X, Y)
///
////////////////////////////////////////////////////////////
CSFML_API sfColor sfSprite_GetPixel(const sfSprite* sprite, unsigned int x, unsigned int y);
#endif // SFML_SPRITE_H
+236
View File
@@ -0,0 +1,236 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#ifndef SFML_TEXTURE_H
#define SFML_TEXTURE_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Window/Types.h>
#include <SFML/System/InputStream.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
/// Create a new texture
///
/// \param width : Texture width
/// \param height : Texture height
///
/// \return A new sfTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_Create(unsigned int width, unsigned int height);
////////////////////////////////////////////////////////////
/// Create a new texture from a file
///
/// \param filename : Path of the image file to load
/// \param area : Area of the source image to load (NULL to load the entire image)
///
/// \return A new sfTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_CreateFromFile(const char* filename, const sfIntRect* area);
////////////////////////////////////////////////////////////
/// Create a new texture from a file in memory
///
/// \param data : Pointer to the file data in memory
/// \param sizeInBytes : Size of the data to load, in bytes
/// \param area : Area of the source image to load (NULL to load the entire image)
///
/// \return A new sfTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_CreateFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
////////////////////////////////////////////////////////////
/// Create a new texture from a custom stream
///
/// \param stream : Source stream to read from
/// \param area : Area of the source image to load (NULL to load the entire image)
///
/// \return A new sfTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_CreateFromStream(sfInputStream* stream, const sfIntRect* area);
////////////////////////////////////////////////////////////
/// Create a new texture from an image
///
/// \param image : Image to upload to the texture
/// \param area : Area of the source image to load (NULL to load the entire image)
///
/// \return A new sfTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_CreateFromImage(const sfImage* image, const sfIntRect* area);
////////////////////////////////////////////////////////////
/// Copy an existing texture
///
/// \param texture : Texture to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_API sfTexture* sfTexture_Copy(sfTexture* texture);
////////////////////////////////////////////////////////////
/// Destroy an existing texture
///
/// \param texture : Texture to delete
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_Destroy(sfTexture* texture);
////////////////////////////////////////////////////////////
/// Return the width of the texture
///
/// \param texture : Texture to read
///
/// \return Width in pixels
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfTexture_GetWidth(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Return the height of the texture
///
/// \param texture : Texture to read
///
/// \return Height in pixels
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfTexture_GetHeight(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Copy a texture's pixels to an image
///
/// \param texture : Texture to copy
///
/// \return Image containing the texture's pixels
///
////////////////////////////////////////////////////////////
CSFML_API sfImage* sfTexture_CopyToImage(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Update a texture from an array of pixels
///
/// \param texture : Texture to update
/// \param pixels : Array of pixels to copy to the texture
/// \param width : Width of the pixel region contained in \a pixels
/// \param height : Height of the pixel region contained in \a pixels
/// \param x : X offset in the texture where to copy the source pixels
/// \param y : Y offset in the texture where to copy the source pixels
///
////////////////////////////////////////////////////////////
CSFML_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 image
///
/// \param texture : Texture to update
/// \param image : Image to copy to the texture
/// \param x : X offset in the texture where to copy the source pixels
/// \param y : Y offset in the texture where to copy the source pixels
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_UpdateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// Update a texture from the contents of a window
///
/// \param texture : Texture to update
/// \param window : Window to copy to the texture
/// \param x : X offset in the texture where to copy the source pixels
/// \param y : Y offset in the texture where to copy the source pixels
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_UpdateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// Update a texture from the contents of a render-window
///
/// \param texture : Texture to update
/// \param renderWindow : Render-window to copy to the texture
/// \param x : X offset in the texture where to copy the source pixels
/// \param y : Y offset in the texture where to copy the source pixels
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_UpdateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// Activate a texture for rendering
///
/// \param texture : Texture to bind
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_Bind(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Enable or disable the smooth filter on a texture
///
/// \param texture : The texture object
/// \param smooth : sfTrue to enable smoothing, sfFalse to disable it
///
////////////////////////////////////////////////////////////
CSFML_API void sfTexture_SetSmooth(sfTexture* texture, sfBool smooth);
////////////////////////////////////////////////////////////
/// Tell whether the smooth filter is enabled or not for a texture
///
/// \param texture : The texture object
///
/// \return sfTrue if smoothing is enabled, sfFalse if it is disabled
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfTexture_IsSmooth(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// Convert a rectangle of pixels into texture coordinates
///
/// \param texture : Texture to use for conversion
/// \param rectangle : Rectangle to convert
///
/// \return Texture coordinates corresponding to \a rectangle
///
////////////////////////////////////////////////////////////
CSFML_API sfFloatRect sfTexture_GetTexCoords(const sfTexture* texture, sfIntRect rectangle);
////////////////////////////////////////////////////////////
/// Get the maximum texture size allowed
///
/// \return Maximum size allowed for textures, in pixels
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfTexture_GetMaximumSize();
#endif // SFML_TEXTURE_H
+2 -1
View File
@@ -29,11 +29,12 @@
typedef struct sfFont sfFont;
typedef struct sfImage sfImage;
typedef struct sfShader sfShader;
typedef struct sfRenderImage sfRenderImage;
typedef struct sfRenderTexture sfRenderTexture;
typedef struct sfRenderWindow sfRenderWindow;
typedef struct sfShape sfShape;
typedef struct sfSprite sfSprite;
typedef struct sfText sfText;
typedef struct sfTexture sfTexture;
typedef struct sfView sfView;