User Tools

Site Tools


jvs:cigal:manual:chapter3:maklut

CIGAL Reference Manual, Chapter 3 (Functions): MAKLUT

MAKLUT -- Create a ramped lookup table

usage: array = maklut(length,firstval,lastval,groupsiz,mask)

MAKLUT generates an array of integer values suitable for a lookup table. The output array generated is LENGTH elements long. If ARRAY is already defined then LENGTH defaults to the length of ARRAY, otherwise this argument must be specified. FIRSTVAL and LASTVAL are respectively the values of the first and last elements of the output array. The other values will be uniformly distributed between FIRSTVAL and LASTVAL.

If GROUPSIZ > 0 then mapped values occur in groups of GROUPSIZ.

For example,

                  maklut(12,0,11,3)

produces the array:

                  0, 0, 0, 3, 3, 3, 7, 7, 7, 11, 11, 11

MASK is a bit flag to indicate which elements within each GROUPSIZ group are to be mapped. For example:

                  maklut(12,0,11,3,5)

has a mask of 5 (101 binary) and therefore produces the array:

                  0, 0, 0, 3, 0, 3, 7, 0, 7, 11, 0, 11

MASK is most useful when dealing with a device lookup table where the red, green, and blue values are grouped together, as in the VGA 256 byte lookup table. The default MASK is -1 so that all group elements are mapped. MASK is ignored if GROUPSIZ ⇐ 1.

See Also:
LUTS(1), MAP(3), RAMP(3)

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/maklut.txt · Last modified: 2023/02/23 18:43 (external edit)