LBitmapBase::Create

Summary

Creates a new bitmap in the bitmap object.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmapBase::Create(uWidth=100, uHeight=100, uBitsPerPixel=24, uOrder= ORDER_BGR, pPalette=NULL, uViewPerspective=TOP_LEFT, uMemory=TYPE_CONV, pData=NULL, dwSize=0)

Parameters

L_UINT uWidth

The desired initial bitmap width.

L_UINT uHeight

The desired initial bitmap height.

L_UINT uBitsPerPixel

The number of bits per pixel. Valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 48, and 64.

Use 0 to create an 8-bit grayscale bitmap. In that case, the function ignores the uOrder and pPalette parameters.

L_UINT uOrder

The color order for 16-, 24-, and 32-bit bitmaps. If the resultant bitmap is less than 16 bits per pixel, this will have no effect since palletized images have no order. Possible values are:

Value Meaning
ORDER_RGB [0] Red, green, and blue color order in memory
ORDER_BGR [1] Blue, green, and red color order in memory
ORDER_GRAY [2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical toolkits.
ORDER_RGBORGRAY [3] Load the image as red, green, blue OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only.
ORDER_BGRORGRAY [4] Load the image as blue, green, red OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only.

LPRGBQUAD pPalette

Pointer to an array of RGBQUAD structures that contains palette info. Pass NULL to use LEAD's fixed palette.

L_UINT uViewPerspective

The desired view perspective for the bitmap. For valid values, refer to Accounting for View Perspective.

L_UINT uMemory

The type of memory to use when creating the bitmap. Possible values are:

Value Meaning
TYPE_CONV [0x0001] Use conventional memory if the image will fit, otherwise swap to disk.
TYPE_COMPRESSED [0x0200] (Document/Medical only) Allocate an RLE-compressed bitmap. You can use this flag with TYPE_CONV. For more information, refer to Speeding Up 1-Bit Documents.
TYPE_SUPERCOMPRESSED [0x0400] (Document/Medical only) Keep images compressed in memory. This option causes slow access, but very low memory usage. This option is available only for 1-bit, 8-bit grayscale and 24-bit images.

L_UCHAR *pData

Data pointer that will contain the bitmap data when uMemory is TYPE_USER. If pData is NULL, the data pointer must be passed later, by calling LBitmapBase::SetDataPointer, before the bitmap can be used.

L_UINT32 dwSize

Size of the data buffer pointed to by pData. This should be at least pBitmap->Size. This parameter is only valid when uMemory is set to TYPE_USER.

Returns

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

Comments

Call this function to create a new bitmap in the bitmap object with the desired dimensions and view perspective.

Some image processing functions, such as LBitmapBase::Rotate and LBitmapBase::ColorRes, need to re-allocate the image data. If you create a bitmap with TYPE_USER, and pass it to these functions, they will change the bitmap to TYPE_CONV and re-allocate memory. Your original data will no longer be used.

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

You can specify 0 bits per pixel to create an 8-bit grayscale bitmap. In that case, the function ignores the uOrder and pPalette parameters.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapBase__CreateExample() 
{ 
   L_INT nRet; 
   LBitmapBase MyBitmap; 
 
   nRet = MyBitmap.Create(100, 200, 24, ORDER_BGR, NULL, TOP_LEFT, TYPE_CONV); 
 
   return nRet; 
 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.