www.pudn.com > CG2Programs.rar > device.c


#include 
#include 

#include 

#include "graphics.h"


/* ============================================================ */
/* Data structure convenience functions */
/* ============================================================ */
void setDcPt (dcPt * pt, int x, int y)
{
  pt->x = x;
  pt->y = y;
}

void dcPtShow (dcPt pt)
{
  printf ("(%4d, %4d)\n", pt.x, pt.y);
}



/* ============================================================ */
/* Base-level, Device-specific routines */
/* ============================================================ */
long openGraphics (char * windowName, short xSize, short ySize)
{
  long windowId;

  prefsize (xSize, ySize);
  windowId = winopen (windowName);
  return (windowId);
}

void closeGraphics (int windowId)
{
  winclose (windowId);
  gexit ();
}

void setBackground (int c)
{
  color (c);
  clear ();
}

void setColor (int c)
{
  color (c);
}

void setPixel (int x, int y)
{
  long aPoint[2];

  aPoint[0] = x;
  aPoint[1] = y;
  bgnpoint ();
    v2i (aPoint);
  endpoint ();
}

int getPixel (int x, int y)
{
  return (1);
}