#include "hisview_view.h" #include #ifdef underscore #define hisview hisview_ #endif #define MAXSIZE 512 #ifdef underscore #define hisview hisview_ #endif #ifdef f2c #define hisview hisview_ #endif int zoom, npix[2], size[2]; float *Himage, *Simage, *Vimage; char *Hname, *Sname, *Vname; float Hclip[2], Sclip[2], Vclip[2]; static char dumstr[80]; void get_clips(float *fimage, float clip[2]) { int i; clip[0] = fimage[0]; clip[1] = fimage[0]; for (i=1; i clip[1]) clip[1] = fimage[i]; } /* printf("%f %f\n", clip[0], clip[1]); */ } void (*phys_coord)()=NULL; /* Address storage of phys_coord function */ void hisview(char *Hfield, char *Sfield, char *Vfield, float *user_Himage, float *user_Simage, float *user_Vimage, int *Hsize, char *uiddir,void (*user_coord)()) { int i; XImage *image; char *pixels; char *works; Himage = user_Himage; Simage = user_Simage; Vimage = user_Vimage; phys_coord = user_coord; works = strrchr(Hfield, '/'); if (works != NULL) Hname = &works[1]; else Hname = Hfield; works = strrchr(Sfield, '/'); if (works != NULL) Sname = &works[1]; else Sname = Sfield; works = strrchr(Vfield, '/'); if (works != NULL) Vname = &works[1]; else Vname = Vfield; npix[0] = Hsize[0]; npix[1] = Hsize[1]; get_clips(Himage, Hclip); get_clips(Simage, Sclip); get_clips(Vimage, Vclip); zoom = 1; while (1) { if ((npix[0]*(zoom + 1) > MAXSIZE) || (npix[1]*(zoom + 1) > MAXSIZE)) break; zoom++; } size[0] = npix[0]*zoom; size[1] = npix[1]*zoom; inidisplay(uiddir, size); init_colors(); init_luts(); pixels = (char*) malloc(size[0]*size[1]*sizeof(char)); _2DfloatTo2Dbyte(Simage, 1, npix[0], 1, npix[1], pixels, zoom, zoom, Sclip); image = XCreateImage(display, visual, depth, ZPixmap, 0, pixels, size[0], size[1], 8, 0); XPutImage(display, Spixmap, gc, image, 0, 0, 0, 0, size[0], size[1]); XFree(image); _2DfloatTo2Dbyte(Vimage, 1, npix[0], 1, npix[1], pixels, zoom, zoom, Vclip); image = XCreateImage(display, visual, depth, ZPixmap, 0, pixels, size[0], size[1], 8, 0); XPutImage(display, Vpixmap, gc, image, 0, 0, 0, 0, size[0], size[1]); XFree(image); _2DfloatTo2Dbyte(Himage, 1, npix[0], 1, npix[1], pixels, zoom, zoom, Hclip); image = XCreateImage(display, visual, depth, ZPixmap, 0, pixels, size[0], size[1], 8, 0); XPutImage(display, Hpixmap, gc, image, 0, 0, 0, 0, size[0], size[1]); XFree(image); hsvimage(Himage, Simage, Vimage, 1, npix[0], 1, npix[1], pixels, zoom, zoom, Hclip, Sclip, Vclip); image = XCreateImage(display, visual, depth, ZPixmap, 0, pixels, size[0], size[1], 8, 0); XPutImage(display, HSVpixmap, gc, image, 0, 0, 0, 0, size[0], size[1]); XFree(image); XCopyArea(display, HSVpixmap, pixmap, gc, 0, 0, pixmapdim[0], pixmapdim[1], 0, 0); draw_wedge(Hclip); realize_top(); }