FlashPix Comments

Comments in FlashPix files are one contiguous block of memory, a Comments Block. Within the Comments Block are individual Comments which consist of a Comment header and Comment data. The Comment header contains information on the size and type of the Comment. The Comment header may be a FPXCOMMENT_HEADER_ELEMENT, if the Comment consists of a single item (a float or a short for example), or it may be a FPXCOMMENT_HEADER_ARRAY if the Comment consists of an array of items (an array of shorts, an array of chars, or an array of strings for example). These structures are as follows:

FPXCOMMENT_HEADER_ELEMENT

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

Members

size

size of the comment.

type

type of comment stored.

Comments

Size is given in bytes. Type refers to a value within the enumerated type FPXTYPE_DATA.

FPXCOMMENT_HEADER_ARRAY

typedef struct _FPXCOMMENT_HEADER_ARRAY 
{ 
   L_UINT32 size; 
   L_UINT32 type; 
   L_UINT32 elements; 
} FPXCOMMENT_HEADER_ARRAY; 

Members

size

size of the comment.

type

type of comment stored.

elements

number of elements in the array.

Comments

Size is given in bytes. Type refers to a value within the enumerated type FPXTYPE_DATA. Elements provides the number of elements in the array.

Following the Comment header is the Comment data. Comment data may consist of simple data such as a float value, sub-comments, or a combination of one or more simple data and one or more sub-comments. The sections making up a sub-comment will be referred to as sub-comment header and sub-comment data. Both Comments and sub-comments must be of a Comment type.

For example, a Comment of Comment type FlashPixLong would contain a Comment header FPXCOMMENT_HEADER_ELEMENT. This would be followed by the Comment data, consisting of a L_UINT32 (4 bytes) which holds the long value. A Comment of Comment type FlashPixCFAPatternBlock, however, has Comment data consisting of two integer values and a comment of Comment type FlashPixString. A list of FlashPix Comment types is provided at the end of this section. To better understand FlashPix file Comment organization, look through the following example.

Each cell in the graph below indicates 1 byte of memory. Therefore a L_UINT32 is 4 bytes in size.

The values given above the cells indicate the value stored in that segment of memory.

The Comment type is given in brackets beside the Comment name.

Wide characters are 2 bytes in size and are indicated by a character followed by a blank byte.

The example given here contains the Comments present in the "Content Description Group" (CMNT_FPXCONTENTDESCRIPTIONGROUP see FlashPix File Comments.). The first Comment, CMNT_FPXTESTTARGETINTHEIMAGE is of Comment type FlashPixLong. It consists of the FPXCOMMENT_HEADER_ELEMENT and a single Comment data element of type long. Within the Comment header, the leftmost L_UINT32 stores the size of the entire Comment. The 4 bytes of the long data element and the 8 bytes for the 2 L_UINT32 members in the Comment header gives a total of 12 bytes. The right L_UINT32 member in the Comment header stores the value 3 for the Comment type of this Comment [FlashPixLong]. Finally, the last L_UINT32 (data) holds the value of the Comment data itself ( 0x0 ).

The next Comment, CMNT_FPXGROUPCAPTION is very similar. The Comment header stores the size of the entire Comment (34 bytes) as well as the Comment type (FlashPixWideString) and the number of elements (11) in the string. The Comment data contains the string itself (MY FRIENDS). Notice that since the array is made up of wide characters, each character within the string is followed by an empty byte to indicate that the wide characters are 2 bytes in size. The space between words and the final '\0' are included in the number of wide characters.

The next Comment is almost identical to CMNT_FPXGROUPCAPTION.

The next Comment CMNT_FPXPEOPLEINTHEIMAGE gives an example Comment of Comment type FlashPixWideStringArray. This Comment header is FPXCOMMENT_HEADER_ARRAY. The first L_UINT32 stores the size of the entire Comment, including the entire array (52 bytes). Again the next L_UINT32 indicates the Comment type is FlashPixWideStringArray (10). The rightmost L_UINT32 member in the Comment header stores the number of elements present in the array (2). The Comment data consists of multiple sub-comments of Comment type FlashPixWideString which make up the array. Again, these sub-comments consist of a sub-comment header and sub-comment data. The sub-comment header for the first FlashPixWideString sub-comment in the array begins with a L_UINT32 which stores the size of that one string within the array (20 bytes). The next L_UINT32 indicates the Comment type of the sub-comment which follows (9 or FlashPixWideString). Please note that the entire Comment is of type FlashPixWideStringArray, but each member of that array is of Comment type FlashPixWideString. The next L_UINT32 member in the sub-comment header of each wide string stores the number of elements in the string (4). Finally, the sub-comment data of each sub-comment contains the string BOB and TED.

The rest of the Comments may be explained similarly. It is important to note that all of the 1 byte cells seen here represent a contiguous block of memory and therfore would fall side by side in memory. The "exploded" view of the Comment organization is done only to show the individual members of the header and the data section.

image\comment.gif

Comments and sub-comments must be of certain Comment types. The Comment types available are listed below.

The following declarations pertain to the examples included in the Comment type definitions:

FPXCOMMENT_HEADER_ELEMENT *pElement; 
FPXCOMMENT_HEADER_ARRAY *pArray; 
L_UCHAR *pChar; 
L_UINT16 *pShort; 
L_UINT32 *pLong; 
L_FLOAT *pFloat; 
L_DOUBLE *pDouble; 
L_UINT i, j, uBytes; 
L_UCHAR Buffer[1024], String[] = "String"; 

FlashPixCFAPatternBlock ( Comment type)

This comment is used to store the number of rows, number of columns and data array which describe a color pattern. Refer to CMNT_FPXCFAPATTERN in FlashPix File Comments.

L_UNIT32 size_of_structure   
L_UNIT32 type_of_structure   
L_UINT16 cfa_repeat_rows   
L_UINT16 cfa_repeat_cols   
FlashPixString cfa_array 

image\CmntCFA.gif
Member Description
size_of_structure size of this comment
type_of_structure type of this comment = FPXENUM_CFA_PATTERN_BLOCK
cfa_repeat_rows data value containing the number of rows defining the color pattern
cfa_repeat_col data value containing the number of columns defining the color pattern
cfa_array data array of color pattern values

Example

Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.