Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/
Upload File :
Current File : /usr/home/beeson/MathXpert/cgraph.h

/*
include file for MATHPERT graphics; see also grapher.h, graphstr.h
M. Beeson
4.22.13,  introducted ptrdiff_t for some members of dstate structure
*/

/* _______________________________________________________________*/

/* left, right, bottom, and top are in "normalized device coordinates";
(0,0) is at the LOWER LEFT.  But in HALO, both directions run from 0 to 1,
while in Third Wave, the LARGER dimension is 1.0, and the other one is the
aspect ratio (at least on the screen). Thus you can't specify viewports by
coordinates independent of which graphics package you are using.  */
/*_____________________________________________________________________*/
#define HRES  device->numxpixels
#define VRES  device->numypixels
#define ASPECT  get_aspect()   /* used to be 0.75, good only for screen */
 /* ratio of height to width of display surface in centimeters */

typedef struct
        {  unsigned long color;
           int linewidth;
           double xmin;  /* world coordinates */
           double xmax;
           double ymin;
           double ymax;
           double dxmin; /* normalized device coordinates of viewport */
           double dxmax; /* normalized to 1.0 BOTH DIRECTIONS */
           double dymin; /* device coordinates start in lower left, like world coords */
           double dymax;
           int xPixelsPerInch;
           int yPixelsPerInch;
           int pxmin;  /* pixel coordinates of viewport */
           int pxmax;  /* remember these start in upper left, not lower left */
           int pymin;
           int pymax;
           double aspect;   /* ratio of height to width in centimeters  */
           double xfactor;   /* multiply world coordinates by this to get pixels */
           double yfactor;
           double xpixel;   /* multiply device coords by this to get world coords */
           double ypixel;
           double x;     /* current pen position in world coordinates */
           double y;
            /* following items describe the hardware, not the viewport */
           int numxpixels;       /* number of pixels on X axis */
           int numypixels;       /* number of pixels on Y axis */
           int adapter;          /* active display adapter */
                                 /* negative for printers  */
           int ncolors;   /* how many colors (or shades of gray) are available */
           int monochrome;  /* color not desired--LCD monitor, or printer */
           int mode;     /* what graphics mode should be used?  DOS only */
           int init;    /* unknown (so probably 0)
                           until set_device is called, then set to 3;
                           then (in DOS) initgraph sets it to 1,
                           and after that it
                           alternates between 1 and 2 for graphics and text
                           modes.  In Windows it just stays 3.  */
   
           int activefont;   /* ROMAN or ITALIC */
           int fontheight;  /* height of one character in device coordinates */
           int fontwidth;   /* width of one (average) character */
           int baseline;    /* distance from top of character box to baseline */
           int lineskip;   /* desired between-line spacing, in device coordinates */
           double xcliplimit, ycliplimit;   /* these values in world
                  coordinates = 32K pixel units  */
#if 0
           ptrdiff_t hdc;   /* used in Windows only */
           ptrdiff_t hwnd;  /* also used in Windows only */
           ptrdiff_t hBitmap; /* handle to a bitmap that is used for repainting */
           ptrdiff_t hCompatibleDC; /* memory hdc containing hBitmap, used for repainting */
#endif
           int ixmin,ixmax,iymin,iymax;  /* the invalid rectangle in pixel coordinates */
           int penmemory:1;  /* nonzero when pen has been made by CreatePen */
           int brushmemory:1;  /* nonzero when brush has been allocated     */
         } dstate;

/* prototypes of functions in wingraph.c */

void set_viewport(double,double,double,double);
void clear_viewport(void);
void set_world(double,double,double,double);
void world_to_pixel(double, double, int *, int *);
void world_to_hdc(double,double, int *, int *);
void move_to(double,double);
void move_rel(double,double);
void line_to(double,double);
void line_rel(double,double);
void draw_pixel(int, int, unsigned long);
dstate *get_device(void);
void put_image(int, int, unsigned , int);
void get_image_size(unsigned , int *, int *);
void set_graph_decimalpoint(char);
void release_device(dstate *);
void get_device_size(int *, int *, int *, int *);
void draw_circle(double);
void filled_circle(double,double,double);
void filled_rect(double,double,double,double);
void polygon(double *, double *, int);
void fill_polygon(double *, double *, int);
void open_circle(double,double,double);
void draw_box(double,double,double,double);
void set_linewidth(double);
void text(char *);
void xormode(int);
int dotprtscr(void);
void dtext_size(char *, int *, int *);
int save_screen(void);
void restore_screen(void);
void gwrite(char *, unsigned short, unsigned short, char);
void gputch(unsigned char, unsigned short, unsigned short, char);
void change_font(int);
double get_aspect(void);
/*___________________________________________________________________________*/
#define GRAPHICS 1 /* value of screen.init in graphics mode */
        /* screen.init is 2 in text mode after text_mode(), but
           before we've been to graphics mode, it need not be 2,
           so test for text mode by screen.init != GRAPHICS.
           After set_device, it is 3 till we go to graphics mode */

#define XORMODE  12
#define COPYMODE 13

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists