#include <Image.hpp>
Public Member Functions | |
sfImage () | |
sfImage (unsigned int Width, unsigned int Height, const sfColor &Color=sfColor::Black) | |
sfImage (unsigned int Width, unsigned int Height, const void *Data) | |
bool | LoadFromFile (const std::string &Filename) |
bool | SaveToFile (const std::string &Filename) const |
void | Create (unsigned int Width, unsigned int Height, const sfColor &Color=sfColor::Black) |
void | LoadFromMemory (unsigned int Width, unsigned int Height, const void *Data) |
void | CreateMaskFromColor (const sfColor &ColorKey) |
void | Resize (unsigned int Width, unsigned int Height, const sfColor &Color=sfColor::Black) |
void | SetPixel (unsigned int X, unsigned int Y, const sfColor &Color) |
sfColor | GetPixel (unsigned int X, unsigned int Y) const |
const sfUint32 * | GetPixelsPtr () const |
void | Update () |
void | Bind () const |
void | SetSmooth (bool Smooth) const |
void | SetRepeat (bool Repeat) const |
unsigned int | GetWidth () const |
unsigned int | GetHeight () const |
sfFloatRect | GetTexCoords (const sfIntRect &Rect) const |
Static Public Member Functions | |
static unsigned int | GetValidTextureSize (unsigned int Size) |
Definition at line 42 of file Image.hpp.
sfImage::sfImage | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const sfColor & | Color = sfColor::Black | |||
) |
sfImage::sfImage | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const void * | Data | |||
) |
Construct the image from pixels in memory
Width | : Image width | |
Height | : Image height | |
Data | : Pointer to the pixels in memory (assumed format is RGBA 32 bits) |
Definition at line 56 of file Image.cpp.
References LoadFromMemory().
bool sfImage::LoadFromFile | ( | const std::string & | Filename | ) |
bool sfImage::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) |
Definition at line 89 of file Image.cpp.
Referenced by sfRenderWindow::Capture().
void sfImage::Create | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const sfColor & | Color = sfColor::Black | |||
) |
Create an empty image
Width | : Image width | |
Height | : Image height | |
Color | : Image color (black by default) |
Definition at line 101 of file Image.cpp.
References sfColor::ToRGBA().
Referenced by LoadFromMemory(), and sfImage().
void sfImage::LoadFromMemory | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const void * | Data | |||
) |
Load the image from pixels in memory
Width | : Image width | |
Height | : Image height | |
Data | : Pointer to the pixels in memory (assumed format is RGBA 32 bits) |
Definition at line 114 of file Image.cpp.
References Create(), and sfColor::White.
Referenced by sfImage().
void sfImage::CreateMaskFromColor | ( | const sfColor & | ColorKey | ) |
Create transparency mask from a specified colorkey
ColorKey | : Color to become transparent |
Definition at line 136 of file Image.cpp.
References sfColor::ToRGBA().
void sfImage::Resize | ( | unsigned int | Width, | |
unsigned int | Height, | |||
const sfColor & | Color = sfColor::Black | |||
) |
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 | |
Color | : Color to assign to new pixels (black by default) |
Definition at line 154 of file Image.cpp.
References GetHeight(), GetWidth(), and sfColor::ToRGBA().
Referenced by sfPostFX::Render().
void sfImage::SetPixel | ( | unsigned int | X, | |
unsigned int | Y, | |||
const sfColor & | Color | |||
) |
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 | |
Color | : New color for pixel (X, Y) |
Definition at line 183 of file Image.cpp.
References GetHeight(), GetWidth(), and sfColor::ToRGBA().
sfColor sfImage::GetPixel | ( | unsigned int | X, | |
unsigned int | Y | |||
) | const |
Get a pixel from the image
X | : Path of the image file to load | |
Y | : Path of the image file to load |
Definition at line 208 of file Image.cpp.
References sfColor::Black, GetHeight(), and GetWidth().
const sfUint32 * sfImage::GetPixelsPtr | ( | ) | const |
Get a read-only pointer to the array of pixels (32 bits integer RGBA) Array size is GetWidth() x GetHeight() This pointer becomes invalid if you reload or resize the image
void sfImage::Update | ( | ) |
void sfImage::Bind | ( | ) | const |
Bind the image for rendering
Definition at line 261 of file Image.cpp.
Referenced by sfSprite::Render(), and sfPostFX::Render().
void sfImage::SetSmooth | ( | bool | Smooth | ) | const |
Enable or disable image smooth filter
Smooth | : True to enable smoothing filter, false to disable it |
Definition at line 271 of file Image.cpp.
Referenced by sfPostFX::Render().
void sfImage::SetRepeat | ( | bool | Repeat | ) | const |
Enable or disable image repeat mode (ie. how to define pixels outside the texture range)
Repeat | : True to enable repeat, false to disable |
Definition at line 282 of file Image.cpp.
Referenced by sfPostFX::Render().
unsigned int sfImage::GetWidth | ( | ) | const |
Return the width of the image
Definition at line 292 of file Image.cpp.
Referenced by GetPixel(), sfSprite::Render(), sfPostFX::Render(), Resize(), and SetPixel().
unsigned int sfImage::GetHeight | ( | ) | const |
Return the height of the image
Definition at line 301 of file Image.cpp.
Referenced by GetPixel(), sfSprite::Render(), sfPostFX::Render(), Resize(), and SetPixel().
sfFloatRect sfImage::GetTexCoords | ( | const sfIntRect & | Rect | ) | const |
Convert a subrect expressed in pixels, into float texture coordinates
Rect | : Sub-rectangle of image to convert |
Definition at line 311 of file Image.cpp.
Referenced by sfSprite::Render(), and sfPostFX::Render().
unsigned int sfImage::GetValidTextureSize | ( | unsigned int | Size | ) | [static] |