L_ColorResBitmapList

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ColorResBitmapList(hList, nBitsPerPixel, uFlags, pPalette, hPalette, uColors)

HBITMAPLIST hList;

/* handle to the list of bitmaps */

L_INT nBitsPerPixel;

/* target bits per pixel */

L_UINT32 uFlags;

/* processing options */

LPRGBQUAD pPalette;

/* custom palette to use */

HPALETTE hPalette;

/* custom palette handle to use */

L_UINT uColors;

/* number of colors in the palette */

Converts all bitmaps in a list from any bits-per-pixel to any bits-per-pixel.

Parameter

Description

hList

Handle to the list of bitmaps.

nBitsPerPixel

The number of bits per pixel to increase or decrease the bitmaps to. Valid values are 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, and 64.

uFlags

Processing options. Note that the palette and dithering options are useful only when the resulting bitmaps require a palette (when they are 8 bits per pixel or less). You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

 

Value

Meaning

 

CRF_FIXEDPALETTE

[0x01] Use LEAD's fixed palette.

 

CRF_OPTIMIZEDPALETTE

[0x02] Create an optimized palette.

 

CRF_NETSCAPEPALETTE

[0x40] Use the fixed palette that is employed by Netscape Navigator and by Microsoft Internet Explorer.

 

CRF_USERPALETTE

[0x10] Use the palette specified in the pPalette parameter.

 

CRF_USERHPALETTE

[0x0100] Use the palette specified in the hPalette parameter, without supplying optimized colors. Please note that this cannot Or-ed with CRF_USERPALETTE.

 

CRF_IDENTITYPALETTE

[0x08] Insert the Windows system palette. You can combine this flag with CRF_OPTIMIZEDPALETTE.

 

CRF_FASTMATCHPALETTE

[0x20] Use a predefined table to speed conversion using your own palette. Refer to L_CreateUserMatchTable.

 

CRF_BYTEORDERBGR

[0x04] Use BGR color order. This flag only has meaning when going to 16 bits per pixel or higher.

 

CRF_BYTEORDERRGB

[0x00] Use RGB color. This flag only has meaning when going to 16 bits per pixel or higher.

 

CRF_BYTEORDERGRAY

[0x80] Grayscale.Destination bitmap should be 12 or 16-bit grayscale. 12 and 16-bit grayscale images are only supported in the Document/Medical Imaging editions .

 

CRF_SLOWMATCH

[0x0200] Use with the CRF_OPTIMIZEDPALETTE flag to use a slower but more accurate matching process.

 

CRF_FAVORPURECOLORS

[0x0400] Give colors that occur frequently in the image palette entries of their own in the optimized palette.

 

CRF_NODITHERING

[0x00000000] Use nearest color matching.

 

CRF_FLOYDSTEINDITHERING

[0x00010000] Use Floyd-Steinberg dithering.

 

CRF_STUCKIDITHERING

[0x00020000] Use Stucki dithering.

 

CRF_BURKESDITHERING

[0x00030000] Use Burkes dithering.

 

CRF_SIERRADITHERING

[0x00040000] Use Sierra dithering.

 

CRF_STEVENSONARCEDITHERING

[0x00050000] Use Stevenson Arce dithering.

 

CRF_JARVISDITHERING

[0x00060000] Use Jarvis dithering.

 

CRF_ORDEREDDITHERING

[0x00070000] Use ordered dithering, which is faster but less accurate than other dithering methods.

 

CRF_CLUSTEREDDITHERING

[0x00080000] Use clustered dithering.

 

CRF_BYTEORDERROMM

[0x0800] Use ROMM color. This flag only has meaning when going to 24 or 48 bits per pixel.

pPalette

The custom palette to use. Specify this parameter as follows:

 

image\sqrblit.gif If you want to use the fixed palette or a fully optimized palette, pass NULL in this parameter and in hPalette.

 

image\sqrblit.gif If you want to supply the entire palette, specify CRF_USERPALETTE in the uFlags parameter and pass the address of your palette. Click here to see how to fill in the palette.

 

image\sqrblit.gif If you want the function to fill part of your palette with optimized colors, specify CRF_OPTIMIZEDPALETTE in the uFlags parameter and pass the address of your palette in pPalette and NULL in hPalette. Click here to see how to fill in the palette.

hPalette

The custom palette to use. Specify this parameter as follows:

 

image\sqrblit.gif If you want to use the fixed palette or a fully optimized palette, pass NULL in this parameter and in pPalette.

 

image\sqrblit.gif If you want to supply the entire palette, specify CRF_USERHPALETTE in the uFlags parameter and pass the handle of your palette. Click here to see how to fill in the palette.

 

image\sqrblit.gif If you want the function to fill part of your palette with optimized colors, specify CRF_OPTIMIZEDPALETTE in the uFlags parameter and pass NULL for pPalette and the handle of your palette in hPalette. Click here to see how to fill in the palette.

uColors

The number of colors in the palette. Pass 0 to get the default (such as 256 for 8 bits per pixel). Otherwise, do one of the following:

 

image\sqrblit.gif If you specify a palette in the pPalette or hPalette parameter, pass the number of entries in your palette (including reserved entries).

 

image\sqrblit.gif If you specify NULL in the pPalette and in the hPalette parameters and you specify CRF_OPTIMIZEDPALETTE in the uFlags parameter, you can use this parameter to limit the number of colors that the function maps in the optimized palette.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

You can use this function to create an optimized palette for all bitmaps in the list.

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.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

`See Also

Functions:

L_TranslateBitmapColor, L_ColorResBitmap,

 

L_DefaultDithering, L_CreateUserMatchTable,

 

L_SetUserMatchTable, L_FreeUserMatchTable,

 

L_DlgColorRes

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Raster Image Functions: Playing Animated Images

 

Raster Image Functions: Palettes

 

Color Resolution and Dithering

 

Implementing Animation

Example

For a short example, refer to L_GetBitmapListItem. For complete sample code, refer to the CHILD.C module of the DEMO example.