#include "ltwrappr.h"
virtual L_INT LMemoryFile::ReadTag(LMemoryBuffer, pLTagDataBuffer, uTag, pType, pCount, pLoadFileOption=NULL)
LBuffer& LMemoryBuffer; |
an LBuffer object |
LBuffer * pLTagDataBuffer; |
pointer to an LBuffer object |
L_UINT16 uTag; |
tag to identify the data in the TIFF file |
L_UINT16 * pType; |
address of the variable to be updated with the data type |
L_UINT * pCount; |
address of the variable to be updated with the count |
pLOADFILEOPTION pLoadFileOption; |
pointer to optional extended load options |
Gets the specified tagged data from a TIFF file in memory. This function is provided to support TIFF tags that you define.
| Parameter | Description | |
| LMemoryBuffer | A LEAD LBuffer object that contains the file in memory. | |
| pLTagDataBuffer | Pointer to the buffer to be updated with the data. You can pass NULL if you want to use this function's return value to determine the required buffer size. | |
| uTag | Tag to identify the data in the TIFF file. Use the same tag that you specified in the LFileSettings::SetTag function. | |
| pType | Address of the variable to be updated with the tagged data type. Possible values are: | |
| Value | Meaning | |
| TAG_BYTE | [1] Byte. | |
| TAG_ASCII | [2] Byte in the range of 0 to 255. | |
| TAG_SBYTE | [6] Byte used as signed number in the range of -128 to +127. | |
| TAG_UNDEFINED | [7] Byte, with application-defined usage. | |
| TAG_SHORT | [3] Two bytes, unsigned. | |
| TAG_SSHORT | [8] Two bytes, signed. | |
| TAG_LONG | [4] Four bytes, unsigned. | |
| TAG_SLONG | [9] Four bytes, signed. | |
| TAG_RATIONAL | [5] Eight bytes, used as a pair of unsigned long integers, where the first number is the numerator and the second is the denominator of a fraction. | |
| TAG_SRATIONAL | [10] Eight bytes, used as a pair of signed long integers, where the first number is the numerator and the second is the denominator of a fraction. | |
| TAG_FLOAT | [11] Four bytes used as a floating point number. | |
| TAG_DOUBLE | [12] Eight bytes used as a double-precision floating point number. | |
| TAG_IFD | [13] 32-bit IFD offset. | |
| TAG_LONG8 | [16] Unsigned 64-bit integer (valid only for BigTIFF formats). | |
| TAG_SLONG8 | [17] Signed 64-bit integer (valid only for BigTIFF formats). | |
| TAG_IFD8 | [18] 64-bit IFD offset (valid only for BigTIFF formats). | |
| pCount | Address of the variable to be updated with the count of data items. The count is based on the tagged data type. For example, if the count is 2 and the data type is TAG_DOUBLE, the required buffer size is 16. | |
| pLoadFileOption | Pointer to optional extended load options. Pass NULL to use the default load options. | |
>= 0 |
Length of the tagged data, in bytes. |
< 0 |
An error occurred. Refer to Return Codes. |
It is often convenient to call this function twice, as follows:
1. |
Call the function the first time, specifying NULL in the pLTagDataBuffer parameter, and using the return value to determine the required size of the buffer. |
2. |
Allocate the buffer. |
3. |
Call the function the second time, passing a pointer to your buffer in the pLTagDataBuffer parameter. |
For general information about TIFF tags, refer to Implementing TIFF Comments and Tags.
The LMemoryBuffer parameter is passed by reference, and is a required parameter.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
|
Topics: |
L_INT LMemoryFile__ReadTagExample(){L_INT nRet;LMemoryFile LeadMemFile;LBuffer LeadMemBuffer ;LBuffer LeadCommBuffer ;LFile LeadFile;LBitmapBase LeadBitmap;L_UINT16 LogoPosition = 0x8001; // my private tagsL_UINT16 TagType = TAG_SSHORT; // tagged data typeL_UINT32 TagCount = 4; // count of data itemsL_INT32 BufferSize ;L_INT TagData[] = {5, 5, 24, 37,};L_VOID *pTagData = &TagData; // pointer to the buffer containing tagged dataLeadFile.SetBitmap(&LeadBitmap);LeadFile.SetFileName(MAKE_IMAGE_PATH(TEXT("clean.tif")));nRet = LeadFile.Load();if(nRet != SUCCESS)return nRet;// Set the tag data to be savednRet = LFileSettings::SetTag(LogoPosition, TagType, TagCount, pTagData);if(nRet != SUCCESS)return nRet;LeadMemFile.SetBitmap(&LeadBitmap);nRet =LeadMemFile.Save(&LeadMemBuffer,FILE_TIF,8,NULL) ;if(nRet != SUCCESS)return nRet;// Get the required size of the buffer for the tagged dataBufferSize = LeadMemFile.ReadTag(LeadMemBuffer, NULL, LogoPosition, &TagType, &TagCount, NULL);if ((TagType != TAG_SSHORT) || (BufferSize < 0))return FAILURE;else{// Allocate the buffernRet = LeadCommBuffer.Reallocate(BufferSize);if(nRet != SUCCESS)return nRet;}// Get the tagged dataBufferSize = LeadMemFile.ReadTag(LeadMemBuffer, &LeadCommBuffer, LogoPosition, &TagType, &TagCount);if (BufferSize >= 0)MessageBox(NULL, TEXT("ReadTag successful"), TEXT("TAG Memory"),MB_OK) ;elsereturn FAILURE;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
