Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!olivea!oliveb!amdahl!JUTS!DUTS.ccc.amdahl.com!rla20 From: rla20@DUTS.ccc.amdahl.com Newsgroups: comp.sys.mac.programmer Subject: CopyBits Help Needed! (was: DrawPicture to offscreen messes colors up) Message-ID: Date: 14 Mar 91 21:21:09 GMT Sender: netnews@ccc.amdahl.com Reply-To: rla20@DUTS.ccc.amdahl.com () Organization: Amdahl Corporation, Sunnyvale CA Lines: 72 This is a follow-up to my posting of: ****HELP! Offscreen DrawPicture messes colors up.**** I am still having problems... but I am getting closer... (for those who don't remember, I am trying to implement a Paste PICT to an offscreen PixMap via DrawPicture) I have recieved three (including the post) replys. They suggested the following: 1) Making sure the gDevice (during the Paste) is the same as the one for the offscreen pixmap. --guess I should have done this from the start. I put in gDevice stuff & instead of totally random colors, now I got a picture with colors that are sometimes correct and sometimes pseudo-"inverted", read on.. 2) See if the color matching routine was working. --tried my own color matching, but with no effect, CMgr matching works just the same as my matching. The inverse table is sufficient. 3) use NewGWorld to set the offscreen stuff up. --well, maybe I should. But, darn it, this *should* work without 32-bit QD, etc. It should work with the IM I-V stuff. Besides, I would have to get the THINK C libraries, etc... 5) make sure the forecolor & backcolor for the port are properly setup. --I did. They are. I THOUGHT. Read on... One thing I don't think I made clear in the last post was that the two PixMaps (one on-screen, one off) have different Color Tables. The same colors are in both, but the order is different. The one that is on screen is totally handled by CQD via SetPalette and such... The one off-screen is set up by the file (GIF) that I read in. So, what I have found out is that in the files with a CLUT that has white as the first color (index=0) and black as the last color (index=255) the DrawPicture seems to work. Now, my testing is not exhastive but this is what I have found out so far. So, now my earlier question has been whittled down to a questions about how CopyBits works--because the picture is created by CopyBits and when it is drawn it calls CopyBits. Here are my questions: 1) How, EXACTLY (please no mumbo-jumbo hand-waving arguments here-- I'm an EE/CS major I can take it) does CopyBits work when translating between different Color Maps? 2) Why does CopyBits need Black/White to be the fore/background colors? Do they have to be at index = (0/max)? 3) Why didn't Apple put in a I-don't-care-what-the-destination-is- just-put-the-source-colors-thereCopyMode? It seems this is what CopyBits is all about. I just read in IM V about how CopyBits "fakes" srcCopy mode with addPin. My question is WHY? I would think most (but of course not all) apps don't care what the colors are at the destination. Should I be zero-ing (or one-ing) out the destination rect before I CopyBits to it? 4) What if the color table from the file does not HAVE black and white in it? What is close enough to be useable? Well, now it is your turn...please help, I am getting so close to actually understanding CQD that I can almost taste it. Mail responses are preferred, but post if you think all would benefit, I will summarize all the responses that I get. Thanks in advance, Roger -- > Roger Allen | :~) "I always lie" < > Amdahl Computer Development | < > rla20@duts.ccc.amdahl.com | ;~( "I'm lying now" <