ImageGear for C and C++ on Windows v20.5 - Updated
Method 2: Pixel Access Functions
User Guide > Concepts > Migrating from ImageGear v14 > Method 2: Pixel Access Functions

As with previous versions of ImageGear, there are pixel access functions that can be used to access pixel data associated with a HIGEAR image. These functions have names like IG_DIB_area_get/set, IG_DIB_raster_get/set, IG_DIB_pixel_get/set, and so on. The pixel access functions have two modes of operation: legacy (prior to 14.5) and new (14.5 and beyond). The default mode is legacy, in which these functions behave the same way they did before 14.5. So if you have existing code using pixel access functions, you shouldn't need to update it for 14.5. If you're considering using the pixel access functions for new code and you don't need to work directly with higher bit depths, uncommon color spaces, or alpha/extra channel data included with the main channel data, we recommend using the legacy mode. This mode shields you from the added complexity of these new formats.

If you want to use the new formats, or achieve maximum efficiency, you can use the new mode of pixel access to get more direct access to the new storage system. If you use the new mode, you must be aware of the following differences as compared to legacy mode:

Note that 1-bit channels are the only channels that are packed in the new mode - 8 pixels stored in each byte. All other channel depths are stored as 1, 2, or 4 byte values. A channel value with depth of 2-8 bits will be stored in one byte, 9-16 bits in two bytes, and 17-32 bits in four bytes. Channel values with depths of 33-64 bits are possible on 64-bit platforms and are stored in eight bytes.

To use the new mode, you need to set the DIB.PIX_ACCESS_USE_LEGACY_MODE global control parameter to IG_PIX_ACCESS_MODE_NEW. For example:

 
Copy Code
AT_MODE pixAccessMode = IG_PIX_ACCESS_MODE_NEW;
IG_gctrl_item_set("DIB.PIX_ACCESS_USE_LEGACY_MODE", AM_TID_AT_MODE,
        &pixAccessMode, sizeof(pixAccessMode), NULL);
Is this page helpful?
Yes No
Thanks for your feedback.