Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!oliveb!sun!cmcmanis From: cmcmanis@sun.UUCP Newsgroups: comp.sys.amiga.tech Subject: Re: Cookie Cut BltBitMap Keywords: function needed Message-ID: <58733@sun.uucp> Date: 1 Jul 88 21:57:53 GMT References: <406@icus.UUCP> Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Distribution: comp Organization: Sun Microsystems, Mountain View Lines: 42 In article <406@icus.UUCP> eric@icus.UUCP (Eric L. Hyman) writes: The problem: > Each square contains Terrain(one of several shapes) as well as A > potentially a unit(Represented by another set of shapes(Again All in > the same bitmap) To draw each squre currently involves 3 calls to > BltBitMap. 1 to draw terrain, 2) to 'zero out' the pixels for the unit > (By using a all 1's mask in the shape of the unit shape(Basically a > cookie cut with no save)) and 3 draw the unit into the square. The net > result is to overlay the unit on the terrain. What I need/want is a > way to do this with a single function..I don't think any of the stock > functions will handle it, and I was just wondering if Any one code > supply some code that would (Aztec 3.6 or even better an assembly > routine that does it all in one Blit) > Eric Hyman talcott !icus!eric Eric, you can do this in exactly n Blits where 'n' is the depth of your screen. First though, understand that a call to BltBitMap() on a 16 color screen actually does fours calls to the blitter. One for each bitplane. The best place to start is to get a copy of BlitLab that was done by Tom Rokicki. In it, you will find a very easy to use routine that will call the blitter directly for you. Assuming you have a 4 plane screen (16 colors), set up each blit with the "A" source pointing at your unit's image, the "B" source pointing at the terrain image, and the "D"estination pointed at your real image. The minterm you will use is A+~AB which is "bit from A if it is non zero, otherwise take the bit from B", Do this blit 4 times, targeting each plane in the unit, background, and destination appropriately. And poof instant appearance of the unit on the screen. In the minimum time. But wait their's more... Since your images are exactly 16 bits wide, if your "squares" or limits of motion is on 16 pixel boundaries (ie if you split the screen up into a bunch of 16 X 16 squares) then you can probably achieve the same effect at nearly the same speed by using the CPU. -- --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses. But you knew that, didn't you.