The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions
ps.c File Reference

PostScript plotting routines. More...

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <ctype.h>
#include "MathType.h"
#include "SysDefs.h"
#include "plotting.h"
#include "general.h"
#include "ps.h"

Go to the source code of this file.

Macros

#define MAXBUFF   160
 
#define _PS_MAIN
 

Functions

BOOL blPSInit (char *FName, char *creator, char *AltFont)
 
void blPSThick (REAL thickness)
 
void blPSMove (REAL X, REAL Y)
 
void blPSDraw (REAL X, REAL Y)
 
void blPSSetDash (char *linepatt)
 
void blPSClearDash (void)
 
void blPSStroke (void)
 
void blPSFont (char *fontname, REAL size)
 
void blPSLText (REAL X, REAL Y, char *label)
 
void blPSCBText (REAL X, REAL Y, REAL Offset, char *label)
 
void blPSROffText (REAL X, REAL Y, REAL offset, char *label)
 
void blPSLCText (REAL X, REAL Y, char *label)
 
void blPSCTText (REAL X, REAL Y, REAL Offset, char *label)
 
void blPSVText (REAL x, REAL y, REAL xoff, char *text, char *font, REAL size, char *label, char *lfont, REAL lsize)
 
void blPSShowText (char *text)
 
void blPSEnd (void)
 
char * blPSCorrectCase (char *font)
 

Detailed Description

PostScript plotting routines.

Version
V1.5
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

These routines supply rudimentry PostScript support with simple commands from C.

This version does not support EPSF.

Usage:

You should #include "ps.h" in your program and assign values to the global variables PSxpicsize,PSypicsize,PSxoffset and PSyoffset. All these values are in inches. Your plot should then run between 0.0 and 1.0 (you need to look after scaling to fit within these boundaries yourself).

Start with a call to PSInit which will set up the scaling and other routines within the PostScript program.

Revision History:

Definition in file ps.c.

Macro Definition Documentation

#define _PS_MAIN

Definition at line 71 of file ps.c.

#define MAXBUFF   160

Definition at line 70 of file ps.c.

Function Documentation

void blPSCBText ( REAL  X,
REAL  Y,
REAL  Offset,
char *  label 
)
Parameters
[in]XX coordinate
[in]YY coordinate
[in]OffsetY offset - multiple of font height. Moves up by this quantity
[in]*labelText to be printed

Centers a piece of text with X,Y being the Coords of the BOTTOM centre point

  • 30.06.92 Removed redundant sprintf()'s
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 490 of file ps.c.

void blPSClearDash ( void  )

Clear the dash pattern to a full line

  • 30.06.92 Removed redundant sprintf()'s
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 382 of file ps.c.

char* blPSCorrectCase ( char *  font)
Parameters
[in]*fontInput fontname
Returns
Case-fixed fontname

Goes through a fontname and fixes case to match the required standard.

  • 08.05.92 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 861 of file ps.c.

void blPSCTText ( REAL  X,
REAL  Y,
REAL  Offset,
char *  label 
)
Parameters
[in]XX coordinate
[in]YY coordinate
[in]OffsetY offset in points. Moves down by this quantity
[in]*labelText to be printed

Centers a piece of text with X,Y being the Coords of the TOP centre point

  • 26.06.92 Changed strlen() to use SimplifyText()
  • 30.06.92 Removed redundant sprintf()'s
  • 01.07.92 Changed Offset to be in pts rather than a multiplier of font size.
  • 27.07.92 Changed update limits to account better for descenders.
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 620 of file ps.c.

void blPSDraw ( REAL  X,
REAL  Y 
)
Parameters
[in]XX coordinate
[in]YY coordinate

Draw to X,Y

  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 348 of file ps.c.

void blPSEnd ( void  )

End of page

  • 08.05.92 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 840 of file ps.c.

void blPSFont ( char *  fontname,
REAL  size 
)
Parameters
[in]*fontnameFont to set
[in]sizePoint size of font

Set the font and size

  • 08.05.92 Changed to support raise and lower
  • 23.06.92 Set sTextHeight
  • 15.09.92 Changed to support Amiga reencoding
  • 06.07.93 Removed Amiga reecncoding for general distribution
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 418 of file ps.c.

BOOL blPSInit ( char *  FName,
char *  creator,
char *  AltFont 
)
Parameters
[in]*FNamePostScript filename
[in]*creatorCreator string
[in]*AltFontAlternate font (normall greek style)
Returns
Success?

Initialises the file writing the Prologue. The filename and creator are written into the Prologue and EPSFxoff and EPSFyoff are used to calculate the bounding box size for EPSF plots.

  • 08.05.92 Added definitions of raise, lower and greek. New parameter to specify name of alternate font.
  • 23.06.92 Padded BoundingBox with spaces and setting of PSXMin, etc.
  • 26.07.92 Correctly divide EPSFxoff and EPSFyoff by 72 when writing offsets in prologue.
  • 15.09.92 Added support for Amiga reencoding. Starting dimensions for BoundingBox set to dimensions set by Paper.
  • 06.07.93 Opens the file
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 189 of file ps.c.

void blPSLCText ( REAL  X,
REAL  Y,
char *  label 
)
Parameters
[in]XX coordinate
[in]YY coordinate
[in]*labelText to be printed

Left justify text, centred on Y

  • 08.05.92 Original
  • 30.06.92 Removed redundant sprintf()'s
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 583 of file ps.c.

void blPSLText ( REAL  X,
REAL  Y,
char *  label 
)
Parameters
[in]XX coordinate
[in]YY coordinate
[in]*labelText to be printed

Left justify text

  • 30.06.92 Removed redundant sprintf()'s
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 457 of file ps.c.

void blPSMove ( REAL  X,
REAL  Y 
)
Parameters
[in]XX coordinate
[in]YY coordinate

Move to X,Y

  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 328 of file ps.c.

void blPSROffText ( REAL  X,
REAL  Y,
REAL  offset,
char *  label 
)
Parameters
[in]XX coordinate
[in]YY coordinate
[in]offsetX offset in points; text moved to the left by this amount
[in]*labelText to be printed

Right justify text with offset in device coordinates (points).

  • 07.05.92 Original
  • 30.06.92 Removed use of PSShowText(). This can't be used with the current rightJustifyText
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 548 of file ps.c.

void blPSSetDash ( char *  linepatt)
Parameters
[in]*linepattLine pattern (a string of numbers)

Set a line dash pattern which must be supplied as a string

  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 366 of file ps.c.

void blPSShowText ( char *  text)
Parameters
[in]*textText to be written

Displays text, processing it first if any control codes are found. Used by the various text positioning routines.

  • 08.05.92 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 739 of file ps.c.

void blPSStroke ( void  )

Actually draw what you've just done onto the paper

  • 30.06.92 Removed redundant sprintf()'s
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 397 of file ps.c.

void blPSThick ( REAL  thickness)
Parameters
[in]thicknessLine thickness

Set the line thickness

  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 309 of file ps.c.

void blPSVText ( REAL  x,
REAL  y,
REAL  xoff,
char *  text,
char *  font,
REAL  size,
char *  label,
char *  lfont,
REAL  lsize 
)
Parameters
[in]xX coordinate (in data units)
[in]yY coordinate (in data units)
[in]xoffX-offset in pts
[in]*textText to be written
[in]*fontFont in which to write it
[in]sizeSize of font
[in]*labelLabel to be used to calc x offset
[in]*lfontFont of this label
[in]lsizeSize of this label

Write vertical text centred on x,y offset back along x by the size of label and by xoff in pts. Used, for example, to title the y-axis of a graph. The `label' specification is used to calculate an amount by which to move the text back. Typically this would be the longest data label on the graph's Y-axis.

  • 08.05.92 Original
  • 30.06.92 Removed redundant sprintf()'s
  • 15.09.92 Multiply string width by 0.65
  • 27.07.93 Floating point precision -> double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 688 of file ps.c.