Available in the LEADTOOLS Imaging toolkit. |
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:
The number of images present in the directory (the more images, the better).
The size of the rectangles. Smaller rectangles create an image that more closely resembles the original.
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.
When PICTURIZE_ONCE is set, the method will try not to use the same bitmap twice. Note that if there aren’t enough images, the method will return the ERROR_NOT_ENOUGH_IMAGES code if this flag is set.
When PICTURIZE_EQUALUSAGE is set, the method will use the same image more than once only if it is necessary to successfully complete the picturize process. If PICTURIZE_EQUALUSAGE is set, then for any bitmap, the number of times it is used differs from the number of times another bitmap is used by at most one. Therefore, most bitmaps will be used ‘n’ times, but some bitmaps will be used ‘n+1’ times.
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