ImageGear Professional v18.1 > User Guide > Using ImageGear > Loading and Saving Images > Format Filter Control Parameters |
Almost every format filter in ImageGear has some attributes on which it depends while processing operations such as READ, WRITE, etc. Those attributes may be attributes declared by the format filter specification or may be specific to its implementation by ImageGear. ImageGear has a general public interface implemented and named as format filter control parameters. Every such control parameter is identified by the format filter and string name and has an associated type of acceptable value, the value itself, and the default value. Each control parameter is filter specific. The ImageGear Supported File Formats Reference describes the filters, and also describes each control parameter for each format filter.
The ImageGear Filters API has three functions that allow you to get/set info about every supported filter control parameter:
This function allows the application to get the list of names of all control parameters supported by the format filter identified by dwFormatID. The Application is responsible for allocating the buffer lpArray, but ImageGear sets the elements of this array as pointers to strings with control parameter names. You can use the control parameter names as input values for the second argument of the next two functions.
This example demonstrates how to get the names of all supported control parameters for the TIFF format filter:
Copy Code
|
|
---|---|
/* getting the total number of parameters */ nErrCount = IG_fltr_ctrl_list(IG_FORMAT_TIF, &nCount, NULL, 0); if(!nErrCount && nCount > 0) { /* allocate required buffer to keep all names */ lpOptList = malloc(nCount * sizeof(DWORD)); if(lpArray) { nErrCount = IG_fltr_ctrl_list(IG_FORMAT_TIF, NULL, lpOptList, nCount * sizeof(DWORD)); |
The filter control parameters you work with using IG_fltr_ctrl_...() functions are strings. Refer to the "Filter Control Parameters" Tables for each file format in the ImageGear Supported File Formats Reference section. |
This example demonstrates how to get and set the value of the TIFF control parameter named "BIG_ENDIAN":
Copy Code
|
|
---|---|
char DocumentName[_MAX_PATH]; AT_BOOL bDefBigEndian, bOldBigEndian; ... /* get current value of BIG_ENDIAN control parameter */ IG_fltr_ctrl_get(IG_FORMAT_TIF, "BIG_ENDIAN", FALSE, NULL, NULL, (LPVOID)&bOldBigEndian, sizeof(hOldBigEndian)); /* get default value of BIG_ENDIAN control parameter */ IG_fltr_ctrl_get(IG_FORMAT_TIF, "BIG_ENDIAN", TRUE, NULL, NULL, (LPVOID)&bDefBigEndian, sizeof(hDefBigEndian)); /* get current value of DOCUMENT_NAME control parameter */ IG_fltr_ctrl_get(IG_FORMAT_TIF, "DOCUMENT_NAME", FALSE, NULL, NULL, DocumentName, sizeof(DocumentName)); /* set new value to BIG_ENDIAN control parameter */ IG_fltr_ctrl_set(IG_FORMAT_TIF, "BIG_ENDIAN", (LPVOID)TRUE, sizeof(AT_BOOL)); /* set new value to DOCUMENT_NAME control parameter */ strcpy( DocumentName, "This is a test string for DocumentName" ); IG_fltr_ctrl_set(IG_FORMAT_TIF, "DOCUMENT_NAME", (LPVOID)DocumentName, sizeof(DocumentName)); |
For the TXT Filter, to set the LINES_PER_PAGE and CHAR_PER_LINE control parameters, set the POINT_SIZE control parameter to zero; setting the PAGE_WIDTH, PAGE_HEIGHT, and POINT_SIZE parameters provides a sufficient page description, and LINES_PER_PAGE and CHAR_PER_LINE options are ignored. |