Path: utzoo!attcan!uunet!cbmvax!cbmehq!cbmfra!swinjm!forgeas From: forgeas@swinjm.UUCP (Jean-Michel Forgeas) Newsgroups: comp.sys.amiga.tech Subject: Re: How get an image with a transparent background color Message-ID: <1882acab.ARN0b89@swinjm.UUCP> Date: 12 Jan 91 10:57:47 GMT References: <1991Jan10.162634.690@vort.uucp> <729@cbmger.UUCP> Reply-To: forgeas@swinjm.UUCP (Jean-Michel Forgeas) Followup-To: comp.sys.amiga.tech Organization: The Software Winery Lines: 34 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 ?