Bioplib
Protein Structure C Library
|
Top level HPGL/PS plotting routines. More...
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "MathType.h"
#include "SysDefs.h"
#include "general.h"
#include "macros.h"
#include "plotting.h"
Go to the source code of this file.
Macros | |
#define | MAXTRANS 10 |
#define | TRANS_TABLE "HPGL.ftr" |
#define | MAXPEN 6 |
#define | MAXBUFF 160 |
Functions | |
BOOL | blAMInitPlot (char *filename, char *title, int dest, REAL OutXSize, REAL OutYSize, REAL OutXOff, REAL OutYOff, char *AltFont, REAL xmargin, REAL ymargin, REAL DataXMin, REAL DataYMin, REAL DataXMax, REAL DataYMax) |
void | blAMSetPen (int dest, int pen) |
void | blAMMove (int dest, REAL x, REAL y) |
void | blAMDraw (int dest, REAL x, REAL y) |
void | blAMSetLineStyle (int dest, int style) |
void | blAMEndLine (int dest) |
void | blAMSetFont (int dest, char *PSFontName, REAL FontSize) |
void | blAMText (int dest, REAL x, REAL y, char *text) |
void | blAMCBText (int dest, REAL x, REAL y, char *text) |
void | blAMRText (int dest, REAL x, REAL y, REAL offset, char *text) |
void | blAMLCText (int dest, REAL x, REAL y, char *text) |
void | blAMCTText (int dest, REAL x, REAL y, REAL CTOffset, char *text) |
void | blAMEndPlot (int dest) |
int | blPS2HPGLFont (char *font) |
char * | blSimplifyText (char *string) |
Top level HPGL/PS plotting routines.
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.
These functions provide a common interface to either PostScript or HPGL output.
They simplified from a set written for the Amiga which also supports IFF-DR2D and Amiga screen output
Definition in file plotting.c.
#define MAXBUFF 160 |
Definition at line 139 of file plotting.c.
#define MAXPEN 6 |
Definition at line 138 of file plotting.c.
#define MAXTRANS 10 |
Definition at line 135 of file plotting.c.
#define TRANS_TABLE "HPGL.ftr" |
Definition at line 136 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | *text | Text to print |
Centre-bottom justify text
Definition at line 563 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | CTOffset | Move down by this amount (points) |
[in] | *text | Text to print |
Centre/top justify text at position in data coordinates.
Definition at line 718 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
Draw to a position specified in data coordinates.
Definition at line 347 of file plotting.c.
void blAMEndLine | ( | int | dest | ) |
[in] | dest | Destination |
End a line; required by PostScript actually to draw on the paper.
Definition at line 432 of file plotting.c.
void blAMEndPlot | ( | int | dest | ) |
[in] | dest | Destination |
Close up a device after plotting.
Definition at line 764 of file plotting.c.
BOOL blAMInitPlot | ( | char * | filename, |
char * | title, | ||
int | dest, | ||
REAL | OutXSize, | ||
REAL | OutYSize, | ||
REAL | OutXOff, | ||
REAL | OutYOff, | ||
char * | AltFont, | ||
REAL | xmargin, | ||
REAL | ymargin, | ||
REAL | DataXMin, | ||
REAL | DataYMin, | ||
REAL | DataXMax, | ||
REAL | DataYMax | ||
) |
[in] | *filename | File to open |
[in] | *title | Title for plot |
[in] | dest | Destination (DEST_PS or DEST_HPGL) |
[in] | OutXSize | Output plot X size (inches) |
[in] | OutYSize | Output plot Y size (inches) |
[in] | OutXOff | Output plot X offset (inches) |
[in] | OutYOff | Output plot Y offset (inches) |
[in] | *AltFont | Alternate font name |
[in] | xmargin | Unprintable x margin (inches, HPGL) Sensible default: 0.58 |
[in] | ymargin | Unprintable y margin (inches, HPGL) Sensible default: 0.1465 |
[in] | DataXMin | Min data X value |
[in] | DataYMin | Min data Y value |
[in] | DataXMax | Max data X value |
[in] | DataYMax | Max data Y value |
Initialise a device ready for plotting.
Definition at line 204 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | *text | Text to print |
Left/centre height justify text at position in data coordinates
Definition at line 665 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
Move to a position specified in data coordinates.
Definition at line 303 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | offset | Move left by this amount (in points) |
[in] | *text | Text to print |
Right/centre justify text at position in data coordinates; offset is an x-offset specified in device coordinates (pt)
Definition at line 614 of file plotting.c.
void blAMSetFont | ( | int | dest, |
char * | PSFontName, | ||
REAL | FontSize | ||
) |
[in] | dest | Destination |
[in] | *PSFontName | PostScript font name |
[in] | FontSize | Size (in points) of font |
Sets the current font using PostScript font names. If producing HPGL output, a lookup table is used to translate this to an HPGL font number
Definition at line 472 of file plotting.c.
void blAMSetLineStyle | ( | int | dest, |
int | style | ||
) |
[in] | dest | Destination |
[in] | style | Style number (0–5) |
Set the line style
Definition at line 392 of file plotting.c.
void blAMSetPen | ( | int | dest, |
int | pen | ||
) |
[in] | dest | Destination |
[in] | pen | Pen number |
Change pen
Definition at line 261 of file plotting.c.
[in] | dest | Destination |
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | *text | Text to write |
Left/bottom justify text at position in data coordinates
Definition at line 515 of file plotting.c.
int blPS2HPGLFont | ( | char * | font | ) |
[in] | *font | PostScript font name |
Takes the PostScript font name and works out the best HPGL equivalent from a translation table. On the first call, the table is read from disk and space is allocated for it. If the routine is called with a NULL parameter, the space allocated for the table is freed. It is quite safe to call the routine again after this has occurred; the table will simply be re-read from disk.
If the requested translation is unsuccessful, 0 will be returned as the font number.
Definition at line 803 of file plotting.c.
char* blSimplifyText | ( | char * | string | ) |
[in] | *string | String containing control codes |
Removes control codes from a string for screen display. Also used for calculating string length. The returned string is stored as static within the routine
Definition at line 915 of file plotting.c.
REAL xmin |
Definition at line 146 of file plotting.c.
REAL XPScale |
Definition at line 146 of file plotting.c.
REAL ymin |
Definition at line 146 of file plotting.c.
REAL YPScale |
Definition at line 146 of file plotting.c.