fg_reduce()

Win32 DirectX Fastgraph/Light

Prototype

void fg_reduce (int offset, int colors, void *values);

Sub fg_reduce (ByVal offset As Long, ByVal colors As Long, values() As Any)

procedure fg_reduce (offset, colors : integer; var values);

Description

The fg_reduce() function reduces a 256-color palette to the specified number of colors, and optionally applies a color offset to the resulting palette. The pixel data within the current clipping region of the active 256-color virtual buffer determines the color occurrences used in the color reduction process.

On return, the pixels in the clipping region are translated to the colors defined by the resulting palette, but the palette itself is not made active.

Parameters

offset is the color offset applied to the resulting palette, between 0 and 255.

colors is the number of unique colors desired in the resulting palette, between 1 and 256.

values is the name of a 768-byte array containing 256 sets of RGB color components for the pixel data in the active virtual buffer. On return, the entries for colors offset through offset+colors-1 will contain the RGB color components for the new palette. Any resulting unused entries at the beginning or end of the values array are set to zero.

Return value

none

Restrictions

This function is meaningful only for 256-color virtual buffers.

See also

fg_getdacs(), fg_setclip(), fg_setdacs()

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.