slmt9@cc.usu.edu (06/20/91)
This is another plea for help. I need to be able to blit a piece of one picture onto another piece of a a picture. Here the catch. I want to be able to see through the parts of the picture that were black on the source of blit. In other words. If the source part of the blit was a ring with an open center of the background color, palette 0, when it was blitted to the destination only the NON-ZERO parts were copied. The result would be a ring overlayed on the original destination picture. Any help at all would be greatly appriciated. Also I can handle lots of mail so please anyone with any ideas or help please let me know. Thanks in advance, Joshua SLMT9@cc.usu.edu P.s. Any source in C or in ASM greatly appriciated. Thanks again.
ttr1415@helios.TAMU.EDU (Thom Robertson) (06/20/91)
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
entity@cccan.uucp (Cybernetworx) (06/21/91)
In article <1991Jun19.110423.48153@cc.usu.edu> slmt9@cc.usu.edu writes: > > This is another plea for help. > > I need to be able to blit a piece of one picture onto another piece >of a a picture. Here the catch. I want to be able to see through the parts of >the picture that were black on the source of blit. Ok what you are referring to requires a blitter mask. What a mask lets you do is say which bits are solid, and which ones can you see through. The way a mask is construcuted is to 'OR' all the bitplane bits together. ie. if for a given pixel position within your bitmap, any pixel on any bitplane is a 1, your mask will also contain a 1, otherwise it will be a 0. The easiest way to create masks is to a) write yourself a small proggy that'll do it, or b) use some PD utility like IFFmaster to do it for you automatically. Once you have the image mask, you can then do the blit. If you are using system routines, you would want to use BltMaskBitMapRastPort() which lets you specify a minterm and a pointer to the mask. If you are going to use the hardware directly, you could do it the following way: bltAptx=mask, bltBptx=source, bltCptx=destination, bltDptx=destination. Actually, the C DMA channel is used to point to the background, but since this is usually the destination, you set it to same value as D channel. Finally, use a minterm of $CA. Using this, only those bits of the image will be blitted which have a corresponding 1 in the mask bitplane. > Thanks in advance, > Joshua > SLMT9@cc.usu.edu -- __ __ /// \\\ /// UUCP: ...uunet!utai!lsuc!becker!cccan!entity CYBERNETWORX INET: entity@cccan.UUCP