randy@vort.uucp (Randy Young) (01/11/91)
Hello: I am programming a new game for the amiga. I would like to use the effect that dpaint uses when they pick up a brush and the background color is transparent. I want to be able to draw images to the windows without damaging the background picture. I have done some work with the Image stuctures to draw to a window, but it seems that when I cut a square brush and then use it in my program it erases part of the background. I am not sure of the technique to use, should I use bobs or something like that. Any help would be welcomed. Tanks in advance Randy Young
forgeas@swinjm.UUCP (Jean-Michel Forgeas) (01/12/91)
In article <729@cbmger.UUCP>, Peter Kittel GERMANY writes: > In article <1991Jan10.162634.690@vort.uucp> randy@vort.uucp (Randy Young) writes: > >I am programming a new game for the amiga. I would like to use the effect that > >dpaint uses when they pick up a brush and the background color is transparent. > >[...] > > You could use bobs or do the same they do yourself. The technique is > called "Cookie cutting". This involves the following steps: > 1. Make up a "mask" of the object to be placed. This mask is 1 where > any of the object bitplanes is non-zero, 0 else. It can be computed > by ORing together all object bitplanes. > [...] You have another other solution: After making a mask like Peter Kittel says, you can use the graphic.library function BltMaskBitMapRastPort() where you take a bitmap (a small one which contains your brush) its mask, and draw it into the big rastport. I use this function a lot instead of DrawImage() because like you said DrawImage() is good but doesn't have transparency. I never look at the speed of BltMaskBitMapRastPort(). But since it does clipping when it has to, be sure it cannot by having no layer attached to your rastport (rastport->Layer == 0). Perhaps it is fast enough for a game ? Best regards, Jean-Michel -- \___/ Jean-Michel Forgeas \-/ cbmvax!cbmehq!cbmfra!swinjm!forgeas | The Software Winery -^- And, where is the universe ?