LAnnContainer::SaveOffset

#include "ltwrappr.h"

virtual L_UINT32 LAnnContainer::SaveOffset(fd, nOffset, uFormat=ANNFMT_NATIVE, bSelected=TRUE, pSaveOptions=NULL)

L_INT fd;

/* Windows file handle */

L_INT32 nOffset;

/* offset within the specified file to embed the saved annotation file */

L_UINT uFormat;

/* file format for saving annotation data */

L_BOOL bSelected;

/* flag that indicates which objects to save */

pSAVEFILEOPTION pSaveOptions;

/* pointer to optional extended save options */

Saves the specified annotations at a specified position in an existing file. This function is available in the Document/Medical Toolkits.

Parameter

Description

fd

The Windows file handle of the file to save.

nOffset

The offset within the specified file to embed the saved annotation file. For example, if you specify 5, then 5 bytes of other data will precede the embedded file.

uFormat

Format for saving annotation data. Possible values are:

 

Value

Meaning

 

ANNFMT_NATIVE

[0x0000] Save the file in the native format for LEAD annotations. NOTE: This format is being replaced by ANNFMT_XML.

 

ANNFMT_WMF

[0x0001] Save the file in the Windows WMF format.

 

ANNFMT_ENCODED

[0x0004] Save the file in a binary format. This file size is smaller and is upward compatible. It also provides better security.

 

ANNFMT_XML

[0x0005] Save the file in an XML text format. This is LEAD’s new text-based format which is upward-compatible. It should be used instead of ANNFMT_NATIVE.

bSelected

Flag that indicates which objects to save. Possible values are:

 

Value

Meaning

 

TRUE

Save all objects that have the selected property set to TRUE. For getting and setting the selected property, use the LAnnotation::IsSelected and LAnnotation::SetSelected functions.

 

FALSE

Save only the specified object.

pSaveOptions

Pointer to a SAVEFILEOPTION structure that contains optional extended save options. This information is used to add annotation pages or replace annotation pages in a multi-page annotation file. Pass NULL to save a one-page annotation file.

Returns

The size of the embedded file.

Comments

In version 14.5, the text-based format ANNFMT_XML is being introduced. It has many advantages over ANNFMT_NATIVE and ANNFMT_ENCODED including:

image\sqrblit.gif It is both forward- and backward-compatible.

image\sqrblit.gif It is human readable.

image\sqrblit.gif It can be easily modified using a standard text editor (i.e. notepad.exe).

image\sqrblit.gif It can be easily parsed using any standard XML parser.

image\sqrblit.gif It can be used with any of the growing number of utilities that work with XML.

Save annotations in the WMF format only for use in another application. LEADTOOLS reads annotations only in the native format.

To retain scaling and positioning information, this function always saves the root container, along with the specified object or selected objects. Use the bSelected parameter as follows:

image\sqrblit.gif To save only selected objects in a container, set bSelected to TRUE.

image\sqrblit.gif To save all objects in a container, set bSelected to FALSE.

This function overwrites existing data at the specified location in the file. You can use this function to update an image that you loaded with the LAnnContainer::LoadOffset function. The offset is specified in bytes. You must open the file and get a Windows file handle before calling this function.

The information in the SAVEFILEOPTION structure can be used to add new pages or replace existing pages in a multi-page annotation file of type ANNFMT_NATIVE, ANNFMT_ENCODED or ANNFMT_XML. Note that all the pages of an annotation multi-page file must be all of type ANNFMT_NATIVE or all of type ANNFMT_ENCODED or all of type ANNFMT_XML. An annotation file cannot contain pages of different format types.

To insert new pages to an annotation multi-page file:

1.

Declare a variable of type SAVEFILEOPTION.

2.

Set the uFlags field of the SAVEFILEOPTION structure to ESO_INSERTPAGE.

3.

Set the PageNumber field of the SAVEFILEOPTION structure to the location for insertion. The new page will be inserted in front of the page specified in the PageNumber field.

To replace an existing page in an annotation multi-page file:

1.

Declare a variable of type SAVEFILEOPTION.

2.

Set the uFlags field of the SAVEFILEOPTION structure to ESO_REPLACEPAGE.

3.

Set the PageNumber field of the SAVEFILEOPTION structure to the page to replace.

To delete a page from an annotation multi-page file, use LAnnContainer::DeletePage, LAnnContainer::DeletePageMemory, or LAnnContainer::DeletePageOffset.

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnnContainer::Save, LAnnContainer::SaveMemory, LAnnContainer::SaveTag, LAnnContainer::FileInfoOffset, LAnnContainer::DeletePageOffset, Class Members, LAnnotation::GetOptions, LAnnotation::SetOptions

Topics:

Annotation Functions: Input and Output

 

Implementing Annotations

 

New Annotation Features of Version 14.5

Example

For an example, refer to LAnnContainer::LoadOffset.