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
hpgl.c File Reference

HPGL plotting functions. More...

#include <math.h>
#include <string.h>
#include <stdio.h>
#include "MathType.h"
#include "SysDefs.h"
#include "plotting.h"

Go to the source code of this file.

Macros

#define FIXVERT
 
#define MAXBUFF   160
 

Functions

BOOL blHPGLInit (char *filename, char *AltFont, REAL xmargin, REAL ymargin)
 
void blHPGLPen (int num)
 
void blHPGLMove (REAL x, REAL y)
 
void blHPGLDraw (REAL x, REAL y)
 
void blHPGLSetDash (int style)
 
void blHPGLFont (int font, REAL size)
 
void blHPGLLText (REAL x, REAL y, char *string)
 
void blHPGLCBText (REAL x, REAL y, REAL offset, char *text)
 
void blHPGLROffText (REAL x, REAL y, REAL offset, char *text)
 
void blHPGLLCText (REAL x, REAL y, char *text)
 
void blHPGLCTText (REAL x, REAL y, REAL offset, char *text)
 
void blHPGLVText (REAL x, REAL y, REAL xoff, char *text, int TitleFont, REAL TitleSize, char *label, int LabelFont, REAL LabelSize)
 
void blHPGLEnd (void)
 
void blHPGLShowText (char *text, BOOL orientation, int XBase, int YBase)
 

Detailed Description

HPGL plotting functions.

Version
V2.2
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:

Usage:

Revision History:

Definition in file hpgl.c.

Macro Definition Documentation

#define FIXVERT
Value:
/* This is used to fix the dimensions of
vertical text. Not sure if this is a bug in
the PLT: HPGL interpreter or is standard HPGL.
Used by HPGLVText().
Define it if it imroves your output.
*/

Definition at line 120 of file hpgl.c.

#define MAXBUFF   160

Definition at line 126 of file hpgl.c.

Function Documentation

void blHPGLCBText ( REAL  x,
REAL  y,
REAL  offset,
char *  text 
)
Parameters
[in]xX coordinate
[in]yY coordinate
[in]offsetY-offset (multiplied by font height). Move text up by this amount
[in]*textText to print

Write centre-bottom justified text in HPGL

  • 25.06.92 Framework
  • 26.06.92 Original
  • 29.06.92 Added SimplifyText(). Changed to use HPGLShowText().
  • 06.07.92 Modified x-pos for wider font width
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 400 of file hpgl.c.

void blHPGLCTText ( REAL  x,
REAL  y,
REAL  offset,
char *  text 
)
Parameters
[in]xX coordinate
[in]yY coordinate
[in]offsetY offset in points. Move text down by this.
[in]*textText to print

Center Top justify text at x,y with y-offset in pts.

  • 25.06.92 Framework
  • 26.06.92 Original
  • 29.06.92 Added SimplifyText(). Changed to use HPGLShowText().
  • 01.07.92 Corrected y-positioning. Changed offset to be in pts rather than a multiplier of font size.
  • 06.07.92 Modified x-pos for wider font width
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 521 of file hpgl.c.

void blHPGLDraw ( REAL  x,
REAL  y 
)
Parameters
[in]xX position (0.0–1.0)
[in]yY position (0.0–1.0)

Draw on HPGL plot

  • 25.06.92 Taken from MoG
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 257 of file hpgl.c.

void blHPGLEnd ( void  )

Close the HPGL plot file

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

Definition at line 651 of file hpgl.c.

void blHPGLFont ( int  font,
REAL  size 
)
Parameters
[in]fontFont number
[in]sizePoint size of font

Set font for HPGL plot

  • 25.06.92 Taken from MoG
  • 29.06.92 Corrected CA to CS and added SS. Changed to use global width and height variables. Altered width to 1/2.4 * height
  • 27.07.93 Changed precision of floating i/o to double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 327 of file hpgl.c.

BOOL blHPGLInit ( char *  filename,
char *  AltFont,
REAL  xmargin,
REAL  ymargin 
)
Parameters
[in]*filenameHPGL file name
[in]*AltFontAlternative font used for Greek characters
[in]xmarginUnprintable x margin
[in]ymarginUnprintable y margin
Returns
Success

Initialise an HPGL plot. The parameters specify the unprintable margins on the output device.

The plot is also affected by global variables:

  PSxpicsize  X picture size
  PSypicsize  Y picture size
  PSxoffset   X offset
  PSyoffset   Y offset
  • 25.06.92 Taken from MoG. Changed to support offsets. Added parameters.
  • 29.06.92 Added initialisation of alternate font.
  • 06.07.93 Added AltFont parameter
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 170 of file hpgl.c.

void blHPGLLCText ( REAL  x,
REAL  y,
char *  text 
)
Parameters
[in]xX coordinate
[in]yY coordinate
[in]*textText to print

Print left-centre justified text

  • 25.06.92 Framework
  • 26.06.92 Original
  • 29.06.92 Changed to use HPGLShowText().
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 482 of file hpgl.c.

void blHPGLLText ( REAL  x,
REAL  y,
char *  string 
)
Parameters
[in]xX coordinate
[in]yY coordinate
[in]*stringText to print

Write left justified text on HPGL plot

  • 25.06.92 Taken from MoG
  • 29.06.92 Changed to use HPGLShowText().
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 368 of file hpgl.c.

void blHPGLMove ( REAL  x,
REAL  y 
)
Parameters
[in]xX position (0.0–1.0)
[in]yY position (0.0–1.0)

Move on HPGL plot

  • 25.06.92 Taken from MoG
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 235 of file hpgl.c.

void blHPGLPen ( int  num)
Parameters
[in]numPen number

Select a Pen

  • 25.06.92 Taken from MoG
  • 08.09.92 Changed to store pen first (having seen IntroCAD output)
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 214 of file hpgl.c.

void blHPGLROffText ( REAL  x,
REAL  y,
REAL  offset,
char *  text 
)
Parameters
[in]xX coordinate
[in]yY coordinate
[in]offsetMove left by this amount (pts)
[in]*textText to print

Print right-justified text to HPGL

  • 25.06.92 Framework
  • 26.06.92 Original
  • 29.06.92 Added SimplifyText(). Changed to use HPGLShowText().
  • 06.07.92 Modified x-pos for wider font width
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 440 of file hpgl.c.

void blHPGLSetDash ( int  style)
Parameters
[in]styleLine style

Set the line style (may be printer dependent):

  0 Solid line
  1 ............
  2 -.-.-.-.-.-.
  3 ------------
  4 -..-..-..-..
  5 --.--.--.--.
  • 25.06.92 Framework
  • 26.06.92 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 286 of file hpgl.c.

void blHPGLShowText ( char *  text,
BOOL  orientation,
int  XBase,
int  YBase 
)
Parameters
[in]*textText to be displayed with control codes
[in]orientationTRUE=vertical, FALSE=horizontal
[in]XBasePosition at which to start (device coords)
[in]YBasePosition at which to start (device coords)

Displays the text, raising or lowering as appropriate and selecting alternate font where required. Used by the various ...Text() routines.

  • 29.06.92 Original based on PostScript version.
  • 27.07.93 Changed precision of floating i/o to double
  • 11.03.94 Changed orientation to BOOL
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 674 of file hpgl.c.

void blHPGLVText ( REAL  x,
REAL  y,
REAL  xoff,
char *  text,
int  TitleFont,
REAL  TitleSize,
char *  label,
int  LabelFont,
REAL  LabelSize 
)
Parameters
[in]xX coordinate (in data units)
[in]yY coordinate (in data units)
[in]xoffX-offset in pts
[in]*textText to be written
[in]*TitleFontFont in which to write it
[in]TitleSizeSize of font
[in]*labelLabel to be used to calc x offset
[in]*LabelFontFont of this label
[in]LabelSizeSize of this label

Write vertical text centred on x,y offset back along x by the size of label and by xoff in pts 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. The FIXVERT code is used to correct character dimensions. Not sure if it is a bug in the PLT: interpreter which requires this, or whether it is standard HPGL. Define FIXVERT if it improves your output.

  • 25.06.92 Framework
  • 29.06.92 Original
  • 06.07.92 Modified x-pos for wider font width
  • 27.07.93 Changed precision of floating i/o to double
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 577 of file hpgl.c.