L_WriteFileCommentExt

#include "l_bitmap.h"

L_LTFIL_API L_INT L_WriteFileCommentExt (pszFile, uType, pComments, pSaveOptions)

L_TCHAR* pszFile;

/* file name */

L_UINT uType;

/* type of comment */

pFILECOMMENTS pComments;

/*pointer to a FILECOMMENTS structure containing information about the comments */

pSAVEFILEOPTION pSaveOptions;

/* pointer to optional extended save options */

Writes a comment into a FlashPix file. Only used to change a comment in an existing file.

Parameter

Description

pszFile

Character string containing the FlashPix file name.

uType

The type of comment. Refer to Types of File Comments. For more information concerning FlashPix file comments, see FlashPix File Comments.

pComments

Pointer to a structure which contains one data value and two pointers. The data value indicates the number of comments stored. One pointer points to an array of pointers which in turn point to individual Comments. The other pointer points to an array of integers which indicate the size of each Comment stored.

pSaveOptions

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Presently this function only works with FlashPix format files.

To write comments to a file, all the comments to be added to the file must be set using L_SetComment. L_SetComment, by itself, does not write a comment to a file, it prepares the values for the next save. Once all comments are set, the comments are saved using any function which saves files, such as L_SaveFile or L_SaveBitmap when creating a new file.

To save TIFF comments without overwriting a saved image, use L_WriteFileComment.

Required DLLs and Libraries

LTFIL
File format DLLs

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

Platforms

Win32, x64, Mobile.

See Also

Functions:

L_ReadFileComment, L_WriteFileComment, L_ReadFileCommentExt, L_SetComment, L_GetFileCommentSize, L_WriteFileMetaData, L_ReadFileComments

Topics:

Raster Image Functions: Maintaining File Comments,

 

Loading and Saving Images

 

For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.

Example

typedef enum 
{
   FPXENUM_BOOL = 0,
   FPXENUM_SHORT,
   FPXENUM_SHORT_ARRAY,
   FPXENUM_LONG,
   FPXENUM_LONG_ARRAY,
   FPXENUM_FLOAT,
   FPXENUM_FLOAT_ARRAY,
   FPXENUM_STRING,
   FPXENUM_STRING_ARRAY,
   FPXENUM_WIDE_STRING,
   FPXENUM_WIDE_STRING_ARRAY,
   FPXENUM_THUMBNAIL,
   FPXENUM_SPACIAL_FREQUENCY_RESPONSE_BLOCK,
   FPXENUM_OECF_BLOCK,
   FPXENUM_CFA_PATTERN_BLOCK,
   FPXENUM_SCANNED_IMAGE_BLOCK_SIZE,
   FPXENUM_SYSTEM_TIME,
   FPXENUM_DATE
} FPXTYPE_DATA;

typedef struct _FPXCOMMENT_HEADER_ELEMENT
{
   L_UINT32 size; 
   L_UINT32 type; 
} FPXCOMMENT_HEADER_ELEMENT;

 L_INT WriteFileCommentExtExample(L_VOID)
{
   L_INT nRet;
   FILECOMMENTS FileComments;
   L_UCHAR *pPointer[CMNT_LAST + 1];
   L_UINT   uSize[CMNT_LAST + 1];
   FPXCOMMENT_HEADER_ELEMENT *pElement;
   L_UINT16  *pShort;
   L_FLOAT *pFloat;
   L_UINT   I;
   L_UCHAR  Buffer[1024];

   FileComments.count  = CMNT_LAST + 1;
   FileComments.pointer  = pPointer;
   FileComments.size = uSize;

   for ( I = 0; I < CMNT_LAST; I++)
   {
    uSize[I] = 0;
    pPointer[I] = NULL;
   }

   pElement = (FPXCOMMENT_HEADER_ELEMENT *) Buffer;
   pElement->size = sizeof(FPXCOMMENT_HEADER_ELEMENT) + sizeof(L_FLOAT);
   pElement->type = FPXENUM_FLOAT;
   pFloat  = (L_FLOAT *)(L_UINT16 *)(pElement + 1);
   *pFloat  = 12.34f;
   uSize[CMNT_FPXFILMSIZEX] = pElement->size;
   pPointer[CMNT_FPXFILMSIZEX] = (L_UCHAR *)pElement;
   pElement = (FPXCOMMENT_HEADER_ELEMENT *)(pFloat + 1);
   pElement->size = sizeof(FPXCOMMENT_HEADER_ELEMENT) + sizeof(L_UINT16);
   pElement->type = FPXENUM_SHORT;
   pShort  = (L_UINT16 *)(pElement + 1);
   *pShort  = 1234;
   uSize[CMNT_FPXFILMFRAMENUMBER] = pElement->size;
   pPointer[CMNT_FPXFILMFRAMENUMBER] = (L_UCHAR *)pElement;

   nRet = L_WriteFileCommentExt(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), CMNT_FPXFILMDESCRIPTIONGROUP, &FileComments, NULL);
   if(nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}