Simple++
Powerfull and lightning fast C++ Library
|
#include <FreeImage.h>
Public Types | |
enum | Format { Format::UNDEFINED, Format::R, Format::RGB, Format::RGBA } |
enum | LoadingType { LoadingType::EMPTY, LoadingType::FILE } |
enum | SavingFormat { SavingFormat::PNG = FIF_PNG, SavingFormat::JPG = FIF_JPEG, SavingFormat::BMP = FIF_BMP, SavingFormat::TGA = FIF_TARGA } |
enum | Filter { Filter::Box = FILTER_BOX, Filter::Bilinear = FILTER_BILINEAR, Filter::Bspline = FILTER_BSPLINE, Filter::Bicubic = FILTER_BICUBIC, Filter::Catmullrom = FILTER_CATMULLROM, Filter::Lanczos3 = FILTER_LANCZOS3 } |
Public Member Functions | |
FreeImage () | |
Empty constructor, it will generate an NULL image. More... | |
FreeImage (const WString &fileName, Format format=Format::UNDEFINED, bool invertY=false, const Math::Vec2< Size > &size=Math::Vec2< Size >::null) | |
Create a new Image using a file stored on the HD, the format can be specified if all the colors aren't usefully. More... | |
FreeImage (const FreeImage &freeImage, const Math::Vec2< Size > &newSize, Filter resampleFilter=Filter::Bilinear) | |
Create a new Image, a copy from an another one existing but resize it directly. More... | |
FreeImage (const FreeImage &freeImage) | |
Create a new Image, a copy from an another one existing. More... | |
FreeImage (FreeImage &&freeImage) | |
Move constructor. More... | |
~FreeImage (void) | |
destructor More... | |
FreeImage & | operator= (const FreeImage &image) |
Copy operator. More... | |
FreeImage & | operator= (FreeImage &&image) |
Move operator. More... | |
void | setFile (const WString &fileName, Format format=Format::UNDEFINED, bool invertY=false, const Math::Vec2< Size > &size=Math::Vec2< Size >::null) |
define a new file to be this image. This object will be automatically reloaded if already loaded. More... | |
void | loadFromDatas (unsigned char *datas, const Math::Vec2< Size > &size, Format format, bool datasInvertY=false) |
load this object using raw datas More... | |
Math::vec4 | getPixelf (Size x, Size y) const |
return a pixel as a Math::vec4 object. Value will be between 0.0f and 0.1f. More... | |
void | setFormat (Format format) |
Set the actual format of each pixel stored, it will change the BPP. More... | |
Format | getFormat () const |
Retrieve the actual image format. More... | |
FIBITMAP * | getFreeImage () |
Retrieve the inside FreeImage format object (not advised) More... | |
unsigned int | getBPP () const |
Retrieve the actual BPP of this image. More... | |
unsigned char * | getDatas () const |
Retrieve datas has BGRA format. More... | |
size_t | getStride () const |
Retrieve the stride (width of one line in bytes) More... | |
bool | saveToFile (const WString &fileName, SavingFormat savingFormat, unsigned int quality=100) |
Save the image to a file, the quality is only for JPG from 0 to 100. More... | |
void | resize (const Math::Vec2< Size > &newSize, Filter resampleFilter=Filter::Bilinear) |
Resize the image to the specified size using the specified Filter. More... | |
const Math::Vec2< Size > & | getSize () const |
Retrieve this image size. More... | |
bool | isYFlipped () const |
Get if the Y is flipped or not. More... | |
void | setFlipY (bool value) |
Set if the image should be Y flipped. More... | |
const WString & | getFileName () const |
Retrieve the fileName. More... | |
void | clear () |
Create a new image full black. More... | |
FreeImage * | copy () |
Create a copy of this image. More... | |
BITMAPINFO * | getInfos () |
LoadingType | getLoadingType () const |
Get the loading type. More... | |
Public Member Functions inherited from BasicLoadable | |
BasicLoadable () | |
Empty constructor initialized at NOT loaded and NOT loading. More... | |
BasicLoadable (const BasicLoadable &loadable) | |
copy constructor More... | |
~BasicLoadable () | |
void | load () |
load the object (this function may not be overloaded) More... | |
void | unload () |
unload this object (this function may not be overloaded) More... | |
bool | isLoaded () const |
get if the current object is loaded or not More... | |
void | reload () |
if the current object is loaded, unload it and then call load again, if not, this do nothing. More... | |
bool | isLoading () const |
get if the current object is currently loading More... | |
void | lock () |
lock the current object to ensure no parallelization of the loading state. More... | |
void | unlock () |
unlock the current object to permit parallelization of the loading state. More... | |
BasicLoadable & | operator= (const BasicLoadable &loadable) |
copy operator More... | |
Static Public Member Functions | |
static unsigned int | getBitsFromFormat (Format format) |
Retrieve the number of bits from a specified format. More... | |
Protected Member Functions | |
void | onLoad () |
function to be overloaded to add action during the loading process. More... | |
void | onUnload () |
function to be overloaded to add action during the unloading process. More... | |
Protected Member Functions inherited from BasicLoadable | |
void | setLoaded (bool loaded) |
set if the current object is loaded or not. (use with caution) More... | |
void | setLoading (bool isLoading) |
set if the current object is currently loading (use with caution) More... | |
|
strong |
|
strong |
|
strong |
|
strong |
FreeImage::FreeImage | ( | ) |
Empty constructor, it will generate an NULL image.
FreeImage::FreeImage | ( | const WString & | fileName, |
Format | format = Format::UNDEFINED , |
||
bool | invertY = false , |
||
const Math::Vec2< Size > & | size = Math::Vec2<Size>::null |
||
) |
Create a new Image using a file stored on the HD, the format can be specified if all the colors aren't usefully.
fileName | Path to the image to be opened. Has to be in UTF16 |
format | Format of the image (Format::UNDEFINED meens automatic detection. The file will be converted instead.) |
invertY | Specify if the image has to be flipped vertically when loaded. |
size | the size the image will have. (Math::Vec2<Size>::null meens the original one). |
FreeImage::FreeImage | ( | const FreeImage & | freeImage, |
const Math::Vec2< Size > & | newSize, | ||
Filter | resampleFilter = Filter::Bilinear |
||
) |
Create a new Image, a copy from an another one existing but resize it directly.
freeImage | the image to be copied. |
newSize | the new size to be applied to the copied version |
resampleFilter | the re sample filter to be used during the resizing. |
FreeImage::FreeImage | ( | const FreeImage & | freeImage | ) |
Create a new Image, a copy from an another one existing.
freeImage | the image to be copied. |
FreeImage::FreeImage | ( | FreeImage && | freeImage | ) |
Move constructor.
FreeImage::~FreeImage | ( | void | ) |
destructor
void FreeImage::clear | ( | ) |
Create a new image full black.
FreeImage * FreeImage::copy | ( | ) |
Create a copy of this image.
|
static |
Retrieve the number of bits from a specified format.
unsigned int FreeImage::getBPP | ( | ) | const |
Retrieve the actual BPP of this image.
unsigned char * FreeImage::getDatas | ( | ) | const |
Retrieve datas has BGRA format.
const WString & FreeImage::getFileName | ( | ) | const |
Retrieve the fileName.
FreeImage::Format FreeImage::getFormat | ( | ) | const |
Retrieve the actual image format.
FIBITMAP * FreeImage::getFreeImage | ( | ) |
Retrieve the inside FreeImage format object (not advised)
BITMAPINFO * FreeImage::getInfos | ( | ) |
FreeImage::LoadingType FreeImage::getLoadingType | ( | ) | const |
Get the loading type.
Math::vec4 FreeImage::getPixelf | ( | Size | x, |
Size | y | ||
) | const |
return a pixel as a Math::vec4 object. Value will be between 0.0f and 0.1f.
const Math::Vec2< Size > & FreeImage::getSize | ( | ) | const |
Retrieve this image size.
size_t FreeImage::getStride | ( | ) | const |
Retrieve the stride (width of one line in bytes)
bool FreeImage::isYFlipped | ( | ) | const |
Get if the Y is flipped or not.
void FreeImage::loadFromDatas | ( | unsigned char * | datas, |
const Math::Vec2< Size > & | size, | ||
Format | format, | ||
bool | datasInvertY = false |
||
) |
load this object using raw datas
datas | The datas buffer to be used during the loading. |
size | the size of the image. |
format | the loading format of this image. |
datasInvertY | if we have to flip the image vertically or not. |
|
protectedvirtual |
function to be overloaded to add action during the loading process.
Reimplemented from BasicLoadable.
|
protectedvirtual |
function to be overloaded to add action during the unloading process.
Reimplemented from BasicLoadable.
void FreeImage::resize | ( | const Math::Vec2< Size > & | newSize, |
Filter | resampleFilter = Filter::Bilinear |
||
) |
Resize the image to the specified size using the specified Filter.
bool FreeImage::saveToFile | ( | const WString & | fileName, |
SavingFormat | savingFormat, | ||
unsigned int | quality = 100 |
||
) |
Save the image to a file, the quality is only for JPG from 0 to 100.
void FreeImage::setFile | ( | const WString & | fileName, |
Format | format = Format::UNDEFINED , |
||
bool | invertY = false , |
||
const Math::Vec2< Size > & | size = Math::Vec2<Size>::null |
||
) |
define a new file to be this image. This object will be automatically reloaded if already loaded.
fileName | new file Path to be opened in UTF16 |
format | loading format to be used if every components are not useful. (Format::UNDEFINED will use the file's one.) |
invertY | if we have to flip the image vertically. |
size | the new size of the loaded image (Math::Vec2<Size>::null mean full image resolution). |
void FreeImage::setFlipY | ( | bool | value | ) |
Set if the image should be Y flipped.
void FreeImage::setFormat | ( | Format | format | ) |
Set the actual format of each pixel stored, it will change the BPP.