Step 4: Transform Intensities

Once the colors have been transformed, the runtime system transforms the foreground and background intensities according to the setting of INTENSITY_FLAGS. This option consists of a series of values added together. Except as noted below, these options take effect only if the colors were in some way affected by Step 3 above. In other words, intensity transfer is ignored if Step 3 didn't change your program's colors. The runtime does this to preserve the parts of your program that you left alone in Step 3. The assumption is that you have programmed those parts to behave the way you want.

You may set INTENSITY_FLAGS to a combination of the following values by adding the values together:

Value Description
1 This option exchanges the foreground and background intensities for each other. This is useful if you are swapping a black background into the foreground and want to assign the foreground's intensity to the background.
2 Causes the foreground intensity to be inverted. That is, if the foreground is high-intensity, it becomes low-intensity. Otherwise, it becomes high-intensity. This is useful if you are transforming the background to white and the foreground to black. Setting this will cause your low-intensity foreground to be shown as gray while your high-intensity item will show as black.
4 Forces the foreground to high-intensity. This will not be applied to a black foreground.
8 Forces the foreground to low-intensity. This may not be used if 4 is used.
16 Causes the 4 or 8 setting to be used even if the COLOR_TRANS setting had no effect. This is an override switch that you can use to cause all foreground intensities to be set to high or low.
32 Forces the background to high-intensity. This will not be applied to a black background.
64 Forces the background to low-intensity. This may not be used if 32 is used.
128 Forces the background to high-intensity, but only if it is black. This may be used in conjunction with setting 32 or 64 for special effects.
256 Causes the 32, 64, or 128 setting to be used even if the COLOR_TRANS setting had no effect.

These transformations are performed in the order listed above.

At this point, the resulting colors and intensities are combined and processed using the COLOR_TABLE map described in COLOR_TABLE. The final result is shown on the screen.