<HTML>
<! $Id: jag_col.txt,v 1.12 1996/02/11 23:00:41 nat Exp $>
<HEAD>
<TITLE>COLOR</TITLE>
</HEAD>
<body background="jaguar.gif">
<PRE>
# -------------------------------------------------------------------
# COLOR 	                               (c) Copyright 1995 KKP & Nat!
# -------------------------------------------------------------------
# These are some of the results/guesses that Klaus and I Nat! found
# out about the Jaguar with a few helpful hints by other people, 
# who'd prefer to remain anonymous.
#
# Since we are not under NDA or anything from
# Atari we feel free to give this to you for educational purposes
# only.
#
# Please note, that this is not official documentation from Atari
# or derived work thereof (both of us have never seen the Atari docs)
# and Atari isn't connected with this in any way.
#
# Please use this informationphile as a starting point for your own
# exploration and not as a reference. If you find anything inaccurate,
# missing, needing more explanation etc. by all means please write
# to us:
#	  nat@zumdick.rhein-main.de
# or
#	  kkp@gamma.dou.dk
#
# If you could do us a small favor, don't use this information for
# those lame flamewars on r.g.v.a or the mailing list.
#
# HTML soon ?
# -------------------------------------------------------------------
# $Id: jag_col.txt,v 1.12 1996/02/11 23:00:41 nat Exp $	             
# -------------------------------------------------------------------
# Note: This is definetely the weakest doc so far. High bull content!
# --------------------------------------------------------------------

1 Quest For Color
=================

The Jaguar has a great number of color modes that all can be mixed on
screen at any time thanks for the Object processor.
There are 3 major color modes called CRY (chroma-intensity), TC (TrueColor)
and Palette.


1.1 Palette Color Image (1,2,4,8 bits/pixel)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

[ Nat! I think the following is only valid for TrueColor Videomode.
       If the videmode is 16bit RGB or CrY, then the pallete entries
       are also Cry/RGB 16 bit words (and indexed that way)
]

Objects using Palette colors can have 1, 2, 4 or 8 bits per pixel.
There are 256 entrys in the Clut (0xF00400). Each color in the Clut is
defined by the 4 byte structure:

         +-------+-------+-------+-------+
         | Green |  Red  |  nc   | Blue  |
         +-------+-------+-------+-------+

The actual color displayed on the screen depends on a lot of things, f.e. 
the O_INDEX value in the Object Processor.

In 8 bits/Pixel the pixel value is used directly as a index into the Clut.

In 1, 2 and 4 bits/pixel modes the Clut-Index for the displayed color is
calculated as Clut-Index = 2*O_INDEX + Pixel-Value.


1.2 CrY Color Image (16 bit/pixel)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Objects using CrY colors always uses 16 bits per pixel. Each pixel is
defined by this 2 byte structure:

         +-------^-------+-------^-------+
         |    Chroma     |       Y       |
         +---------------+---------------+

The Chroma and Y channel are 8 bits each. Y has nothing to do with
Yellow, but is the Luminance of the color chosen by Chroma! 
The Color on the screen is calculated by the formular:

                color-Trans[ Cr ]
     color   =  ----------------- * Y,  Color = {Red, Green, Blue}
                       255


The cry colors aren't contigous as on the Atari 8-bit. Instead they
are sorta two dimensionally organized:
 
         major nybble
         
        blue \0    lightblue    magenta
            0 +---------------+          m
              |               |          i
              |               |          n
              |               |          o n
      purple  |     white     | green    r y  
              |               |            b 
              |               |            b
              |               |            l
              +---------------+            e
         red        orange      yellow


Imagine a blue lamp shining from the corner marked 'blue' ($0,$0) a
red lamp shining from the 'red' corner ($0,$F) and a green lamp shining
from the middle of the right edge ($F,$7). The resulting mix of colors
will be very similiar to the cry colors.


1.3.1 True Color Image (16 bits/pixel)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The other 16 bit/pixel mode uses a normal packed RGB format like
on the Falcon and some VGA cards to get 5 bit worth of Red and Blue
and 6 bits worth of Green information. The format used is 

         +-------^-+-----^---+---^-------+
         |   Red   |  Blue   |   Green   |
         +---------+---------+-----------+
         15......11 10......6 5..........0

To convert use something along the lines of:

; Input:
;	d5.5		: red
;	d6.6		: green
;	d7.5		: blue
; Output
;  d0.16    : packed TrueColor pixel
shiftcolor:
	move.w	d5,d0	; d0 = red, now have [0]-[0]-[0]-[red]
	asl	#5,d0	; shift red up, now have [0]-[0]-[red]-[0]
	or.w	d7,d0	; add in blue, now have [0]-[0]-[red]-[blue]
	asl	#6,d0	; shift red & blue up, now have [0]-[red]-[blue]-[0]
	or.w	d6,d0	; add in green, now have [0]-[red]-[blue]-[green]
	rts


1.3.2 True Color Image (24/32 bits/pixel)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Objects using the TrueColor model always uses 4 bytes per pixel???? Each
pixel is defined by the structure:

         +-------+-------+-------+-------+
         | Green |  Red  |  nc   | Blue  |
         +-------+-------+-------+-------+

</PRE>
</BODY>
</HTML>