L_InitBitmap

#include "l_bitmap.h"

L_LTKRN_API L_INT L_InitBitmap(pBitmap, uStructSize, nWidth, nHeight, nBitsPerPixel)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle to initialize */

L_UINT uStructSize;

/* size of the BITMAPHANDLE structure */

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 */

Initializes the fields in a bitmap handle.

Parameter

Description

pBitmap

Pointer to the bitmap handle to initialize.

uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

nWidth

Width of the image in pixels.

nHeight

Height of the image in pixels.

nBitsPerPixel

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

 

Value

Meaning

 

For a 1-bit image.

 

For a 2-bit image.

 

For a 3-bit image.

 

For a 4-bit image.

 

For a 5-bit image.

 

For a 6-bit image.

 

For a 7-bit image.

 

For an 8-bit image.

 

12

For a 12-bit image.

 

16

For a 16-bit image.

 

24

For a 24-bit image.

 

32

For a 32-bit image.

 

48

For a 48-bit image.

 

64

For a 64-bit image.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

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. L_CreateBitmap is usually a better choice.

This function must be called before using L_AllocateBitmap. 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 Imaging editions . Please note that a 16-bpp image may be color or grayscale. If you are working with a 16-bit grayscale image, explicitly set BITMAPHANDLE.Order to ORDER_GRAY. By default, the order for a 16-bit image will be set to ORDER_BGR.

DitherMethod

Set by the L_DefaultDithering 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

150

YResolution

150

Platforms

Windows 2000 / XP/Vista, Windows CE.

Required DLLs and Libraries

LTKRN

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

See Also

Functions:

L_CreateBitmap, L_AllocateBitmap, L_FreeBitmap

Topics:

Raster Image Functions: Creating and Deleting Images

Example

For a short example, refer to L_ResizeBitmap. For complete sample code, refer to the RESIZE example.