🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.amiga.tech
2 messages
2 total messages Started by Randy Young Thu, 10 Jan 1991 16:26
How get an image with a transparent background color
#7984
Author: Randy Young
Date: Thu, 10 Jan 1991 16:26
12 lines
1042 bytes
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
Re: How get an image with a transparent background color
#8094
Author: Jean-Michel Forgeas
Date: Sat, 12 Jan 1991 10:57
34 lines
2047 bytes
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 ?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads