mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02: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/Types.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Vector2.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);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the width of an image
|
||||
/// \brief Return the size of an image
|
||||
///
|
||||
/// \param image Image object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfImage_getWidth(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);
|
||||
CSFML_GRAPHICS_API sfVector2u sfImage_getSize(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a transparency mask from a specified color-key
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/Window/Types.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -111,24 +112,14 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_copy(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
|
||||
///
|
||||
/// \return Width in pixels
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getWidth(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);
|
||||
CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfImage_getHeight(const sfImage* image)
|
||||
{
|
||||
CSFML_CALL_RETURN(image, getHeight(), 0);
|
||||
size.x = sfmlSize.x;
|
||||
size.y = sfmlSize.y;
|
||||
|
||||
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();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfTexture_getHeight(const sfTexture* texture)
|
||||
{
|
||||
CSFML_CALL_PTR_RETURN(texture, getHeight(), 0);
|
||||
size.x = sfmlSize.x;
|
||||
size.y = sfmlSize.y;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user