🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #9061

Re: Blitter problem (still there)

#9061
From: Bryan Ford
Date: Thu, 09 Jun 1988 07:00
71 lines
2455 bytes
>Hmm.  First comment is that you only need to allocate and use one
>bit plane...

OK, thanks.

>Second thing is make sure you WaitBlit() *after* the final blit
>before using the result.

OK, I fixed that too.

Unfortunately, it still does the same thing.  Updated version follows.

                                Bryan Ford (FATQW@USU.BITNET)

/* MakeColorMask - Create a color mask for a BitMap - Bryan Ford */

#include <exec/types.h>
#include <graphics/gfx.h>
#include <hardware/blit.h>
#include <hardware/custom.h>

IMPORT struct Custom custom;

PLANEPTR MakeColorMask(BitMap,Color,Invert)
struct BitMap *BitMap;
UBYTE Color;
BOOL Invert;
{
    WORD Width = BitMap->BytesPerRow*8,
        Height = BitMap->Rows,
        Depth = BitMap->Depth;
    PLANEPTR Plane;
    COUNT i;

    if ((Plane = (PLANEPTR)AllocRaster(Width,Height)) == NULL)
        return(NULL);
    OwnBlitter();

    for(i = 0;i < Depth;i++) {
        WaitBlit();
        custom.bltapt = (APTR)BitMap->Planes[i];
        custom.bltdpt = (APTR)Plane;
        custom.bltafwm = custom.bltalwm = 0xffff;
        custom.bltamod = custom.bltbmod = custom.bltdmod = custom.bltcon1 = 0;
        if (i != 0) {
            custom.bltbpt = (APTR)Plane;
            custom.bltcon0 = BC0F_SRCA | BC0F_SRCB | BC0F_DEST |
                (Color & 1 ? ABC | ABNC : NABC | NABNC);
        } else {
            custom.bltcon0 = BC0F_SRCA | BC0F_DEST |
                (Color & 1 ? ABC | ABNC | ANBC | ANBNC :
                NABC | NABNC | NANBC | NANBNC);
        }
        custom.bltsize = (Height << 6) | (Width >> 4);
        Color >>= 1;
    }

    if (Invert) {
        WaitBlit();
        custom.bltapt = custom.bltdpt = (APTR)Plane;
        custom.bltamod = custom.bltdmod = custom.bltcon1 = 0;
        custom.bltafwm = 0xffff;
        custom.bltalwm = 0xffff << (((Width+15)&~15)-Width);
        custom.bltcon0 = BC0F_SRCA | BC0F_DEST | NABC | NANBC | NABNC | NANBNC;
        custom.bltsize = (Height << 6) | (Width >> 4);
    }

    WaitBlit();
    DisownBlitter();
    return(Plane);
}
Technical Details
Message-ID: <8806090704.AA14228@jade.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!ucbvax!USU.BITNET!FATQW

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!ucbvax!USU.BITNET!FATQW
From: FATQW@USU.BITNET (Bryan Ford)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Blitter problem (still there)
Message-ID: <8806090704.AA14228@jade.berkeley.edu>
Date: 9 Jun 88 07:00:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 71