Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rutgers!rochester!pt.cs.cmu.edu!isl1.ri.cmu.edu!cycy From: cycy@isl1.ri.cmu.edu (Scum) Newsgroups: comp.sys.sgi Subject: Re: putting and retrieving colours...help! Summary: the answer.... Message-ID: <10349@pt.cs.cmu.edu> Date: 29 Aug 90 22:29:06 GMT References: <10335@pt.cs.cmu.edu> <1990Aug28.174521.5752@odin.corp.sgi.com> <1990Aug28.191700.7829@odin.corp.sgi.com> Organization: Carnegie-Mellon University, CS/RI Lines: 48 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@legman.esd -> -> So thanks again for the responses! -- Chris. -- -- Chris. (cycy@isl1.ri.cmu.edu) "People make me pro-nuclear." -- Margarette Smith