Module fipMultiPage
Corona wrapper for fipMultiPage, a multi-page file stream.
fipMultiPage encapsulates the multi-page API. It supports reading/writing multi-page TIFF, ICO and GIF files.
Functions
fipMultiPage:appendPage (image) | Appends a new page to the end of the bitmap. |
fipMultiPage:close (flags) | Close a file stream. |
fipMultiPage:deletePage (page) | Deletes the page on the given position. |
fipMultiPage:getLockedPageNumbers () | Returns an array of page-numbers that are currently locked in memory. |
fipMultiPage:getPageCount () | Returns the number of pages currently available in the multi-paged bitmap. |
fipMultiPage:insertPage (page, image) | Inserts a new page before the given position in the bitmap. |
fipMultiPage:isValid () | Indicates whether the multi-page is valid for use. |
fipMultiPage:lockPage (page) | Locks a page in memory for editing. |
fipMultiPage:movePage (target, source) | Moves the source page to the position of the target page. |
fipMultiPage:open (name, create_new, read_only, flags) | Open a multi-page file. |
fipMultiPage:open (memIO, flags) | Open a multi-page memory stream as read / write. |
fipMultiPage:saveToMemory (memIO, flags) | Saves a multi-page image using the specified memory stream and an optional flag. |
fipMultiPage:unlockPage (image, changed) | Unlocks a previously locked page and gives it back to the multi-page engine. |
Functions
- fipMultiPage:appendPage (image)
-
Appends a new page to the end of the bitmap.
Parameters:
- image fipImage Image to append.
- fipMultiPage:close (flags)
-
Close a file stream.
TODO: flags not quite right
Parameters:
- flags {string,...}, string or nil Format-dependent (save) flags.
Returns:
-
boolean
Operation was successful?
- fipMultiPage:deletePage (page)
-
Deletes the page on the given position.
Parameters:
- page int Page number.
- fipMultiPage:getLockedPageNumbers ()
-
Returns an array of page-numbers that are currently locked in memory.
Returns:
- boolean Operation was successful?
- {int,...} On success, array of page numbers.
- fipMultiPage:getPageCount ()
-
Returns the number of pages currently available in the multi-paged bitmap.
Returns:
-
int
Count.
- fipMultiPage:insertPage (page, image)
-
Inserts a new page before the given position in the bitmap.
Parameters:
- page int Page number. Page has to be a number smaller than the current number of pages available in the bitmap.
- image fipImage Image to insert.
- fipMultiPage:isValid ()
-
Indicates whether the multi-page is valid for use.
Returns:
-
boolean
The multi-page stream is opened?
- fipMultiPage:lockPage (page)
-
Locks a page in memory for editing.
You must call fipMultiPage:unlockPage to free the page.
Usage: (TODO: Lua)
fipMultiPage mpage; -- ... -- fipImage image; -- You must declare this before image = mpage.lockPage(2); if(image.isValid()) { ... mpage.unlockPage(image, TRUE); }
Parameters:
- page int Page number.
Returns:
-
userdata or nil
On success, the page; otherwise nil. (TODO?)
- fipMultiPage:movePage (target, source)
-
Moves the source page to the position of the target page.
Parameters:
- target int Target page position.
- source int Source page position.
Returns:
-
boolean
Operation was successful?
- fipMultiPage:open (name, create_new, read_only, flags)
-
Open a multi-page file.
Parameters:
- name string Name of the multi-page bitmap file.
- create_new bool When true, it means that a new bitmap will be created rather than an existing one being opened.
- read_only bool When true the bitmap is opened read-only.
- flags {string,...}, string or nil Format-dependent flags.
Returns:
-
boolean
Operation was successful?
- fipMultiPage:open (memIO, flags)
-
Open a multi-page memory stream as read / write.
Parameters:
- memIO fipMemoryIO Memory stream. The memory stream MUST BE a wrapped user buffer.
- flags {string,...}, string or nil Format-dependent flags.
Returns:
-
boolean
Operation was successful?
- fipMultiPage:saveToMemory (memIO, flags)
-
Saves a multi-page image using the specified memory stream and an optional flag.
Parameters:
- memIO fipMemoryIO
- flags {string,...}, string or nil Format-dependent flags.
Returns:
-
boolean
Operation was successful?
- fipMultiPage:unlockPage (image, changed)
-
Unlocks a previously locked page and gives it back to the multi-page engine.
Parameters:
- image fipImage Page to unlock.
- changed bool When true, the page is marked changed and the new page data is applied in the multi-page bitmap.