Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!helios!ttr1415 From: ttr1415@helios.TAMU.EDU (Thom Robertson) Newsgroups: comp.sys.amiga.graphics Subject: Re: Help using the Blitter in C or in ASM!! Message-ID: <17578@helios.TAMU.EDU> Date: 20 Jun 91 06:18:07 GMT References: <1991Jun19.110423.48153@cc.usu.edu> Organization: Texas A&M University Lines: 61 This is what masks are all about. Whether you use the ClipBlit() or the BltBitMap() functions, you have to supply a source and a destination, and a minterm. In either case, you have only two choices: 1) use a minterm (0xc0, I think) that splats the image down destroying whatever is covered by the rectangular blit, or 2) use a minterm (0xee, I think) that logical ANDs each plane of the source and destination, which is not acceptable, as it creates funky color changes wherever the pictures overlap. The answer is to have another picture that is all 1s on every bitplane, (where the ring or whatever is) that you can first blit down to destroy only the parts of the destination that would have collided with the source's picture. as a graphic illustration, consider: This is our source, represented as color numbers: 0000000000000 0000010000000 0000212000000 0003323300000 0000000000000 and the coresponding mask: 0000000000000 0000030000000 0000333000000 0003333300000 0000000000000 Now, in actuallity you only need one plane of mask bitmap, IF the blit routine is set up to use a mask. The routine you're looking for is called (I think (what am I, Ronald Reagan!?)) BltBitMapMaskRastPort(). It isn't documented in the old Amiga ROM kernal Manual, but you can find it's docs in the Abacus Advanced Amiga System Programmer's Guide, if nowhere else. The easiest way to create a mask for a brush in a graphic editor programm such as DPaint is; 1) Cut the image as a brush, 2) fill the screen w/ color 1, 3) press the right mouse button, which will make a negative image of the graphic on the screen, 4) fill that negative with the highest numbered color you have, and 5) fill the color 1 outline to color 0. Cut that, and you have a positive mask. :) Hope I helped. Thom Robertson