/* Program to demonstrate an image declaration as well as simple pixel
   iteration and assignments */

#include <stdio.h>
#include <MyroC.h>

int
main ()
{

  printf ("Program to create and display a white picture with a black dot\n");
  Pixel blackPix = {0, 0, 0};
  Pixel whitePix = {255, 255, 255};

  /* declare picture and set proper dimensions */
  Picture myArt = {192, 256};
  /* alternatively, dimensions could be set explicitly, as follows: */
  //myArt.height= 192;
  //myArt.width = 256;

  int col,row;

  /* color all pictures white */
  for (col = 0; col < myArt.width; col++)
    {
      for (row = 0; row < myArt.height; row++)
	{
	  myArt.pix_array [col][row] = whitePix;
	}
    }

  /* place 2-by-2 black dot in the middle of the picture */
  myArt.pix_array [myArt.width/2]   [myArt.height/2]   = blackPix;
  myArt.pix_array [myArt.width/2+1] [myArt.height/2]   = blackPix;
  myArt.pix_array [myArt.width/2]   [myArt.height/2+1] = blackPix;
  myArt.pix_array [myArt.width/2+1] [myArt.height/2+1] = blackPix;

  /* display the image for 10 seconds */
  rDisplayPicture (myArt, 10, "display of myArt");

  return 0;

}
