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

This function applies a special effect that makes the image look as if it is being viewed through a shower curtain.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_FX_twist (
        HIGEAR hIGear, 
        const LPAT_RECT lpRect, 
        const AT_MODE nTwistType, 
        const UINT nSquareSize 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpRect const LPAT_RECT Far pointer to an AT_RECT structure specifying the rectangular portion of the image to be processed. Use NULL for whole image. Before ImageGear performs this operation, it determines 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 overrides the settings passed to this structure in favor of the non-rectangular ROI defined by the mask.
nTwistType const AT_MODE One of the IG_TWIST_ constants: IG_TWIST_90IG_TWIST_180IG_TWIST_270IG_TWIST_RANDOM.
nSquareSize const UINT Size in pixels of the regions to which to apply twisting (valid range: 2 to 50).

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++.

Sample:

FlashPix

Example:

 
Copy Code
HIGEAR hIGear;     /* Handle of image to apply twisting to  */
/* Apply random twisting to 16 x 16 pixel squares of image:  */
IG_FX_twist ( hIGear, NULL, IG_TWIST_RANDOM, 16 );

Remarks:

The image can still be seen but it is chopped up so that detail is lost.

Each square of pixels of size nSquareSize in the image is rotated according to nTwistType. If IG_TWIST_RANDOM is chosen then each block is rotated one of the directions selected randomly.

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().

See IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() for more details.