3ds Max C++ API Reference
palutil.h File Reference
#include "maxheap.h"
#include <WTypes.h>

Classes

class  ColorPacker
 
class  Quantizer
 

Functions

UtilExport ColorPackerNewColorPacker (int w, BMM_Color_48 *pal, int npal, BYTE *remap=NULL, BOOL dither=FALSE)
 
UtilExport QuantizerNewQuantizer ()
 

Function Documentation

◆ NewColorPacker()

UtilExport ColorPacker* NewColorPacker ( int  w,
BMM_Color_48 pal,
int  npal,
BYTE *  remap = NULL,
BOOL  dither = FALSE 
)
Remarks
This is called to create an instance of a ColorPacker. When done, be sure to call ColorPacker::DeleteThis().
Parameters:
int w

The width of bitmap to be packed.

BMM_Color_48 *pal

The palette to use.

int npal

The number of entries in the palette.

BYTE* remap=NULL

This is a 256 byte table that maps the numbers into another number. This is used so the palette may be rearranged in Windows order. To make palettes for Windows, the best thing to do is to put the colors in so that colors that Windows uses are either left alone, or they are occupied by the colors that are least important in the image. This is because Windows will come along and alter these colors. This is the first 10 colors and the last 10 colors.

The quantizer creates a palette from 0-239, where 0 is the most used color and 239 is the least used. The color packer uses 0-239 as well, and it operates most efficiently when the colors are sorted as the quantizer orders them.

What can be done is to use FixPaletteForWindows() to rearrange the colors for the Windows palette. This creates the remap table passed to this method. Then as a last step the remap table is used to reorganize the palette. Below is the documentation for the global function FixPaletteForWindows(). Sample code that uses these APIs is in /MAXSDK/SAMPLES/IO/FLIC/FLIC.CPP.

◆ NewQuantizer()

UtilExport Quantizer* NewQuantizer ( )