Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xil_choose_colormap(3) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

xil_choose_colormap(3)

NAME

xil_choose_colormap − choose a best-fit colormap for a 24 bit 3-band image

SYNOPSIS

#include <xil/xil.h>

XilLookup xil_choose_colormap ( XilImage src,

unsigned int size);

DESCRIPTION

This function creates and returns an XilLookup colormap with size entries to represent the full-color (usually 24 bit) src (source) image.  size specifies the number of colormap entries in the resulting XilLookup object.  xil_choose_colormap() accepts only 3 banded XIL_BYTE source images. The colormap which is produced will also have 3 output bands.

The colormap selection algorithm attempts to produce a set of size color triplets which produce the minimum amount of error when used to represent the 24 bit image.  The normal use for this function is to produce a colormap which can be used on an 8 bit indexed-color framebuffer to display 24 bit color images.  It would be used in conjunction with xil_nearest_color(3), which would map the color triplets in the image to the closest entry in the colormap. 

The user is responsible for destroying the lookup table when it is no longer required, using xil_lookup_destroy(3). 

RETURN VALUES

The desired XilLookup object, or NULL (could not generate XilLookup ). 

ERRORS

For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide. 

EXAMPLES

Create a reasonable XilLookup with 216 colormap entries to represent the full-color source image:

XilImage     src; /∗ 3 band XIL_BYTE source image ∗/
XilImage     dst; /∗ 1 band XIL_BYTE destination image ∗/
XilLookup    cmap;
 /∗ Leave some free colors for the window system ∗/
unsigned int cmap_size = 216;
 /∗ Generate the best colormap ∗/
cmap = xil_choose_colormap(src, cmap_size);
 /∗ Assign the closest colormap entries ∗/
xil_nearest_color(src, dst, cmap);

SunOS 5.6  —  Last change: 17 September 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026