•  Back 
  •  VDI 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File
                                  Using Color


The color capabilities of VDI devices can be placed into three categories
as follows. Determining which category a device falls into is accomplished
by examining the return values from v_opnvwk(), v_opnwk(), and vq_extnd().

         Categories            v_opn/v/wk()    vq_extnd()
                               work_out[13]    work_out[5]
                                { colors }      { lut }

         Monochrome Device Sometimes monochrome devices
appear as palette-based devices
with two available colors.
         2             0

         Palette-Based Device     >= 2             1

         True Color Device         > 2             0

Monochrome Devices

Monochrome devices are only capable of displaying one color. Often,
monochrome devices are instead represented by palette-based devices with
two fixed colors.

Palette-Based Devices

Palette-based devices have a fixed number of colors that may be rendered
on screen simultaneously. Each pixel value is used to index into the
palette to decide what color to display. For instance, if you change VDI
color #2 to green, draw a box with that color index, and then change VDI
color #2 to red, the box will appear first in green and then turn red.

The first 16 VDI color registers are used by the operating system and
should be avoided. If your application must change them, they should be
restored when no longer needed.

True Color Devices

True-color devices allow each pixel to have a unique color value. Rather
than palette entries, colors (work_out[13]) corresponds to the number of
available virtual pens. Drawing is accomplished by using these pens,
however, unlike using a palette, changing the color of a pen does not
change any pixel's color drawn with that pen on the screen.

Whatever color is stored in virtual pen #0 is considered the background
color for the purpose of computing write modes.

It is possible for external devices, printers, plotters, etc. to behave
as if they were a true-color device.

Color Mapping

Color values are defined in the VDI by specifying a red, green, and blue
value from 0-1000. The VDI will scale the value to the closest color
possible. vq_color() can be used to determine the actual color that was
set.