🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Blitter problem (Fixed - YIPPEE!!)

#9080
From: Bryan Ford
Date: Tue, 14 Jun 1988 03:44
74 lines
2552 bytes
I've fixed the problem.  Thanks very much for all the help, especially
from Tom Rokicki.  I *still* don't know what the problem was, but it
seems like a small rewrite is what was necessary.

The working version follows, if anyone is interested.  I'm using
Lattice 3.03  (32 bit ints), so you'll have to stick an L beside
several of the values if you try compiling it using 16 bit ints.

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

/*
 *  FUNCTION
 *      MakeColorMask - Make a mask of a certain color in a BitMap
 *
 *  SYNOPSIS
 *      MakeColorMask(BitMap,Plane,Color)
 *
 *  DESCRIPTION
 *      Generates a mask of all the pixels in the BitMap which
 *      have the same color number as Color.  The result is
 *      stored in Plane, which must be the same size as the
 *      BitMap.
 *
 *  INPUTS
 *      BitMap - Pointer to the BitMap
 *      Plane - Destination plane
 *      Color - Color number
 *
 */

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

IMPORT struct Custom custom;

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

    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;
    }
    WaitBlit();
    DisownBlitter();
    return(Plane);
}

************

                                Bryan
Technical Details
Message-ID: <8806140348.AA16456@jade.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!ucsd!ucbvax!USU.BITNET!FATQW

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!ucsd!ucbvax!USU.BITNET!FATQW
From: FATQW@USU.BITNET (Bryan Ford)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Blitter problem (Fixed - YIPPEE!!)
Message-ID: <8806140348.AA16456@jade.berkeley.edu>
Date: 14 Jun 88 03:44:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 74