putting and retrieving colours...help!

Scum cycy at isl1.ri.cmu.edu
Thu Aug 30 08:29:06 AEST 1990


Well, Kurt and Martin (who sent me e-mail... thanks) got it right.
Gavin Bell refered me to David Ligon, who explained the problem and its
solution very well as follows:

->If Chris is using cpack(0x01f) on a PI in double buffer here is what he gets:
->-----------------
->| A |  0  |
->----------- BLUE
->| B |  0  |
->-----------------
->| A |  0  |
->----------- GREEN
->| B |  0  |
->-----------------
->| A |  1  |
->----------- RED
->| B |  f  |
->-----------------
->
->Where only the higb nibbles (A) are used.  The syntax for cpack is:
->cpack(0xAABBGGRR) where alphs, blue, green, and red are byte sized portions.:^)
->
->Now when the readRGB call is made (I assume Chris packs the RGB data which is
->not necessary if the lrectread command is used) he gets 0 for blue, 0 for green
->and 11 for red as the high order bit is duplicated on read.
->
->I believe that if Chris picks colors that have high order bits and compares
->them to duplicated nibble colors his scheme will work.  cpack(0x00102030)
->compare the packed readRGB on the PI to 0x00112233. Or return the lrectread
->value to 0x00112233 (this also replicates high nibbles).
->      || ||
->      || ||
->      || ||
->      () ()
->      || ||
->      || ||
->     xx| |xx
->  (__=_) (_=__)
->--dbl at legman.esd
->
->
So thanks again for the responses!

					-- Chris.
-- 

                                       -- Chris. (cycy at isl1.ri.cmu.edu)
"People make me pro-nuclear." -- Margarette Smith



More information about the Comp.sys.sgi mailing list