IndirectArray is one that encodes data using a combination of an
index and a
value table. Each element is assigned its own index, which
is used to retrieve the value from the
value table. Concretely, if
A is an
A[i,j...] = value[index[i,j,...]].
Among other uses,
IndirectArrays can represent
sometimes called "colormap images" or "paletted images."
using IndirectArrays, Colors colors = distinguishable_colors(6) index = rand(1:6, 32, 32) A = IndirectArray(index, colors)
which has only 6 colors in it.
value array can be of any type; it does not have to be color information.