FreeImagePlus  - FreeImage 3.15.1
Public Member Functions | Protected Attributes | List of all members
fipMemoryIO Class Reference

Memory handle. More...

#include <FreeImagePlus.h>

Inheritance diagram for fipMemoryIO:
fipObject

Public Member Functions

 fipMemoryIO (BYTE *data=NULL, DWORD size_in_bytes=0)
 Constructor. More...
 
virtual ~fipMemoryIO ()
 Destructor. More...
 
void close ()
 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...
 
FIMULTIBITMAP * loadMultiPage (FREE_IMAGE_FORMAT fif, int flags=0) const
 
Loads a multi-page bitmap from a memory stream More...
 
BOOL save (FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0)
 
Saves a dib to a memory stream More...
 
BOOL saveMultiPage (FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags=0)
 
Saves a multi-page bitmap 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...
 
- Public Member Functions inherited from fipObject
virtual ~fipObject ()
 Destructor. More...
 

Protected Attributes

FIMEMORY * _hmem
 Pointer to a memory stream. More...
 

Detailed Description

Memory handle.

fipMemoryIO is a class that allows you to load / save images from / to a memory stream.

Version
FreeImage 3
Author
Hervé Drolon

Constructor & Destructor Documentation

◆ fipMemoryIO()

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.

Parameters
dataPointer to the memory buffer
size_in_bytesBuffer size in bytes
See also
FreeImage_OpenMemory

◆ ~fipMemoryIO()

virtual fipMemoryIO::~fipMemoryIO ( )
virtual

Destructor.

Free any allocated memory

See also
FreeImage_CloseMemory

Member Function Documentation

◆ acquire()

BOOL fipMemoryIO::acquire ( BYTE **  data,
DWORD *  size_in_bytes 
)


Provides a direct buffer access to a memory stream

Parameters
dataPointer to the memory buffer (returned value)
size_in_bytesBuffer size in bytes (returned value)
See also
FreeImage_AcquireMemory

◆ close()

void fipMemoryIO::close ( )

Destructor.

Free any allocated memory and invalidate the stream

See also
FreeImage_CloseMemory

◆ getFileType()

FREE_IMAGE_FORMAT fipMemoryIO::getFileType ( ) const

Returns the buffer image format.

See also
FreeImage_GetFileTypeFromMemory

◆ isValid()

BOOL fipMemoryIO::isValid ( ) const
virtual

Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise.

Implements fipObject.

◆ load()

FIBITMAP* fipMemoryIO::load ( FREE_IMAGE_FORMAT  fif,
int  flags = 0 
) const


Loads a dib from a memory stream

Parameters
fifFormat identifier (FreeImage format)
flagsThe signification of this flag depends on the image to be loaded.
Returns
Returns the loaded dib if successful, returns NULL otherwise
See also
FreeImage_LoadFromMemory

◆ loadMultiPage()

FIMULTIBITMAP* fipMemoryIO::loadMultiPage ( FREE_IMAGE_FORMAT  fif,
int  flags = 0 
) const


Loads a multi-page bitmap from a memory stream

Parameters
fifFormat identifier (FreeImage format)
flagsThe signification of this flag depends on the multi-page to be loaded.
Returns
Returns the loaded multi-page if successful, returns NULL otherwise
See also
FreeImage_LoadMultiBitmapFromMemory

◆ operator FIMEMORY *()

fipMemoryIO::operator FIMEMORY * ( )
inline


Returns a pointer to the FIMEMORY data.

Used for direct access from FREEIMAGE functions or from your own low level C functions.

◆ read()

unsigned fipMemoryIO::read ( void *  buffer,
unsigned  size,
unsigned  count 
) const


Reads data from a memory stream

Parameters
bufferStorage location for data
sizeItem size in bytes
countMaximum number of items to be read
Returns
Returns the number of full items actually read, which may be less than count if an error occurs
See also
FreeImage_ReadMemory

◆ save()

BOOL fipMemoryIO::save ( FREE_IMAGE_FORMAT  fif,
FIBITMAP *  dib,
int  flags = 0 
)


Saves a dib to a memory stream

Parameters
fifFormat identifier (FreeImage format)
dibImage to be saved
flagsThe signification of this flag depends on the image to be saved.
Returns
Returns TRUE if successful, returns FALSE otherwise
See also
FreeImage_SaveToMemory

◆ saveMultiPage()

BOOL fipMemoryIO::saveMultiPage ( FREE_IMAGE_FORMAT  fif,
FIMULTIBITMAP *  bitmap,
int  flags = 0 
)


Saves a multi-page bitmap to a memory stream

Parameters
fifFormat identifier (FreeImage format)
bitmapMulti-page image to be saved
flagsThe signification of this flag depends on the image to be saved.
Returns
Returns TRUE if successful, returns FALSE otherwise
See also
FreeImage_SaveMultiBitmapToMemory

◆ seek()

BOOL fipMemoryIO::seek ( long  offset,
int  origin 
)


Moves the memory pointer to a specified location

See also
FreeImage_SeekMemory

◆ tell()

long fipMemoryIO::tell ( ) const


Gets the current position of a memory pointer

See also
FreeImage_TellMemory

◆ write()

unsigned fipMemoryIO::write ( const void *  buffer,
unsigned  size,
unsigned  count 
)


Writes data to a memory stream

Parameters
bufferPointer to data to be written
sizeItem size in bytes
countMaximum number of items to be written
Returns
Returns the number of full items actually written, which may be less than count if an error occurs
See also
FreeImage_WriteMemory

Member Data Documentation

◆ _hmem

FIMEMORY* fipMemoryIO::_hmem
protected

Pointer to a memory stream.


The documentation for this class was generated from the following file: