#include "ltwrappr.h"

virtual L_INT LBitmapBase::Initialize(nWidth=0, nHeight=0, nBitsPerPixel=0)

Initializes the fields in a class objects bitmap handle.


L_INT nWidth

Width of the image in pixels.

L_INT nHeight

Height of the image in pixels.

L_INT nBitsPerPixel

Number of bits per pixel in the image. Possible values are:

Value Meaning
1 For a 1-bit image.
2 For a 2-bit image.
3 For a 3-bit image.
4 For a 4-bit image.
5 For a 5-bit image.
6 For a 6-bit image.
7 For a 7-bit image.
8 For an 8-bit image.
2 For a 12-bit image.
6 For a 16-bit image.
4 For a 24-bit image.
2 For a 32-bit image.
8 For a 48-bit image.
4 For a 64-bit image.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


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

This is a low-level function that is necessary only if you need to initialize the bitmap handle and allocate memory in separate steps when creating a bitmap from scratch. LBitmapBase::Create is usually a better choice.

This function must be called before using LBitmapBase::Allocate. This function only initializes the fields in the bitmap handle; it does not allocate any memory. If all zeroes are passed as the nWidth, nHeight, and nBitsPerPixel into this function, then all fields in the bitmap handle will be set to 0. Otherwise, all fields will be set to zero except the fields listed below.

When this function is called, the following fields will be set:

Field Value
Order ORDER_RGB if you specify 8 bits per pixel or less; ORDER_GRAY for 12 or 16-bit grayscale; ORDER_BGR otherwise. ORDER_GRAY is valid only for 12 and 16-bit grayscale images and is only available in the Document/Medical toolkits.
DitherMethod Set by the LBitmapBase::SetDefaultDithering function.
ViewPerspective BOTTOM_LEFT [2].
Width As passed into the function.
Height As passed into the function.
BytesPerLine Calculated using the specified width and bits per pixel, rounded on a 4-byte boundary.
XResolution Set in the LOADFILEOPTION.
YResolution Set in the LOADFILEOPTION.

Required DLLs and Libraries


Win32, x64.

See Also




For an example, refer to LBitmapBase::Allocate.

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

LEADTOOLS Raster Imaging C++ Class Library Help