Picturize method (Main Control)

Visual Basic example
Visual C++ 4.0 example

Visual J++ example

Syntax short Picturize (BSTR pszDirectory, short iFlags. float fCellWidth, float fCellHeight);

Overview:  Refer to Combining Images.

Remarks

Replaces the current image with an image created from images contained in the specified directory. The image, or selected region, is broken down into rectangles of size fCellWidth x fCellHeight. For each rectangle, the image in the directory that is best suited to replace that rectangle is inserted into the original image.

The quality of the result is controlled by three factors:

  1. The number of images present in the directory (the more images, the better).

  2. The size of the rectangles. Smaller rectangles create an image that more closely resembles the original.

  3. The type of image being replaced. If you are replacing a small image with lots of detail, then you will need lots of images in the directory in order to create an image that closely resembles the original.

PICTURIZE_ONCE and PICTURIZE_EQUALUSAGE flags cannot be combined in the iFlags parameter.

If PICTURIZE_BESTFIT is set, then fCellWidth and fCellHeight are used as a starting point for the actual cell size. The cell sizes are modified so that the size of the last rectangle in a row or column differs from the other rectangles by one. Note that the cell width and height are chosen to be smaller than fCellWidth and fCellHeight. For example, if the bitmap is 101x131 and you pass 32 for the cell width and height and set PICTURIZE_BESTFIT, then the actual cell size will be 25x32. The widths of the cells will be 26, 25, 25, 25 (for a total of 101). The heights of the rows will be 33, 33, 33, 32 (for a total of 131). This option should be used if the bitmap width and height are not multiples of fCellWidth and fCellHeight.

If the bitmap width and height are not multiples of fCellWidth and fCellHeight and PICTURIZE_BESTFIT is not passed, then the last rectangle in a row or column might be very small. Using the example given above, if PICTURIZE_BESTFIT is not set, the widths of the cells would be 32, 32, 32, 5 and the heights would be 32, 32, 32, 32, 3.

PICTURIZE_EQUALUSAGE and PICTURIZE_ONCE will reduce the number of times a bitmap is used by this method.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Topics:  Raster Images: Combining Images
Examining and Altering Bitmaps