# include "Ximage.h"

int EraseOverlay (Graphic *graphic, Layout *layout) {

  char buffer[256];
  int i, status, N;

  status = read (layout[0].Ximage, buffer, 16); 
  buffer[16] = 0; 
  sscanf (buffer, "%*s %d", &N); 
  if (N > NOVERLAYS) {
    REALLOCATE (layout[0].tickmarks.objects, Object, 1);
    layout[0].tickmarks.Nobjects = 0;
  } else {
    for (i = 0; i < layout[0].overlay[N].Nobjects; i++) {
      if (!strcmp (layout[0].overlay[N].objects[i].type, "TEXT")) {
	free (layout[0].overlay[N].objects[i].text);
      }
    }
    REALLOCATE (layout[0].overlay[N].objects, Object, 1);
    layout[0].overlay[N].Nobjects = 0;
    OVERLAY[N] = FALSE;
  }

  Refresh (graphic, layout, 0);
  return (TRUE);
}
