[comp.sys.amiga.tech] BltMaskBitMap function needed

joe@vixen.uucp (Joe Hitchens) (02/03/89)

I need source code for a function to blit from a source BitMap to a
destination BitMap through a mask.
What would be perfect is one that is identical to BltMaskBitMapRastPort()
except that instead of the destination being a RastPort, the destination
is a BitMap.
If some kind soul has done this and is willing to part with his code,
I would be tremendously grateful.

Or alternatively, I could use BltMaskBitMapRastPort() if I knew that there
was no significantly greater overhead in using it, when the RastPort in
question was allocated and initialized by my own code, i.e., not attached
to a Window, I allocated the RastPort & BitMap structures, and Raster data
myself.  I know that a Window's RastPort means that clipping will be done,
and that means slower performance.  If I built the RastPort myself without
attaching any Layer info to it, will it still be much slower than blitting
to a BitMap?  I want to handle the clipping myself.

Thanks in advance.

j.h.

-- 
joe@vixen.uucp
Artist, Sculptor, Animator of Sculpture, Iconologist Adept (Play Mechanoids!)

jimm@amiga.UUCP (Jim Mackraz) (02/04/89)

In article <254@vixen.uucp> joe@vixen.UUCP (Joe Hitchens) writes:
)
)I need source code for a function to blit from a source BitMap to a
)destination BitMap through a mask.
)What would be perfect is one that is identical to BltMaskBitMapRastPort()
)except that instead of the destination being a RastPort, the destination
)is a BitMap.
)
)Or alternatively, I could use BltMaskBitMapRastPort() if I knew that there
)was no significantly greater overhead in using it, when the RastPort in
)question was allocated and initialized by my own code, i.e., not attached
)to a Window, [ ... ]
)joe@vixen.uucp

Correctomundo, Joe.  Just point an "unlayered" rastport at it and the overhead
will be low.  Certain bookkeeping will be respected, such as the rastport
mask, but I don't think you will have a performance problem from these things,
compared to blitting overhead.

The first thing most of the rastport routines do is check to see if there is
a layer hanging off of the rastport, and if there is they get into a clipping
kind of thing.  Otherwise, they are quite clean.  It was a priority to make
unlayered rendering very fast; I know Dale took this as a mission from God.

You can even allocate the rastport on your stack ;^)

But wait: it might be that this particular call, BltMaskBitMapRastPort()
performs its function in a non-optimal way, so that it CAN do layered operations.
I've heard something about reserving one of the source operands for layer
masking or something.  You can probably do a masked blit much more directly
using the blitter yourself.

Hmmm.  The principle is sound, but in this case, you might want to go direct.
You can try this first, though.

If you want to go faster, get a copy of BlitLab and go direct.  This is probably
best saved until you perceive actual performance problems.

	jimm

-- 
Jim Mackraz, I and I Computing	   	"Like you said when we crawled down
{cbmvax,well,oliveb}!amiga!jimm          from the trees: We're in transition."
							- Gang of Four
Opinions are my own.  Comments are not to be taken as Commodore official policy.

jesup@cbmvax.UUCP (Randell Jesup) (02/04/89)

In article <254@vixen.uucp> joe@vixen.UUCP (Joe Hitchens) writes:
>Or alternatively, I could use BltMaskBitMapRastPort() if I knew that there
>was no significantly greater overhead in using it, when the RastPort in
>question was allocated and initialized by my own code, i.e., not attached
>to a Window, I allocated the RastPort & BitMap structures, and Raster data
>myself.  I know that a Window's RastPort means that clipping will be done,
>and that means slower performance.  If I built the RastPort myself without
>attaching any Layer info to it, will it still be much slower than blitting
>to a BitMap?  I want to handle the clipping myself.

	The rastport shouldn't be noticably slower than bitmaps if there is
no attached layer (clipping).  However, BMBMRP() isn't the fastest call in
the world, since it handles arbitrary rectangles it can't use a cookie-cutter
blit, and therefor uses 3 blits to accomplish the end result.  If your
alignments work out ok, you can use a cookie cutter blit in one pass, but you'll
have to program the blitter yourself.

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup