Skip to content

CMap ‐ API

Matthias Grimm edited this page Aug 17, 2026 · 5 revisions

cmap.init()

Param : None
Return: None

This method initializes the class and all internal variables. It must be called before CMap is used.

cmap.set()

Param : None
Return: None

This method loads the colormap into the video hardware.

This process is bound to the beam and waits for the next return beam. So be careful where you call it because it can cost you a complete frame.

cmap.reset()

Param : None
Return: None

This method resets the CLUT to the firmware settings, in this class as well as in the video hardware. Therefore it has the same timing implications as cmap.set().

cmap.load(name$)

Param : name = Name of the color map
Return: None

This method loads the color map. Up to now only the GIMP palette format is supported, which is a simple text format with one color per line.

  0   0   0	#0
255   0   0	#1
  0 255   0	#2
  0   0 255	#3
255   0 255	#4

cmap.getColor(reg%) as Integer

Param : reg = color register (0..255)
Return: color value

This method returns the contents of a certain CLUT register. Of course, it reads this value from an internal array and not from the video hardware.

cmap.setColor(reg%,color%)

Param : reg   = color register (0..255)
        color = color value as RGB() returns it
Return: None

This method sets a new color into a CLUT register. The new color becomes active after cmap.set() or map.set() has been called.

cmap.setRGB(reg%,R%,G%,B%)

Param : reg   = color register (0..255)
        R,G,B = color channels of an RGB() color
Return: None

This method creates a color from the given R, G and B components and sets it into a CLUT register. The new color becomes active after cmap.set() or map.set() has been called.

cmap.getCMode() as Integer

Param : None
Return: Color mode as number of color bits used: 8, 12, 16, 32

This method returns the color bits used in the current video mode. The command mode influences this method so it must be called after setting the video mode for proper results.

Clone this wiki locally