mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 21:16:13 +01:00
Replaced getWidth/getHeight with getSize in sfImage and sfTexture
This commit is contained in:
1 parent
228a06ba64
commit
ad8a1aade0
4 files changed
+24
-40
No files matched your search
@@ -33,6 +33,7 @@
|
|||||||
#include <SFML/Graphics/Rect.h>
|
#include <SFML/Graphics/Rect.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
|
#include <SFML/System/Vector2.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -159,24 +160,14 @@ CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image);
|
|||||||
CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename);
|
CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return the width of an image
|
/// \brief Return the size of an image
|
||||||
///
|
///
|
||||||
/// \param image Image object
|
/// \param image Image object
|
||||||
///
|
///
|
||||||
/// \return Width in pixels
|
/// \return Size in pixels
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfImage_getWidth(const sfImage* image);
|
CSFML_GRAPHICS_API sfVector2u sfImage_getSize(const sfImage* image);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the height of an image
|
|
||||||
///
|
|
||||||
/// \param image Image object
|
|
||||||
///
|
|
||||||
/// \return Height in pixels
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CSFML_GRAPHICS_API unsigned int sfImage_getHeight(const sfImage* image);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a transparency mask from a specified color-key
|
/// \brief Create a transparency mask from a specified color-key
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/Window/Types.h>
|
#include <SFML/Window/Types.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
|
#include <SFML/System/Vector2.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -111,24 +112,14 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_copy(sfTexture* texture);
|
|||||||
CSFML_GRAPHICS_API void sfTexture_destroy(sfTexture* texture);
|
CSFML_GRAPHICS_API void sfTexture_destroy(sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return the width of the texture
|
/// \brief Return the size of the texture
|
||||||
///
|
///
|
||||||
/// \param texture Texture to read
|
/// \param texture Texture to read
|
||||||
///
|
///
|
||||||
/// \return Width in pixels
|
/// \return Size in pixels
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfTexture_getWidth(const sfTexture* texture);
|
CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Return the height of the texture
|
|
||||||
///
|
|
||||||
/// \param texture Texture to read
|
|
||||||
///
|
|
||||||
/// \return Height in pixels
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CSFML_GRAPHICS_API unsigned int sfTexture_getHeight(const sfTexture* texture);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Copy a texture's pixels to an image
|
/// \brief Copy a texture's pixels to an image
|
||||||
|
|||||||
@@ -174,16 +174,17 @@ const sfUint8* sfImage_getPixelsPtr(const sfImage* image)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int sfImage_getWidth(const sfImage* image)
|
sfVector2u sfImage_getSize(const sfImage* image)
|
||||||
{
|
{
|
||||||
CSFML_CALL_RETURN(image, getWidth(), 0);
|
sfVector2u size = {0, 0};
|
||||||
}
|
CSFML_CHECK_RETURN(image, size);
|
||||||
|
|
||||||
|
sf::Vector2u sfmlSize = image->This.getSize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
size.x = sfmlSize.x;
|
||||||
unsigned int sfImage_getHeight(const sfImage* image)
|
size.y = sfmlSize.y;
|
||||||
{
|
|
||||||
CSFML_CALL_RETURN(image, getHeight(), 0);
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -147,16 +147,17 @@ void sfTexture_destroy(sfTexture* texture)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int sfTexture_getWidth(const sfTexture* texture)
|
sfVector2u sfTexture_getSize(const sfTexture* texture)
|
||||||
{
|
{
|
||||||
CSFML_CALL_PTR_RETURN(texture, getWidth(), 0);
|
sfVector2u size = {0, 0};
|
||||||
}
|
CSFML_CHECK_RETURN(texture, size);
|
||||||
|
|
||||||
|
sf::Vector2u sfmlSize = texture->This->getSize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
size.x = sfmlSize.x;
|
||||||
unsigned int sfTexture_getHeight(const sfTexture* texture)
|
size.y = sfmlSize.y;
|
||||||
{
|
|
||||||
CSFML_CALL_PTR_RETURN(texture, getHeight(), 0);
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user