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. It is the commit. setColor and setRGB only change the class's internal copy; nothing reaches the screen until you call set(). Batch your register writes and call set() once.

set() and reset() wait for the return beam, so they can cost you a full frame. So be careful where you call them.

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 must be called after MODE, since the video mode is what determines the answer.

Clone this wiki locally