#include "l_bitmap.h"
L_LTFIL_API L_INT L_GetFileCommentSize(pszFile, uType, uLength, pLoadOptions)
Gets the size, in bytes, of the comments.
Character string containing the FlashPix file name.
The type of comment. Refer to Types of File Comments.
A group of comments may be obtained such as CMNT_FPXSUMMARYINFORMATION, or more than one group of comments may be retrieved by using OR as in CMNT_FPXSUMMARYINFORMATION | CMNT_FPXFILESOURCEGROUP, or all comments may be obtained by using CMNT_ALL. See "Example" under L_ReadFileCommentExt.
For more information concerning FlashPix file comments, refer to FlashPix File Comments.
Pointer to the size of the comments requested.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Presently this function only works with FlashPix files.
To write comments to a file, all the comments you wish to add to a file must be set using L_SetComment. The L_SetComment function sets each comment individually, but it does not save the comments to the 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. If you wish to change a comment in an existing file, use L_WriteFileCommentExt.
The basic order of function calls for reading comments is as follows:
Required DLLs and Libraries
Win32, x64, Linux.
For an example, refer to L_ReadFileCommentExt.
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 GetFileCommentSizeExample(L_VOID)
{
L_INT nRet;
L_INT I;
L_TCHAR szTemp[80];
L_UINT32 uLength;
L_TCHAR szMessage[80];
HGLOBAL hTextToGet;
L_UCHAR *pTextToGet;
L_FLOAT *pFloat;
L_CHAR *pString;
L_TCHAR szBuf[80];
FPXCOMMENT_HEADER_ARRAY *pArray;
FPXCOMMENT_HEADER_ELEMENT *pElement;
//Read one comment - data type: FlashPixFloatArray
nRet = L_GetFileCommentSize(MAKE_IMAGE_PATH(TEXT("IMAGE1.FPX")), CMNT_FPXBRIGHTNESSVALUE, &uLength, NULL);
if(nRet !=SUCCESS)
return nRet;
if( uLength )
{
hTextToGet = GlobalAlloc(GPTR, uLength);
pTextToGet = (L_UCHAR *)GlobalLock(hTextToGet);
nRet =L_ReadFileComment(MAKE_IMAGE_PATH(TEXT("IMAGE1.FPX")), CMNT_FPXBRIGHTNESSVALUE, pTextToGet, uLength, NULL);
if(nRet !=SUCCESS)
return nRet;
pArray = (FPXCOMMENT_HEADER_ARRAY *)pTextToGet;
if(pArray != NULL)
{
szMessage[0] = '\0';
pFloat = (L_FLOAT *)(pArray + 1);
for(I = 0; I < (L_INT)pArray->elements; I++)
{
_stprintf_s(szTemp,80, TEXT("%5.2f"), pFloat[I]);
lstrcat(szMessage, szTemp);
}
MessageBox(NULL, szMessage, TEXT("Brightness Values"), MB_OK);
}
GlobalFree(hTextToGet);
}
//Read one comment - data type: FlashPixString
nRet = L_GetFileCommentSize(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), CMNT_FPXTITLE, &uLength, NULL);
if(nRet != SUCCESS)
return nRet;
if( uLength )
{
hTextToGet = GlobalAlloc(GPTR, uLength);
pTextToGet = (L_UCHAR *)GlobalLock(hTextToGet);
nRet = L_ReadFileComment(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), CMNT_FPXTITLE, pTextToGet, uLength, NULL);
if(nRet != SUCCESS)
return nRet;
pArray = (FPXCOMMENT_HEADER_ARRAY *)pTextToGet;
if(pArray != NULL)
{
pString = (L_CHAR *)(pArray + 1); /* points to first position after header*/
wsprintf (szBuf, TEXT("%hs"), pString);
MessageBox (NULL, szBuf, TEXT("Title"), MB_OK);
}
GlobalFree(hTextToGet);
}
//Read one comment - data type: FlashPixFloat
nRet =L_GetFileCommentSize(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), CMNT_FPXEXPOSURETIME, &uLength, NULL);
if(nRet !=SUCCESS)
return nRet;
if( uLength )
{
hTextToGet = GlobalAlloc(GPTR, uLength);
pTextToGet = (L_UCHAR *)GlobalLock(hTextToGet);
nRet =L_ReadFileComment(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), CMNT_FPXEXPOSURETIME, pTextToGet, uLength, NULL);
if(nRet !=SUCCESS)
return nRet;
pElement = (FPXCOMMENT_HEADER_ELEMENT *)pTextToGet;
if(pElement != NULL)
{
pFloat = (L_FLOAT *)(pElement + 1);
_stprintf_s(szMessage,80, TEXT("%f"), *pFloat);
MessageBox(NULL, szMessage, TEXT("Exposure Time"), MB_OK);
}
GlobalFree(hTextToGet);
}
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