Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LBitmapBase::Create

Show in webframe

#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)

L_UINT uWidth;

/* the desired initial bitmap width */

L_UINT uHeight;

/* the desired initial bitmap height */

L_UINT uBitsPerPixel;

/* bits per pixel for the bitmap */

L_UINT uOrder;

/* the color order */

LPRGBQUAD pPalette;

/* pointer to an array of RGBQUAD structures */

L_UINT uViewPerspective;

/* the desired view perspective for the bitmap */

L_UINT uMemory;

/* the type of memory */

L_UCHAR *pData;

/* data pointer */

L_UINT32 dwSize;

/* size of the data buffer pointed to by pData */

Creates a new bitmap in the bitmap object.

Parameter

Description

uWidth

The desired initial bitmap width.

uHeight

The desired initial bitmap height.

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.

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.

pPalette

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

uViewPerspective

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

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.

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.

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

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

LTDIS
LTFIL

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:

LBitmapBase::Free, LBitmapBase::Allocate, LBitmapBase::Initialize, Class Members

Topics:

Raster Image Functions: Creating and Deleting Images

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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.