palette-randomize-ca!

Synopsis

(palette-randomize-ca! palette number-of-colors number_of_areas)

Parameters

  • palette: A colormap with dimensions 65536x1 or 256x256
  • number-of-colors
  • number-of-areas:

Description

This procedure distributes number_of_colors random color values among the palette which will form number_of_areas separate areas with the same width when interpolated.

Side Effects

The palette colormap is changed.

Return Value

The palette colormap is returned and ready for interpolation.

Example

> (define palette (palette-create))
palette
> (palette-randomize-ca! palette 5 10)
#<colormap orow:-1 ocol:-1 xres:-1 yres:-1 w:65536 h:1>
> (palette-writepng palette "palette-rand-ca.png")
ok
> (palette-interpolate! palette)
#<colormap orow:-1 ocol:-1 xres:-1 yres:-1 w:256 h:256>
> (palette-writepng palette "palette-rand-ca-ip.png")
ok
>

The resulting palette displays as follows (note the pixels): palette-rand-ca.png

After linear interpolation this palette then displays as follows: palette-rand-ca-ip.png