LBitmap::Picturize

#include "ltwrappr.h"

virtual L_INT LBitmap::Picturize(pszDirName, uFlags, nCellWidth, nCellHeight)

L_TCHAR * pszDirName;

directory name

L_UINT uFlags;

flag that indicates the behavior of the process

L_INT nCellWidth;

width of the images

L_INT nCellHeight;

height of the images

Replaces the class object's current image with an image created using images present in the specified directory.

Parameter Description
pszDirName Character string containing the directory that contains the images. Only images from this directory will be used. Images in any subdirectories will NOT be used.
uFlags Flag that indicates the behavior of the process. Possible values are given below. These values can be combined using OR (|) or +.
  Value Meaning
  PICTURIZE_LOADALL [1] load all the pages in memory first. This causes a big improvement in the speed of the process. It is recommended to use it if you have enough memory to hold all the images
  PICTURIZE_RESIZE [2] resize the images that are not nCellWidth x nCellHeight using normal resize
  PICTURIZE_RESAMPLE [4] Resample the images that are not the required size (nCellWidth x nCellHeight). (slower process, better quality)
  PICTURIZE_ONCE [10] Use the image only once throughout the process.
  PICTURIZE_EQUALUSAGE [20] Use all images equally. That is, before an image will be used twice, all other images must be used at least once.
  PICTURIZE_BESTFIT [40] Images will be resized to fit the image if the bitmap width or height is not a multiple of nCellWidth/nCellHeight.
  0 The picturize process will not use any of the above flags. It will: reload all the files each time you look for a rectangle to substitute and ignore all the images present in pszDirectory if their size is not nCellWidth x nCellHeight
 

nCellWidth

Width of the images used to reconstruct the image.

nCellHeight

Height of the images used to reconstruct the image.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The image, or selected region, is broken down into rectangles of size nCellWidth x nCellHeight. For each rectangle, the image in the directory that is best suited to replace that rectangle is inserted into the original image.

The bitmap object is updated only once for every row of lines, where each line has a height dimension of nCellHeight. Therefore, the LBitmap::PicturizeCallBack() can be overridden to show the progress of every cell. For more information, refer to the LBitmap::PicturizeCallBack callback function.

If a region is selected, only the selected region will be changed by this function. If no region is selected, the whole image will be processed.

On an 8 BPP display, it is recommended that you create a fixed palette before you start the picturize process and use it to paint all the bitmaps. All the bitmaps which will be passed to the LBitmap::PicturizeCallBack callback will be 24BPP so a fixed palette is best. It is faster to create the palette before you start painting rather than creating it every time you paint a little square.

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

If PICTURIZE_BESTFIT is set, then nCellWidth and nCellHeight 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 nCellWidth and nCellHeight. 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 nCellWidth and nCellHeight.

If the bitmap width and height are not multiples of nCellWidth and nCellHeight 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 function.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Supportfor 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function 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 function.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMGEFX

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, LBitmap::PicturizeCallBack, Class Members

Topics:

Raster Image Functions: Processing an Image

Example

//Picturize // Picturize the bitmap in pBitmap // - use all the images in c:\thumbs directory // - load all images and resize the ones that are not the desired size // - use 32x32 images // - use UpdateRectCallback callback to show the progress

L_INT LBitmap__PicturizeExample() 
{ 
   L_INT nRet; 
   LBitmap LeadBitmap; 
 
   nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =LeadBitmap.Picturize( 
                        MAKE_IMAGE_PATH(TEXT("")), // a directory contain images 
                        PICTURIZE_LOADALL|PICTURIZE_RESIZE|PICTURIZE_EQUALUSAGE|PICTURIZE_BESTFIT, 
                        32, 32); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

Help Version 20.0.2019.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help