Writes a comment into a FlashPix file. Only used to change a comment in an existing file.
#include "ltwrappr.h"
virtual L_INT LFile::WriteComment(uType, pComments, pSaveFileOption=NULL)
The type of comment. Refer to Types of File Comments. For more information concerning FlashPix file comments, refer to FlashPix File Comments.
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.
Pointer to optional extended save options. Pass NULL to use the default save options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Presently this function only works with FlashPix format files.
To write comments to a file, all the comments you wish to add to the file must be set using LFileSettings::SetComment. Once all comments are set, the comments are saved using any function which saves files, such as LFile::SaveFile or LFile::Save when creating a new file, or LFile::WriteComment when changing a comment in an existing file. LFileSettings::SetComment, by itself, does not write a comment to a file, it prepares the values for the next save.
When you add or remove comments or tags, the comments and tags array at the end of the image file is re-written. When you modify existing comments or tags, the new value is added to the file and the IFD is modified as necessary. In all of these cases, there is no image recompression.
Some restrictions apply to this function if you use an IFD to indicate to which page to write the comment. For more information, refer to Loading and Saving Large TIFF/BigTIFF Files.
Win32, x64.
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;
typedef struct _FPXCOMMENT_HEADER_ARRAY
{
L_UINT32 size;
L_UINT32 type;
L_UINT32 elements;
}FPXCOMMENT_HEADER_ARRAY;
L_INT LFile__WriteCommentExample()
{
L_INT nRet;
LFile file;
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 *)(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;
file.SetFileName(MAKE_IMAGE_PATH(TEXT("image1.FPX")));
nRet = file.WriteComment(CMNT_FPXFILMDESCRIPTIONGROUP, &FileComments, NULL);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document