Image.h File Reference

#include <SFML/Config.h>
#include <SFML/Graphics/Color.h>

Go to the source code of this file.


Typedefs

typedef sfImage sfImage
 sfImage is the low-level class for loading and manipulating images

Functions

CSFML_API sfImagesfImage_Create ()
 Create a new empty image.
CSFML_API sfImagesfImage_CreateFromColor (unsigned int Width, unsigned int Height, sfColor Color)
 Create a new image filled with a color.
CSFML_API sfImagesfImage_CreateFromPixels (unsigned int Width, unsigned int Height, const sfUint8 *Data)
 Create a new image from an array of pixels in memory.
CSFML_API sfImagesfImage_CreateFromFile (const char *Filename)
 Create a new image from a file.
CSFML_API sfImagesfImage_CreateFromMemory (const char *Data, size_t SizeInBytes)
 Create a new image from a file in memory.
CSFML_API void sfImage_Destroy (sfImage *Image)
 Destroy an existing image.
CSFML_API sfBool sfImage_SaveToFile (sfImage *Image, const char *Filename)
 Save the content of an image to a file.
CSFML_API void sfImage_CreateMaskFromColor (sfImage *Image, sfColor ColorKey, sfUint8 Alpha)
 Create a transparency mask for an image from a specified colorkey.
CSFML_API sfBool sfImage_Resize (sfImage *Image, unsigned int Width, unsigned int Height, sfColor Color)
 Resize an image - warning : this function does not scale the image, it just ajdusts size (add padding or remove pixels).
CSFML_API void sfImage_SetPixel (sfImage *Image, unsigned int X, unsigned int Y, sfColor Color)
 Change the color of a pixel of an image Don't forget to call Update when you end modifying pixels.
CSFML_API sfColor sfImage_GetPixel (sfImage *Image, unsigned int X, unsigned int Y)
 Get a pixel from an image.
CSFML_API const sfUint8 * sfImage_GetPixelsPtr (sfImage *Image)
 Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA) Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 This pointer becomes invalid if you reload or resize the image.
CSFML_API void sfImage_Bind (sfImage *Image)
 Bind the image for rendering.
CSFML_API void sfImage_SetSmooth (sfImage *Image, sfBool Smooth)
 Enable or disable image smooth filter.
CSFML_API void sfImage_SetRepeat (sfImage *Image, sfBool Repeat)
 Enable or disable image repeat mode (ie.
CSFML_API unsigned int sfImage_GetWidth (sfImage *Image)
 Return the width of the image.
CSFML_API unsigned int sfImage_GetHeight (sfImage *Image)
 Return the height of the image.

Typedef Documentation

typedef struct sfImage sfImage

sfImage is the low-level class for loading and manipulating images

Definition at line 39 of file Image.h.


Function Documentation

CSFML_API void sfImage_Bind ( sfImage Image  ) 

Bind the image for rendering.

Parameters:
Image : Image to bind

CSFML_API sfImage* sfImage_Create (  ) 

Create a new empty image.

Returns:
A new sfImage object, or NULL if it failed

CSFML_API sfImage* sfImage_CreateFromColor ( unsigned int  Width,
unsigned int  Height,
sfColor  Color 
)

Create a new image filled with a color.

Parameters:
Width : Image width
Height : Image height
Col : Image color
Returns:
A new sfImage object, or NULL if it failed

CSFML_API sfImage* sfImage_CreateFromFile ( const char *  Filename  ) 

Create a new image from a file.

Parameters:
Filename : Path of the image file to load
Returns:
A new sfImage object, or NULL if it failed

CSFML_API sfImage* sfImage_CreateFromMemory ( const char *  Data,
size_t  SizeInBytes 
)

Create a new image from a file in memory.

Parameters:
Data : Pointer to the file data in memory
SizeInBytes : Size of the data to load, in bytes
Returns:
A new sfImage object, or NULL if it failed

CSFML_API sfImage* sfImage_CreateFromPixels ( unsigned int  Width,
unsigned int  Height,
const sfUint8 *  Data 
)

Create a new image from an array of pixels in memory.

Parameters:
Width : Image width
Height : Image height
Data : Pointer to the pixels in memory (assumed format is RGBA)
Returns:
A new sfImage object, or NULL if it failed

CSFML_API void sfImage_CreateMaskFromColor ( sfImage Image,
sfColor  ColorKey,
sfUint8  Alpha 
)

Create a transparency mask for an image from a specified colorkey.

Parameters:
Image : Image to modify
ColorKey : Color to become transparent
Alpha : Alpha value to use for transparent pixels

CSFML_API void sfImage_Destroy ( sfImage Image  ) 

Destroy an existing image.

Parameters:
Image : Image to delete

CSFML_API unsigned int sfImage_GetHeight ( sfImage Image  ) 

Return the height of the image.

Parameters:
Image : Image to read
Returns:
Height in pixels

CSFML_API sfColor sfImage_GetPixel ( sfImage Image,
unsigned int  X,
unsigned int  Y 
)

Get a pixel from an image.

Parameters:
Image : Image to read
X : X coordinate of pixel in the image
Y : Y coordinate of pixel in the image
Returns:
Color of pixel (x, y)

CSFML_API const sfUint8* sfImage_GetPixelsPtr ( sfImage Image  ) 

Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA) Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 This pointer becomes invalid if you reload or resize the image.

Parameters:
Image : Image to read
Returns:
Pointer to the array of pixels

CSFML_API unsigned int sfImage_GetWidth ( sfImage Image  ) 

Return the width of the image.

Parameters:
Image : Image to read
Returns:
Width in pixels

CSFML_API sfBool sfImage_Resize ( sfImage Image,
unsigned int  Width,
unsigned int  Height,
sfColor  Color 
)

Resize an image - warning : this function does not scale the image, it just ajdusts size (add padding or remove pixels).

Parameters:
Image : Image to resize
Width : New width
Height : New height
Col : Color to assign to new pixels
Returns:
sfTrue if resize was successful

CSFML_API sfBool sfImage_SaveToFile ( sfImage Image,
const char *  Filename 
)

Save the content of an image to a file.

Parameters:
Image : Image to save
Filename : Path of the file to save (overwritten if already exist)
Returns:
sfTrue if saving was successful

CSFML_API void sfImage_SetPixel ( sfImage Image,
unsigned int  X,
unsigned int  Y,
sfColor  Color 
)

Change the color of a pixel of an image Don't forget to call Update when you end modifying pixels.

Parameters:
Image : Image to modify
X : X coordinate of pixel in the image
Y : Y coordinate of pixel in the image
Col : New color for pixel (X, Y)

CSFML_API void sfImage_SetRepeat ( sfImage Image,
sfBool  Repeat 
)

Enable or disable image repeat mode (ie.

how to define pixels outside the texture range)

Parameters:
Image : Image to modify
Repeat : sfTrue to enable repeat, sfFalse to disable

CSFML_API void sfImage_SetSmooth ( sfImage Image,
sfBool  Smooth 
)

Enable or disable image smooth filter.

Parameters:
Image : Image to modify
Smooth : sfTrue to enable smoothing filter, false to disable it