ImageGear for C and C++ on Windows v19.10 - Updated
IG_ISIS_choice_get_flags
API Reference Guide > ISIS Component API Reference > ISIS Component Functions Reference > Choice Functions > IG_ISIS_choice_get_flags

Get a flag word for a tag.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_ISIS_choice_get_flags(
        HISISDRV hDriver,
        AT_MODE nTag,
        LPAT_LMODE lpFlags
);

Arguments:

Name Type Description
hDriver HISISDRV The handle to the driver.
nTag AT_MODE The tag for which the flag word is being requested.
lpFlags LPAT_LMODE A pointer to a buffer that will contain the result of IG_ISIS_choice_get_flags. Currently, only two bits of lpFlags are defined:
  • IG_ISIS_CONT_RANGE - Choice values are represented internally as a range, with a low value, a high value, and a step value.
  • IG_ISIS_CONT_LIST - Choice values are represented internally as a simple list of values.

Return Value:

Error count.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

The following example shows how to use IG_ISIS_choice_get_flags to determine whether a particular tag is a list or a range. This is part of a sample that determines whether a scanner can output binary, grayscale, or color.

 
Copy Code
main()
{
        LONG lBits, lSamps, lFlags;
        WORD wCount, iIndex;
        HISISDRV hScan;
        AT_ERRCOUNT nErrCount;
/* Load & init a scanner driver.                                                    */
        nErrCount = IG_ISIS_drv_load_init_pipe(0, "NIKON", &hScan, 0);
/* Find out how many choices for SAMPLESPERPIXEL.                                                       */IG_ISIS_choice_get_count(hScan, IG_ISIS_TAG_SAMPLESPERPIXEL, &wCount);
/* Get and set values for SAMPLESPERPIXEL one at a time.                                                        */
        for (iIndex = 0; iIndex < wCount; iIndex++) {IG_ISIS_choice_get_long(hScan, IG_ISIS_TAG_SAMPLESPERPIXEL, iIndex,
                                        &lSamps);IG_ISIS_tag_set_long(hScan, IG_ISIS_TAG_SAMPLESPERPIXEL, 0, lSamps);
/* If SAMPLESPERPIXEL is 1, then must be binary or grayscale.                                                   */
                if (lSamps == 1) {
                        LONG lValue;
/* Determine whether BITSPERSAMPLE is list or range.                                                    */IG_ISIS_choice_get_flags(hScan, IG_ISIS_TAG_BITSPERSAMPLE, &lFlags);
/* Handle case where BITSPERSAMPLE is a list.                                                   */
                        if (lFlags & IG_ISIS_CONT_LIST) {
                                WORD iIndex, wCount;
                                LONG lBits;IG_ISIS_choice_get_count(hScan, IG_ISIS_TAG_BITSPERSAMPLE, &wCount);
                                for (iIndex = 0; iIndex < wCount; iIndex++) {IG_ISIS_choice_get_long(hScan, IG_ISIS_TAG_BITSPERSAMPLE,
                                                iIndex, &lBits);
                                        if (lBits==1)
                                                printf("Binary is supported\n");
                                        else
                                                printf("%d-bit grayscale is supported\n",
                                                     INT16)lBits);
                                }
                        }
                        else
/* Handle other cases.                                                                                                  */
                        .
                        .
                        .

Remarks:

The IG_ISIS_choice_get_flags function fills in lpdwFlags with the flag word from tag nTag. The values contained in this flag word are described below, under "Structures."

The flag word returned by IG_ISIS_choice_get_flagsis currently used only to differentiate between two types of flag values in a tag: IG_ISIS_CONT_RANGE and IG_ISIS_CONT_LIST. One of these constants should be ANDed with the flag word output by IG_ISIS_choice_get_flags to determine a choice's internal representation.

While most choice functions behave identically regardless of type, the STEP value is only available if the IG_ISIS_CONT_RANGE bit is set.

See Also:

IG_ISIS_choice_get_ascii

IG_ISIS_choice_get_long

IG_ISIS_choice_get_rational

IG_ISIS_tag_get_type