This function creates a new pixel object based on specified attributes.
| 
                        Copy Code
                     | |
|---|---|
| 
HIGPIXEL ACCUAPI IG_pixel_create(
        AT_INT channelCount,
        AT_DEPTH bitsPerChannel
);
 | |
| Name | Type | Description | 
|---|---|---|
| channelCount | AT_INT | Number of channels to allocate. | 
| bitsPerChannel | AT_DEPTH | Bits per channel to allocate. | 
Handle of new pixel object.
All pixel formats supported by ImageGear for C and C++.
Pixel Access
| 
                        Copy Code
                     | |
|---|---|
| AT_ERRCOUNT nErrcount; /* Number of errors on stack */ HIGEAR hImage; /* Handle of image */ HIGPIXEL hPix; /* Handle of pixel */ AT_INT ChannelCount; /* Number of channels in image */ AT_INT BitsPerChannel; /* Bits per channel in image */ nErrcount = IG_load_file("test.jpg", &hImage); nErrcount = IG_image_channel_count_get(hImage, &ChannelCount); nErrcount = IG_image_bits_per_channel_get(hImage, &BitsPerChannel); hPix = IG_pixel_create(ChannelCount, BitsPerChannel); /* Pixel is created using same attributes as image */ IG_pixel_delete(hPix); IG_image_delete(hImage); | |
The number of bits per channel is the amount to allocate, and it must be 8, 16, or 32.