#include <Image.hpp>
Inheritance diagram for sf::Image:
Public Member Functions | |
Image () | |
Default constructor. | |
Image (const Image &Copy) | |
Copy constructor. | |
Image (unsigned int Width, unsigned int Height, const Color &Col=Color(0, 0, 0, 255)) | |
Construct an empty image. | |
Image (unsigned int Width, unsigned int Height, const Uint8 *Data) | |
Construct the image from pixels in memory. | |
~Image () | |
Destructor. | |
bool | LoadFromFile (const std::string &Filename) |
Load the surface from a file. | |
bool | LoadFromMemory (const char *Data, std::size_t SizeInBytes) |
Load the surface from a file in memory. | |
bool | LoadFromPixels (unsigned int Width, unsigned int Height, const Uint8 *Data) |
Load the image directly from an array of pixels. | |
bool | SaveToFile (const std::string &Filename) const |
Save the content of the image to a file. | |
bool | Create (unsigned int Width, unsigned int Height, const Color &Col=Color(0, 0, 0, 255)) |
Create an empty image. | |
void | CreateMaskFromColor (const Color &ColorKey, Uint8 Alpha=0) |
Create transparency mask from a specified colorkey. | |
bool | Resize (unsigned int Width, unsigned int Height, const Color &Col=Color(0, 0, 0, 255)) |
Resize the image - warning : this function does not scale the image, it just ajdusts size (add padding or remove pixels). | |
void | SetPixel (unsigned int X, unsigned int Y, const Color &Col) |
Change the color of a pixel Don't forget to call Update when you end modifying pixels. | |
const Color & | GetPixel (unsigned int X, unsigned int Y) const |
Get a pixel from the image. | |
const Uint8 * | GetPixelsPtr () const |
Get a read-only pointer to the array of pixels (8 bits integers RGBA) Array size is GetWidth() x GetHeight() x 4 This pointer becomes invalid if you reload or resize the image. | |
void | Bind () const |
Bind the image for rendering. | |
void | SetSmooth (bool Smooth) const |
Enable or disable image smooth filter. | |
void | SetRepeat (bool Repeat) const |
Enable or disable image repeat mode (ie. | |
unsigned int | GetWidth () const |
Return the width of the image. | |
unsigned int | GetHeight () const |
Return the height of the image. | |
FloatRect | GetTexCoords (const IntRect &Rect, bool Adjust=true) const |
Convert a subrect expressed in pixels, into float texture coordinates. | |
Image & | operator= (const Image &Other) |
Assignment operator. | |
Static Public Member Functions | |
static unsigned int | GetValidTextureSize (unsigned int Size) |
Get a valid texture size according to hardware support. |
Definition at line 44 of file Image.hpp.
sf::Image::Image | ( | ) |
Default constructor.
sf::Image::Image | ( | const Image & | Copy | ) |
Copy constructor.
Copy | : instance to copy |
sf::Image::Image | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const Uint8 * | Data | |||
) |
sf::Image::~Image | ( | ) |
Destructor.
bool sf::Image::LoadFromFile | ( | const std::string & | Filename | ) |
Load the surface from a file.
Filename | : Path of the image file to load |
bool sf::Image::LoadFromMemory | ( | const char * | Data, | |
std::size_t | SizeInBytes | |||
) |
Load the surface from a file in memory.
Data | : Pointer to the file data in memory | |
SizeInBytes | : Size of the data to load, in bytes |
bool sf::Image::LoadFromPixels | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const Uint8 * | Data | |||
) |
bool sf::Image::SaveToFile | ( | const std::string & | Filename | ) | const |
Save the content of the image to a file.
Filename | : Path of the file to save (overwritten if already exist) |
void sf::Image::CreateMaskFromColor | ( | const Color & | ColorKey, | |
Uint8 | Alpha = 0 | |||
) |
Create transparency mask from a specified colorkey.
ColorKey | : Color to become transparent | |
Alpha | : Alpha value to use for transparent pixels (0 by default) |
bool sf::Image::Resize | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const Color & | Col = Color(0, 0, 0, 255) | |||
) |
Resize the image - warning : this function does not scale the image, it just ajdusts size (add padding or remove pixels).
Width | : New width | |
Height | : New height | |
Col | : Color to assign to new pixels (black by default) |
void sf::Image::SetPixel | ( | unsigned int | X, | |
unsigned int | Y, | |||
const Color & | Col | |||
) |
Change the color of a pixel Don't forget to call Update when you end modifying pixels.
X | : X coordinate of pixel in the image | |
Y | : Y coordinate of pixel in the image | |
Col | : New color for pixel (X, Y) |
const Color& sf::Image::GetPixel | ( | unsigned int | X, | |
unsigned int | Y | |||
) | const |
Get a pixel from the image.
X | : X coordinate of pixel in the image | |
Y | : Y coordinate of pixel in the image |
const Uint8* sf::Image::GetPixelsPtr | ( | ) | const |
Get a read-only pointer to the array of pixels (8 bits integers RGBA) Array size is GetWidth() x GetHeight() x 4 This pointer becomes invalid if you reload or resize the image.
void sf::Image::Bind | ( | ) | const |
Bind the image for rendering.
void sf::Image::SetSmooth | ( | bool | Smooth | ) | const |
Enable or disable image smooth filter.
This parameter is enabled by default
Smooth | : True to enable smoothing filter, false to disable it |
void sf::Image::SetRepeat | ( | bool | Repeat | ) | const |
Enable or disable image repeat mode (ie.
how to define pixels outside the texture range). This parameter is enabled by default
Repeat | : True to enable repeat, false to disable |
unsigned int sf::Image::GetWidth | ( | ) | const |
Return the width of the image.
unsigned int sf::Image::GetHeight | ( | ) | const |
Return the height of the image.
Convert a subrect expressed in pixels, into float texture coordinates.
Rect | : Sub-rectangle of image to convert | |
Adjust | : Pass true to apply the half-texel adjustment |
static unsigned int sf::Image::GetValidTextureSize | ( | unsigned int | Size | ) | [static] |
Get a valid texture size according to hardware support.
Size | : Size to convert |
Assignment operator.
Other | : instance to assign |