PuzzleEffect method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int PuzzleEffect(unsigned uXBlock, unsigned uYBlock, unsigned uRandomize, unsigned crBorder, unsigned uFlags);

Delphi Syntax

Function PuzzleEffect (uXBlock: L_UINT; uYBlock: L_UINT; uRandomize: L_UINT; crBorder: COLORREF; uFlags: L_UINT): L_INT;

Overview

Refer to Applying Artistic Effects

Remarks

(Raster Pro and above toolkits) Splits the image into square blocks and randomizes these blocks inside the image.

This method can process the whole image or a region of the image. If a bitmap has a region, the effect is applied only to the region.

Splits the image into a certain number of blocks according to the flags passed to it. If the PUZZLE_SIZE flag is set, then the image will be divided into blocks using the uXBlock and uYBlock parameters for the dimensions of the blocks. If the PUZZLE_COUNT flag is set, then the image will be divided into blocks using the uXBlock and uYBlock parameters for the number of blocks per row and number of blocks per column.

If the BITMAP_RESIZE flag is not set, the edge blocks might have a different size than the inner blocks. This means the edge blocks will be manipulated differently than the inner blocks. The inner blocks that have the same dimensions will be shuffled around. The right edge blocks will be shuffled together and the bottom edge blocks will be shuffled together.

If the BITMAP_RESIZE flag is set, the image will be resized to be sure that all blocks have the same dimensions. In this case, the edge blocks will not be treated differently than the inner blocks.

If the PUZZLE_BORDER flag is set, borders will be drawn with the color passed by the crBorder parameter. If this flag is not set, no borders will be drawn.

If the PUZZLE_SHUFFLE flag is not set, the blocks will appear in their original positions. If this flag is set then the blocks will appear randomized. The randomization process will be controlled by the uRandomize parameter as follows:

image\sqrblit.gif If lRandomize is set to 0, the method will select the starting point for the randomize process. You will get a different result every time you call the method with uRandomize = 0.

image\sqrblit.gif If you set uRandomize to > 0, the method will use this value as a starting point for the randomization process. You will get the same result every time you call the method with the same value of uRandomize > 0.

Edge blocks that have the same size as inner blocks might move into the middle of the resulting image. Edge blocks with a different size than inner blocks will remain on the edge.

You must set PUZZLE_SIZE or PUZZLE_COUNT (but not both) for the method to affect the image. If you pass 0 for uFlags, the method leaves the image unchanged.

This method supports all bits/pixel supported by LEADTOOLS.

Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This method does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this method.

See Also

Elements:

Mosaic method, Picturize method, Pixelate method, Cubism method, DiceEffect method, RingEffect method.

Topics:

Raster Images: Artistic Effects

 

Using Color Values in LEADTOOLS