BITMAPHANDLE

The BITMAPHANDLE structure serves as a working area for image manipulation and conversion. LEADTOOLS functions use this structure as a bitmap handle for accessing the image in memory and for maintaining the characteristics of the image.

Note:

Fields intended for internal use, such as the pointer to the bitmap, are omitted from the table. If necessary, you can refer to the LTKRN.H header file, which describes the entire structure.

 

Member

Data Type

Description

uStructSize

L_INT

For versioning, this must be set to sizeof(BITMAPHANDLE). Some functions require the BITMAPHANDLE structure to be initialized prior to the function being called.

Width

L_INT

Image width in pixels.

Height

L_INT

Image height in pixels.

BitsPerPixel

L_INT

Number of bits per pixel.

BytesPerLine

L_UINT

Bytes per line, rounded upward to the nearest multiple of four.

Flags.Allocated

L_BITFIELD

TRUE if the bitmap is allocated.

Flags.ConventionalMemory

L_BITFIELD

TRUE if the bitmap is allocated using conventional memory.

Flags.DiskMemory

L_BITFIELD

TRUE if the bitmap is allocated using LEAD's own virtual memory.

Flags.LockedMemory

L_BITFIELD

TRUE if the bitmap memory is locked down.

Flags.Progressive

L_BITFIELD

TRUE if an image is being loaded from a progressive JPEG file.

Flags.Tiled

L_BOOL

TRUE if the bitmap is a tiled bitmap.

Flags.WaitUserInput

L_BITFIELD

TRUE if the animation playback waits for user input.

Flags.Transparency

L_BITFIELD

TRUE if the animation playback uses transparency.

Flags.Compressed

L_BITFIELD

TRUE if the current bitmap is in 1-bit RLE-compressed format. For information about this format, refer to Speeding Up 1-Bit Documents.

Flags.Signed

L_BITFIELD

TRUE if the pixel values in the bitmap are signed.

Flags.SuperCompressed

L_BITFIELD

TRUE if the bitmap is in super-compressed format. The bitmap can be 24-bit or 1-bit. For more information, refer to Super Compressed Bitmaps in the Raster C++ Class Library help file.

Flags.NewPalette

L_BITFIELD

Indicates how the palette is stored.
If FALSE: the palette is stored as a GDI object (in Palette.hPalette). This is the default behavior in this version. In future versions, this will be changed.
If TRUE: the palette is stored as an array of RGBQUAD structures (in Palette.pPalette).

nColors

L_INT

Number of colors (256 or less) that the bitmap has. If the image has more than 256 colors, this value is zero.

hPalette

HPALETTE

Handle to the image's palette. It can be an optimized palette or a fixed palette. This member no longer exists. It has been changed to Palette.hPalette.

Palette.hPalette

HPALETTE

Handle to the image's palette. It can be an optimized palette or a fixed palette. This member will be removed in the future. Do not access this member directly. This is valid only if Flags.NewPalette is FALSE.

Palette.pPalette

L_RGBQUAD *

Array of palette colors. This is valid only if Flags.NewPalette is TRUE.

ViewPerspective

L_CHAR

Where the beginning of the image is stored. Valid values are TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT, TOP_LEFT90, and TOP_LEFT270. For descriptions, refer to Accounting for View Perspective.

Order

L_INT

Color order of the bitmap. Possible values are ORDER_RGB, ORDER_BGR and ORDER_GRAY.

Size

L_UINT32

Size of the bitmap image data, in bytes.

DitheringMethod

L_UINT

Dithering method (referenced by some functions). For possible values, refer to the LBitmapBase::GetDefaultDithering and LBitmapBase::SetDefaultDithering functions.

XResolution

L_INT

Horizontal resolution, in dots per inch. Some file formats save this value in the file header.

YResolution

L_INT

Vertical resolution, in dots per inch. Some file formats save this value in the file header.

Left

L_INT

Left offset for animation playback.

Top

L_INT

Top offset for animation playback, based on a TOP_LEFT view perspective.

Delay

L_UINT32

Animation playback delay in milliseconds (ms).

Background

COLORREF

Background color for animation playback. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.

Transparency

COLORREF

Transparent color for animation playback. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.

DisposalMethod

L_UINT

Animation playback disposal method. For possible values, refer to Animation Disposal Methods.

LowBit

L_INT

Value indicating the low bit used for window leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale). A value of -1 will be treated as 0.

HighBit

L_INT

Value indicating the high bit used for window leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale). A value of -1 will be treated as BitsPerPixel -1.

MinVal

L_INT32

Minimum grayscale value. For every value between 0 and MinVal, Black (RGB(0,0,0)) will be used. For values between MinVal and MaxVal, the gray value to be displayed is calculated by : gray = (index - MinVal) * 255 / (MaxVal - MinVal).(See * below)

MaxVal

L_UINT

Maximum grayscale value. For every value larger than MaxVal, White (RGB(255,255,255)) will be used. For values between MinVal and MaxVal, the gray value to be displayed is calculated by : gray = (index - MinVal) * 255 / (MaxVal - MinVal). (See * below)

* index is the intensity value of the pixel. If the intensity value is > MaxVal, the color will be White. If the intensity value is < MinVal, the color will be Black. For those intensity values between MinVal and MaxVal, the above equation is used to determine the color, with index equal to the intensity value.

Comments

pBITMAPHANDLE is a pointer to a BITMAPHANDLE structure. Generally, where a function parameter type is pBITMAPHANDLE, you can declare a BITMAPHANDLE variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pBITMAPHANDLE variable is necessary only if your program requires a pointer.

In most cases, the values of fields in the BITMAPHANDLE structure are maintained by LEADTOOLS functions.

Note: 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.