1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#ifndef QPGPLOT_H
#define QPGPLOT_H
#include <QWidget>
#include <QDialog>
class QPgplot : public QWidget {
Q_OBJECT
public:
QPgplot(QWidget *parent = NULL);
QPixmap pixmap;
protected:
void paintEvent(QPaintEvent *);
// void closeEvent(QCloseEvent *);
};
class QPgplotDialog : public QDialog {
Q_OBJECT
public:
QPgplotDialog(QWidget *parent, const int &num = 0);
QPgplot *plotter;
protected:
void resizeEvent(QResizeEvent *);
};
/*
This is the PNG (Portable Network Graphics) driver for PGPLOT.
For more information on the PNG standard, and to get the
necessary libraries, see http://www.cdrom.com/pub/png/
This driver is intended to be used in the same ways as one would
use PGPLOT's GIF driver, and as such uses many of the same conventions.
The default plotting dimensions are 850x680, and can be
manipulated via the PGPLOT_PNG_WIDTH and PGPLOT_PNG_HEIGHT
environment variables.
The driver can be opened as many times as the caller likes (i.e., more
than one device number available). Associated with each device
is a single filename, and after each page advance the filename is
modified to have a trailing "_X", where "X" is the current
page number. This does not apply to the first page output,
however.
For compilation, both libpng and zlib must be installed. These
libraries are Free Software, and can be obtained at the following
URLs:
libpng: http://www.cdrom.com/pub/png/
zlib: http://www.cdrom.com/pub/infozip/zlib/
March, 1999
Pete Ratzlaff <pratzlaff@cfa.harvard.edu>
*/
extern "C" {
/* simple way of specifiying the current device structure pointer */
#define ACTIVE_DEVICE (all_devices.devices[all_devices.active])
#define boolean unsigned char
#define NCOLORS 256
typedef unsigned char ColorComponent; /* red, green, or blue component of a colortable entry */
typedef unsigned char ColorIndex; /* index into a color table */
/* data for a single open device */
typedef struct _DeviceData DeviceData, *DeviceDataPtr;
struct _DeviceData {
int w, h;
long npix; /* w*h */
boolean trans; /* transparent background flag */
boolean error; /* if true, we can plot no more on this device */
ColorIndex *pixmap; /* image consisting of array of color indicies */
int npages; /* running total of plot pages */
char *filename;
ColorComponent ctable[NCOLORS * 3];
ColorIndex cindex; /* current plotting color index */
int devnum; /* this device's identifier */
};
/* global data holding all devices */
typedef struct _Devices Devices;
struct _Devices {
DeviceDataPtr *devices;
int nallocated;
int active;
};
extern Devices all_devices;
extern int QPGPLOT_DEFAULT_WIDTH;
extern int QPGPLOT_DEFAULT_HEIGHT;
};
#endif // QPGPLOT_H
|