Path: utzoo!attcan!uunet!tektronix!sequent!mntgfx!tomc From: tomc@mntgfx.mentor.com (Tom Carstensen) Newsgroups: comp.sys.mac.programmer Subject: Using PixMaps in CopyBits Keywords: pixmap, bitmap copybits Message-ID: <1988May11.125956.642@mntgfx.mentor.com> Date: 11 May 88 19:59:52 GMT Organization: Mentor Graphics Corporation, Beaverton Oregon Lines: 53 I'm having a slight problem in getting Copy Bits to work correctly. The following is an example of how I get it to copy the 4-bit depth screen correctly, but simply copies it to another location on the screen. ----------------------------------------------------- !! This works: !! mypm = NewPixMap() Set mypm bounds rectangle Set mypm row bytes Set sourcerect = some small rectangle in the window HLock((Handle)mypm); CopyBits(¤tWindow->portBits, *mypm, &sourcerect, &(*mypm)->bounds, srcCopy, NULL) ... do stuff ... .. then copy back CopyBits(*mypm, ¤tWindow-portBits, &(*mypm)->bounds, &sourcerect, srcCopy, NULL); ----------------------------------------------------- This works great, expect that it copies it to another rectangle on the screen. So, if I want to copy it somewhere else, can't I just set the (*mypm)->baseAddr to newly allocated space, by inserting the following statement before the first CopyBits: (*mypm)->baseAddr = NewPtr(#bytes * (*mypm)->pixelSize); (Assume here the mypm is Locked) Well, I've checked all of the above code in the debugger, and all of it looks fine, but it DOESN'T work. It does copies the bits back, but the color is messed up, like it's copying to/from a 1 or 2 bits screen. Does anyone see my problem, are had success doing something like this. Thanks :------------------------------------------------------------: : Tom Carstensen Usenet: tomc@mntgfx.MENTOR.COM : : Mentor Graphics Delphi: CARSTENSEN : : GEnie: CARSTENSEN : : : : . . . This is Edison Carter coming to you very much : : live and direct from Network 23 . . . : : - Edison Carter : :------------------------------------------------------------: