Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rocksanne!prism!rainero From: rainero@prism.wbst128.xerox.com (Emil Rainero) Newsgroups: comp.sys.mac.programmer Subject: Re: Help with LSC 3.0 CopyBits Message-ID: <741@rocksanne.UUCP> Date: 1 May 89 13:45:38 GMT References: <7731@zodiac.UUCP> Sender: news@rocksanne.UUCP Reply-To: rainero@prism.UUCP (Emil Rainero) Distribution: na Organization: WRC, XEROX Lines: 51 In article <7731@zodiac.UUCP> ddisabat@ads.com (David Disabatino) writes: >I am having some trouble with Copybits used to copy a pixmap into >a window pixmap. I have created a pixmap for an image loaded in. >The data is in a nonrelocatable block in the heap. I create a >pixmap for the image (8 bits / pix) > >Then I try to copybits this pixmap onto a window. >SetRect(&srcrect, 0, 0, image.width, image.length); >SetRect(&dstrect, 0, 0, image.width, image.length); >CopyBits(image.pmap, &srcrect, win->portPixMap, &dstrect, srcCopy, NULL); > >It doesn't crash or anything, but I see no visible results on screen. >Maybe the call to CopyBits is wrong? But any other combination of >args gives compiler errors. Is it legal to set up a pixmap like this >without a GrafPort. I know the data is there, because if I physically >write it into the window pixmap it appears on screen, albeit rather >slowly. > >This works fine. Of course there are a few casts in the above staement. >Please if anyone knows how to copy pixmaps, clue me in. This looks like one of those problems easily solved with ANSI prototypes. pascal void CopyBits(BitMap *srcBits, BitMap *dstBits, Rect *srcRect, Rect *dstRect, int mode, RgnHandle maskRgn); >CopyBits(image.pmap, &srcrect, win->portPixMap, &dstrect, srcCopy, NULL); ^ ^ Looks like you have the srcrect and win->portBitMap pointers reversed. I also recall reading that CopyBits wants at most 32K of data. (might want to read the IM V.1 section on CopyBits. The ANSI prototypes for almost all of Inside Mac Vol I-V are on sumex and could be reposted here if necessary. Lightspeed does an excellent job with the real ANSI prototypes and precompiling them with the common mac includes seems to cost about 1 second to load on each compile (about the same time as a very short .h file). There really is no reason not to do this. While it is a pain to explicitly typecast many simple calls to get them to conform, the alternative is at best a debugging session that bombs on the offending line and at worst a hung mac (yes, even with the source level debugger). Why does LSC not include ANSI prototypes for all MAC and non-mac functions? I use the protos for the standard library functions but I could not find a prototype for Debugger(). This caused a lot of grief because I remembered invoking Debugger(char *) in the pat and this new debugger call is Debugger(void). Emil