/*FILE HEADER**************************************************************
 *
 *  File name		: $Id$
 *  RCS Revision Number	: $Revision: 1.1 $
 *  Last Modified	: $Date: 94/10/28 09:23:31 $
 *  CSCI name		: Real-Time Graphics System - Applications Interface
 *  CSC name		: All functions
 *  Notes:
 *      This file contains code used to debug and test the SVME-770 RTGS.
 *      This code is provided as an example of how to call the RTGS functions
 *      from a host application.
 *  History		:
 *      Created 94/01/17 by Jeff Sanderson
 *
 *END FILE HEADER*********************************************************/

#include "dy4std.h"
#include "es.h"
#include "css.h"

#include "rtgs_ai.h"
#include "video.h"
#include "colours.h"

#include "test.h"


void test_draw( void );
/*-----------------------------------------------------------------------*/

void test_draw( void )
{
    point_t *ptr;

    init( "Drawing test" );
    Clear_screen( 0, 0, 0 );

    Printf("Calling draw line 20 30 200 300 \n");
    Set_foreground_colour( WHITE );
    Draw_line( 20, 30, 200, 300 );
    Key_wait();

    ptr = ( point_t * )Gcc_malloc( 5 * sizeof( point_t ), 0 );
    malloc_check( ptr );

    ptr[0].x = 300;
    ptr[0].y = 100;

    ptr[1].x = 200;
    ptr[1].y = 300;

    ptr[2].x = 300;
    ptr[2].y = 500;

    ptr[3].x = 400;
    ptr[3].y = 300;

    ptr[4].x = 300;
    ptr[4].y = 100;

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw polyline trapezoid\n");
    Set_foreground_colour( RED );
    Draw_polyline( 5, ptr );
    Key_wait();

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw ellipse\n");
    Set_foreground_colour( GREEN );
    Draw_ellipse( 300, 300, 150, 250 );
    Key_wait();

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw elliptical arc\n");
    Set_foreground_colour( BLUE );
    Draw_elliptical_arc( 200, 250, 150, 50, 0, 2000 );
    Key_wait();


    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw filled polygon\n");
    Set_foreground_colour( CYAN );
    Draw_filled_polygon( 5, ptr );
    Key_wait();

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw filled convex polygon\n");
    Set_foreground_colour( WHITE );
    Draw_filled_convex_polygon( 5, ptr );
    Key_wait();

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw filled ellipse\n");
    Set_foreground_colour( WHITE );
    Draw_filled_ellipse(  200, 300, 120, 240 );
    Key_wait();

    Clear_screen( BLACK, 0, 0 );
    Printf("Calling draw filled rectangle\n");
    Set_foreground_colour( RED );
    Draw_filled_rectangle(  100, 200, 300, 400 );
    Key_wait();
}

/*-----------------------------------------------------------------------*/
