FreeImagePlus - FreeImage 3.17.0
Public Member Functions | Protected Attributes
fipMultiPage Class Reference

Multi-page file stream. More...

#include <FreeImagePlus.h>

Inheritance diagram for fipMultiPage:
fipObject

List of all members.

Public Member Functions

 fipMultiPage (BOOL keep_cache_in_memory=FALSE)
 Constructor.
virtual ~fipMultiPage ()
 Destructor Close the file stream if not already done.
BOOL isValid () const
 Returns TRUE if the multi-page stream is opened.
 operator FIMULTIBITMAP * ()
 Returns a pointer to the FIMULTIBITMAP data.
BOOL open (const char *lpszPathName, BOOL create_new, BOOL read_only, int flags=0)
 Open a multi-page file stream.
BOOL open (fipMemoryIO &memIO, int flags=0)
 Open a multi-page memory stream as read/write.
BOOL open (FreeImageIO *io, fi_handle handle, int flags=0)
 Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag.
BOOL close (int flags=0)
 Close a file stream.
BOOL saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags=0) const
 Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag.
BOOL saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flags=0) const
 Saves a multi-page image using the specified memory stream and an optional flag.
int getPageCount () const
 Returns the number of pages currently available in the multi-paged bitmap.
void appendPage (fipImage &image)
 Appends a new page to the end of the bitmap.
void insertPage (int page, fipImage &image)
 Inserts a new page before the given position in the bitmap.
void deletePage (int page)
 Deletes the page on the given position.
BOOL movePage (int target, int source)
 Moves the source page to the position of the target page.
FIBITMAP * lockPage (int page)
 Locks a page in memory for editing.
void unlockPage (fipImage &image, BOOL changed)
 Unlocks a previously locked page and gives it back to the multi-page engine.
BOOL getLockedPageNumbers (int *pages, int *count) const
 Returns an array of page-numbers that are currently locked in memory.

Protected Attributes

FIMULTIBITMAP * _mpage
 Pointer to a multi-page file stream.
BOOL _bMemoryCache
 TRUE when using a memory cache, FALSE otherwise.

Detailed Description

Multi-page file stream.

fipMultiPage encapsulates the multi-page API. It supports reading/writing multi-page TIFF, ICO and GIF files.


Constructor & Destructor Documentation

fipMultiPage::fipMultiPage ( BOOL  keep_cache_in_memory = FALSE)

Constructor.

Parameters:
keep_cache_in_memoryWhen it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks.
virtual fipMultiPage::~fipMultiPage ( ) [virtual]

Destructor Close the file stream if not already done.


Member Function Documentation

void fipMultiPage::appendPage ( fipImage image)

Appends a new page to the end of the bitmap.

Parameters:
imageImage to append
See also:
FreeImage_AppendPage
BOOL fipMultiPage::close ( int  flags = 0)

Close a file stream.

Parameters:
flagsSave flags. The signification of this flag depends on the image to be saved.
Returns:
Returns TRUE if successful, returns FALSE otherwise
See also:
FreeImage_CloseMultiBitmap
void fipMultiPage::deletePage ( int  page)

Deletes the page on the given position.

Parameters:
pagePage number
See also:
FreeImage_DeletePage
BOOL fipMultiPage::getLockedPageNumbers ( int *  pages,
int *  count 
) const

Returns an array of page-numbers that are currently locked in memory.

When the pages parameter is NULL, the size of the array is returned in the count variable. You can then allocate the array of the desired size and call getLockedPageNumbers again to populate the array.

Returns:
Returns TRUE if successful, returns FALSE otherwise
See also:
FreeImage_GetLockedPageNumbers
int fipMultiPage::getPageCount ( ) const

Returns the number of pages currently available in the multi-paged bitmap.

See also:
FreeImage_GetPageCount
void fipMultiPage::insertPage ( int  page,
fipImage image 
)

Inserts a new page before the given position in the bitmap.

Parameters:
pagePage number. Page has to be a number smaller than the current number of pages available in the bitmap.
imageImage to insert
See also:
FreeImage_InsertPage
BOOL fipMultiPage::isValid ( ) const [virtual]

Returns TRUE if the multi-page stream is opened.

Implements fipObject.

FIBITMAP* fipMultiPage::lockPage ( int  page)

Locks a page in memory for editing.

You must call unlockPage to free the page
Usage :

	fipMultiPage mpage;
...
	fipImage image;		// You must declare this before
	image = mpage.lockPage(2);
	if(image.isValid()) {
...
	  mpage.unlockPage(image, TRUE);
	}
	
Parameters:
pagePage number
Returns:
Returns the page if successful, returns NULL otherwise
See also:
FreeImage_LockPage
BOOL fipMultiPage::movePage ( int  target,
int  source 
)

Moves the source page to the position of the target page.

Parameters:
targetTarget page position
sourceSource page position
Returns:
Returns TRUE if successful, returns FALSE otherwise
See also:
FreeImage_MovePage
BOOL fipMultiPage::open ( const char *  lpszPathName,
BOOL  create_new,
BOOL  read_only,
int  flags = 0 
)

Open a multi-page file stream.

Parameters:
lpszPathNameName of the multi-page bitmap file
create_newWhen TRUE, it means that a new bitmap will be created rather than an existing one being opened
read_onlyWhen TRUE the bitmap is opened read-only
flagsLoad flags. The signification of this flag depends on the image to be loaded.
Returns:
Returns TRUE if successful, returns FALSE otherwise
See also:
FreeImage_OpenMultiBitmap
BOOL fipMultiPage::open ( fipMemoryIO memIO,
int  flags = 0 
)

Open a multi-page memory stream as read/write.

Parameters:
memIOMemory stream. The memory stream MUST BE a wrapped user buffer.
flagsLoad flags. The signification of this flag depends on the image to be loaded.
Returns:
Returns TRUE if successful, returns FALSE otherwise
See also:
FreeImage_LoadMultiBitmapFromMemory
BOOL fipMultiPage::open ( FreeImageIO *  io,
fi_handle  handle,
int  flags = 0 
)

Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:
ioFreeImageIO structure
handleFreeImage fi_handle
flagThe signification of this flag depends on the image to be read.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_OpenMultiBitmapFromHandle
fipMultiPage::operator FIMULTIBITMAP * ( ) [inline]

Returns a pointer to the FIMULTIBITMAP data.

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

BOOL fipMultiPage::saveToHandle ( FREE_IMAGE_FORMAT  fif,
FreeImageIO *  io,
fi_handle  handle,
int  flags = 0 
) const

Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:
fifFormat identifier (FreeImage format)
ioFreeImageIO structure
handleFreeImage fi_handle
flagThe signification of this flag depends on the multi-page image to be saved.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SaveMultiBitmapToHandle, FreeImage documentation
BOOL fipMultiPage::saveToMemory ( FREE_IMAGE_FORMAT  fif,
fipMemoryIO memIO,
int  flags = 0 
) const

Saves a multi-page image using the specified memory stream and an optional flag.

Parameters:
fifFormat identifier (FreeImage format)
memIOFreeImage memory stream
flagThe signification of this flag depends on the image to be saved.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SaveMultiBitmapToMemory, FreeImage documentation
void fipMultiPage::unlockPage ( fipImage image,
BOOL  changed 
)

Unlocks a previously locked page and gives it back to the multi-page engine.

Parameters:
imagePage to unlock
changedWhen TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap.
See also:
FreeImage_UnlockPage

Member Data Documentation

BOOL fipMultiPage::_bMemoryCache [protected]

TRUE when using a memory cache, FALSE otherwise.

FIMULTIBITMAP* fipMultiPage::_mpage [protected]

Pointer to a multi-page file stream.


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