Memory handle. More...
#include <FreeImagePlus.h>
Public Member Functions | |
fipMemoryIO (BYTE *data=NULL, DWORD size_in_bytes=0) | |
Constructor. More... | |
~fipMemoryIO () | |
Destructor. More... | |
BOOL | isValid () const |
Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise. More... | |
FREE_IMAGE_FORMAT | getFileType () const |
Returns the buffer image format. More... | |
operator FIMEMORY * () | |
Returns a pointer to the FIMEMORY data. More... | |
Memory IO routines | |
FIBITMAP * | load (FREE_IMAGE_FORMAT fif, int flags=0) const |
Loads a dib from a memory stream. More... | |
BOOL | save (FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0) |
Saves a dib to a memory stream. More... | |
unsigned | read (void *buffer, unsigned size, unsigned count) const |
Reads data from a memory stream. More... | |
unsigned | write (const void *buffer, unsigned size, unsigned count) |
Writes data to a memory stream. More... | |
long | tell () const |
Gets the current position of a memory pointer. More... | |
BOOL | seek (long offset, int origin) |
Moves the memory pointer to a specified location. More... | |
BOOL | acquire (BYTE **data, DWORD *size_in_bytes) |
Provides a direct buffer access to a memory stream. More... | |
Information functions |
Protected Attributes | |
FIMEMORY * | _hmem |
Pointer to a memory stream. More... | |
Memory handle.
fipMemoryIO is a class that allows you to load / save images from / to a memory stream.
fipMemoryIO::fipMemoryIO | ( | BYTE * | data = NULL , |
DWORD | size_in_bytes = 0 |
||
) |
Constructor.
Wrap a memory buffer containing image data.
The memory buffer is read only and has to be freed by the user when no longer in use.
When default arguments are used, open a memory file as read/write.
data | Pointer to the memory buffer |
size_in_bytes | Buffer size in bytes |
fipMemoryIO::~fipMemoryIO | ( | ) |
Destructor.
Free any allocated memory
BOOL fipMemoryIO::acquire | ( | BYTE ** | data, |
DWORD * | size_in_bytes | ||
) |
Provides a direct buffer access to a memory stream.
data | Pointer to the memory buffer (returned value) |
size_in_bytes | Buffer size in bytes (returned value) |
FREE_IMAGE_FORMAT fipMemoryIO::getFileType | ( | ) | const |
Returns the buffer image format.
|
virtual |
Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise.
Implements fipObject.
FIBITMAP* fipMemoryIO::load | ( | FREE_IMAGE_FORMAT | fif, |
int | flags = 0 |
||
) | const |
Loads a dib from a memory stream.
fif | Format identifier (FreeImage format) |
flags | The signification of this flag depends on the image to be loaded. |
|
inline |
Returns a pointer to the FIMEMORY data.
Used for direct access from FREEIMAGE functions or from your own low level C functions.
unsigned fipMemoryIO::read | ( | void * | buffer, |
unsigned | size, | ||
unsigned | count | ||
) | const |
Reads data from a memory stream.
buffer | Storage location for data |
size | Item size in bytes |
count | Maximum number of items to be read |
BOOL fipMemoryIO::save | ( | FREE_IMAGE_FORMAT | fif, |
FIBITMAP * | dib, | ||
int | flags = 0 |
||
) |
Saves a dib to a memory stream.
fif | Format identifier (FreeImage format) |
dib | Image to be saved |
flags | The signification of this flag depends on the image to be saved. |
BOOL fipMemoryIO::seek | ( | long | offset, |
int | origin | ||
) |
Moves the memory pointer to a specified location.
long fipMemoryIO::tell | ( | ) | const |
Gets the current position of a memory pointer.
unsigned fipMemoryIO::write | ( | const void * | buffer, |
unsigned | size, | ||
unsigned | count | ||
) |
Writes data to a memory stream.
buffer | Pointer to data to be written |
size | Item size in bytes |
count | Maximum number of items to be written |
|
protected |
Pointer to a memory stream.