Sindbad~EG File Manager

Current Path : /usr/home/beeson/Otter-Lambda/yyy/
Upload File :
Current File : /usr/home/beeson/Otter-Lambda/yyy/cgraph.h

/*
include file for MATHPERT graphics; see also grapher.h, graphstr.h
M. Beeson
*/

/* _______________________________________________________________*/

/* 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.  */
           unsigned long fonts[6];  /* handles of 10 pt roman, italic, symbol and 8 pt roman, italic, symbol */
           int activefont;   /* ROMAN, ITALIC, SYMBOLFONT, or ROMFONT */
           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  */
           unsigned hdc;   /* used in Windows only */
           unsigned hwnd;  /* also used in Windows only */
           unsigned hBitmap; /* handle to a bitmap that is used for repainting */
           unsigned hCompatibleDC; /* memory hdc containing hBitmap, used for repainting */
           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 */

MEXPORT_CGRAPH void set_viewport(double,double,double,double);
void clear_viewport(void);
MEXPORT_CGRAPH void set_world(double,double,double,double);
MEXPORT_CGRAPH void world_to_pixel(double, double, int *, int *);
MEXPORT_CGRAPH void world_to_hdc(double,double, int *, int *);
MEXPORT_CGRAPH void move_to(double,double);
MEXPORT_CGRAPH void move_rel(double,double);
MEXPORT_CGRAPH void line_to(double,double);
MEXPORT_CGRAPH void line_rel(double,double);
MEXPORT_CGRAPH void draw_pixel(int, int, unsigned long);
MEXPORT_CGRAPH dstate *get_device(void);
MEXPORT_CGRAPH void put_image(int, int, unsigned , int);
MEXPORT_CGRAPH void get_image_size(unsigned , int *, int *);
MEXPORT_CGRAPH void set_device(unsigned, unsigned, void *, dstate *);
MEXPORT_CGRAPH void set_graph_decimalpoint(char);
/* void set_device(HWND, HDC, RECT *, dstate *);
   We avoid Windows dependence by using
   unsigneds and a void pointer.
*/
MEXPORT_CGRAPH void release_device(dstate *);
MEXPORT_CGRAPH void get_device_size(int *, int *, int *, int *);
MEXPORT_CGRAPH void draw_circle(double);
MEXPORT_CGRAPH void filled_circle(double,double,double);
void filled_rect(double,double,double,double);
void polygon(double *, double *, int);
void fill_polygon(double *, double *, int);
MEXPORT_CGRAPH void open_circle(double,double,double);

MEXPORT_CGRAPH void set_color(unsigned long);
MEXPORT_CGRAPH void set_textcolor(unsigned long);
MEXPORT_CGRAPH void set_background(unsigned long);

MEXPORT_CGRAPH void draw_box(double,double,double,double);
MEXPORT_CGRAPH void set_linewidth(double);
void join(double,double);
MEXPORT_CGRAPH void text(char *);
MEXPORT_CGRAPH void xormode(int);
int dotprtscr(void);
MEXPORT_CGRAPH 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);
MEXPORT_CGRAPH double get_aspect(void);
void PixelRect(int x1, int y1, int x2, int y2, unsigned long color);
/*___________________________________________________________________________*/
#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