[comp.sys.amiga] My suggestion for 1.3

cunniff@hpfclq.HP.COM (Ross Cunniff) (01/23/88)

Here is my suggestion for 1.3 enhancements:  don't ignore the line drawing
pattern (set with SetDrPt()) when drawing the borders of filled polygons.
Appended is a shar file containing a program which demonstrates AreaMove
and AreaDraw's ignorance of the line drawing pattern.

			Ross Cunniff
			Hewlett-Packard System Software Operation
			...{ucbvax,hplabs}!hpda!cunniff
			cunniff%hpda@hplabs.ARPA

---cut here---------------------cut here---------------------cut here---
cat >PatTest.c <<SHAR_EOF
#include <stdio.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <graphics/gfxmacros.h>

struct GfxBase
    *GfxBase;
struct IntuitionBase
    *IntuitionBase;

struct NewScreen
    MyNewScreen = {
	0, 0, 320, 200, 3,		/* Left, Top, Width, Height, Depth */
	0, 0, 0,			/* DetailPen, BlockPen, ViewModes */
	CUSTOMSCREEN,			/* Type */
	NULL, NULL, NULL, NULL		/* Font, Title, Gadget, Bitmap */
    };

UBYTE
    *MyAFRast;
struct Screen
    *MyScreen;
struct RastPort
    *MyRast;
struct ViewPort
    *MyView;
struct TmpRas
    MyTmpRas;
struct AreaInfo
    MyAreaInfo;
WORD
    MyAreaBuffer[250],
    MyPattern[3*8] = {
	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
	0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555,
	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
    },
    *MyPat;

void main()
{
    int
	i;
    UBYTE
	*AllocRaster(),
	*AllocMem();
    struct TmpRas
	*InitTmpRas();
    struct Screen
	*OpenScreen();
    struct Library
	*OpenLibrary();
    void
	FreeRaster(),
	FreeMem(),
	exit(),
	CloseScreen(),
	CloseLibrary();

    IntuitionBase = (struct IntuitionBase *)
				OpenLibrary( "intuition.library", 29L );
    GfxBase = (struct GfxBase *)OpenLibrary( "graphics.library", 29L );

    MyScreen = OpenScreen( &MyNewScreen );
    if( MyScreen == (struct Screen *)NULL ) {
	printf( "Unable to open screen.\n" );
	exit( 1 );
    }
    MyView = &MyScreen->ViewPort;
    MyRast = &MyScreen->RastPort;

    SetRGB4( MyView, 0, 0x0, 0x0, 0x0 );
    SetRGB4( MyView, 1, 0xF, 0xF, 0xF );
    SetRGB4( MyView, 2, 0xF, 0x0, 0x0 );
    SetRGB4( MyView, 3, 0xF, 0xF, 0x0 );
    SetRGB4( MyView, 4, 0x0, 0xF, 0x0 );
    SetRGB4( MyView, 5, 0x0, 0xF, 0xF );
    SetRGB4( MyView, 6, 0x0, 0x0, 0xF );
    SetRGB4( MyView, 7, 0xF, 0x0, 0xF );

    InitArea( &MyAreaInfo, MyAreaBuffer, 100 );
    MyRast->AreaInfo = &MyAreaInfo;
    MyAFRast = AllocRaster( 320, 200 );
    MyRast->TmpRas = InitTmpRas(&MyTmpRas,MyAFRast,RASSIZE(320,200));
    MyPat = (WORD *)AllocMem( 3*8*sizeof(WORD), MEMF_CHIP | MEMF_PUBLIC );
    for( i = 0; i < 24; i++ ) {
	MyPat[i] = MyPattern[i];
    }

    SetOPen( MyRast, 1 );		/* White outline */
    SetAfPt( MyRast, MyPat, -3 );	/* Dotty red interior */
    SetDrPt( MyRast, 0xF0F0 );		/* Dashed outline */
    SetAPen( MyRast, 255 );		/* A, B, and Mode are for fills */
    SetBPen( MyRast, 0 );
    SetDrMd( MyRast, JAM2 );

    AreaMove( MyRast,  50,  50 );    
    AreaDraw( MyRast, 150, 150 );
    AreaDraw( MyRast,  50, 150 );
    AreaDraw( MyRast, 150,  50 );
    AreaEnd( MyRast );

    (void)getchar();			/* Wait for user to hit <cr> */
 
    FreeMem( MyPat, 3 * 8 * sizeof( WORD ) );
    FreeRaster( MyAFRast, 320, 200 );
    CloseScreen( MyScreen );
    CloseLibrary( (struct Library *)GfxBase );
    CloseLibrary( (struct Library *)IntuitionBase );
}

/*** EOF PatTest.c ***/
SHAR_EOF