Artifact 9cfef9368f91944d717150178d9421254b466ea77da81871ebf98fc562da3346:


/*
 * $Id: bigfig.trm,v 3.26 92/03/24 22:35:50 woo Exp Locker: woo $
 */

/* GNUPLOT - fig.trm */
/*
 * Copyright (C) 1990, 1991, 1992
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the modified code.  Modifications are to be distributed
 * as patches to released version.
 *
 * This software  is provided "as is" without express or implied warranty.
 *
 * This file is included by ../term.c.
 *
 * This terminal driver supports:
 *  Fig graphics language
 *
 * AUTHORS
 *  Micah Beck, David Kotz
 *
 * send your comments or suggestions to (info-gnuplot@ames.arc.nasa.gov).
 *
 */
 
/*
 * Original for Fig code output by Micah Beck, 1989
 * Department of Computer Science, Cornell University
 * Updated by David Kotz for gnuplot 2.0
 * More efficient output by Ian Dall
 * Increased size of plot by Ian Dall
 */
 
#define BFIG_HTIC       (7*FIG_RES/80)
#define BFIG_VTIC       (7*FIG_RES/80)
#define BFIG_HCHAR      (9*FIG_RES/80)
#define BFIG_FONT_S     (16)
#define BFIG_VCHAR      ((BFIG_FONT_S)*FIG_RES/80)  /* height in pixels of font
        */
 
#define BFIG_ARROW_WIDTH BFIG_HTIC
#define BFIG_ARROW_HEIGHT BFIG_HTIC
 
 
 
/* 7 inches wide by 5 inches high */
#define BFIG_XMAX (8 * FIG_RES)
#define BFIG_YMAX (5 * FIG_RES)
 
#define BFIG_XOFF (FIG_RES/2)
#define BFIG_YOFF (FIG_RES/2)
 
 
BFIG_vector(ux,uy)
     unsigned int ux,uy;
{
  int x=ux, y=uy;
 
  if (FIG_polyvec_stat != FIG_poly_part)
    {
      fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
              O_POLYLINE, T_POLYLINE,
              FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
              0, 0);
      fprintf(outfile, "%d %d",
              BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
      FIG_poly_vec_cnt = 1;
      FIG_polyvec_stat = FIG_poly_part;
    }
  fprintf(outfile, " %d %d",
          BFIG_XOFF +  x, BFIG_YMAX + BFIG_YOFF-y);
  FIG_poly_vec_cnt++;
  if (FIG_poly_vec_cnt > 50)
    FIG_poly_clean(FIG_polyvec_stat);
 
  FIG_posx = x;
  FIG_posy = y;
}
 
 
 
 
BFIG_arrow(sx, sy, ex, ey, head)
        int sx, sy;     /* start coord */
        int ex, ey;     /* end coord */
	BOOLEAN head;
{
	FIG_poly_clean(FIG_polyvec_stat);
        fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
                O_POLYLINE, T_POLYLINE,
                FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
                head ? 1 : 0, 0);
        /* arrow line */
	if ( head )
		fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
                	0, 0, 1.0,
			(double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
        fprintf(outfile, "%d %d %d %d 9999 9999\n",
                BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
		BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
 
        FIG_posx = ex;
        FIG_posy = ey;
}
 
BFIG_put_text(x, y, str)
        int x, y;
        char *str;
{
  if (strlen(str) == 0) return;
  FIG_poly_clean(FIG_polyvec_stat);
    y = y - BFIG_VCHAR/2;               /* assuming vertical center justified */
 
    fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
                  O_TEXT, FIG_justify,
                  FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
                  1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
        BFIG_YMAX + BFIG_YOFF-y, str);
}
 


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]