ImageGear for C and C++ on Windows v19.10 - Updated
IG_FX_pixelate
API Reference Guide > Core Component API Reference > Core Component Functions Reference > FX Functions > IG_FX_pixelate

This function redraws an image using what appear to be very large pixels.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_FX_pixelate (
        HIGEAR hIGear, 
        const LPAT_RECT lpRect, 
        const AT_DIMENSION nXRes, 
        const AT_DIMENSION nYRes, 
        const AT_MODE nResampleIn, 
        const AT_MODE nResampleOut, 
        const WORD radius, 
        const LPAT_RGB lprgbBkColor 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpRect const LPAT_RECT Far pointer to an AT_RECT struct specifying the rectangular portion of the image to be processed. NULL for whole image. Before ImageGear performs this operation, it will check to see if an internal flag has been set to TRUE to make a mask active for this HIGEAR image. If a mask is active, and a valid pointer to a mask can be found, ImageGear will override the settings passed to this structure in favor of the non-rectangular ROI defined by the mask.
nXRes const AT_DIMENSION The distance between the new pixels in the horizontal direction.
nYRes const AT_DIMENSION The distance between the new pixels in the vertical direction.
nResampleIn const AT_MODE An IG_RESAMPLE_IN_ constant. These are listed in accucnst.h
nResampleOut const AT_MODE IG_RESAMPLE_OUT_SQUARE or _CIRCLE, the type of result to produce.
nRadius const WORD Radius of new "pixels", in pixels. Only applicable nResampleOut=IG_RESAMPLE_OUT_CIRCLE.
LprgbBkColor const LPAT_RGB If circle, a far pointer to an AT_RGB struct specifying the background color surrounding the output circles.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++, except:
Indexed RGB with non-grayscale palette.

Sample:

FlashPix

Example:

 
Copy Code
HIGEAR hIGear;    /* HIGEAR handle of image */
AT_ERRCOUNT nErrcount;
nErrcount = IG_FX_pixelate ( hIGear, NULL, 10, 10,
IG_RESAMPLE_IN_AVE,IG_RESAMPLE_OUT_SQUARE, 0, NULL );

Remarks:

Use nXRes and nYResto specify how many "apparent pixels" you want in the result.

nResampleIn tells ImageGear what to do with the block of pixels it reads in. It lets you have each output "apparent pixel" computed on the basis of the average, minimum, maximum, or central pixel in the block. Setting this to IG_RESAMPLE_IN_AV will set the value of all pixels in the block to the average all of the pixel values in the block.

This function, like other ImageGear Image Processing and Clipboard API calls, takes an AT_RECT structure as an argument, so that you can process a rectangular sub-region of an image. However, before ImageGear performs the operation specified by this function, it will check to see if an internal flag has been set to TRUE, indicating that a mask HIGEAR should be used with the image. If the flag is set to TRUE, and a valid pointer to a mask image has been assigned, ImageGear will override the settings passed to the AT_RECT structure and use the non-rectangular ROI defined by the mask HIGEAR. To create a non-rectangular region of interest, call IG_IP_NR_ROI_to_HIGEAR_mask().

Please see the descriptions of IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() for more details.