|
|
1.1 ! root 1: /* sunview.c - sunview display process */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/others/quipu/photo/RCS/sunview.c,v 7.1 90/07/09 14:40:30 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/others/quipu/photo/RCS/sunview.c,v 7.1 90/07/09 14:40:30 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: sunview.c,v $ ! 12: * Revision 7.1 90/07/09 14:40:30 mrose ! 13: * sync ! 14: * ! 15: * Revision 7.0 89/11/23 22:01:47 mrose ! 16: * Release 6.0 ! 17: * ! 18: */ ! 19: ! 20: /* ! 21: * NOTICE ! 22: * ! 23: * Acquisition, use, and distribution of this module and related ! 24: * materials are subject to the restrictions of a license agreement. ! 25: * Consult the Preface in the User's Manual for the full terms of ! 26: * this agreement. ! 27: * ! 28: */ ! 29: ! 30: ! 31: /* sunview display process */ ! 32: ! 33: #include <stdio.h> ! 34: #include "quipu/photo.h" ! 35: #include <suntool/tool_hs.h> ! 36: #include <suntool/panel.h> ! 37: #include <suntool/gfxsw.h> ! 38: #include <sys/resource.h> ! 39: ! 40: static struct gfxsubwindow *gfx; ! 41: static struct tool *tool; ! 42: static struct toolsw *gfx_sw; ! 43: static int sx=20,sy=20,x,y; ! 44: extern int PIC_LINESIZE; ! 45: ! 46: ! 47: sigwinched () ! 48: { ! 49: tool_sigwinch (tool); ! 50: } ! 51: ! 52: photo_start (name) ! 53: char * name; ! 54: { ! 55: char * getenv (); ! 56: ! 57: /* Initialise a window to recieve a photo of 'name' */ ! 58: ! 59: if (getenv ("WINDOW_PARENT") == (char *)NULL) { ! 60: (void) fprintf (stderr,"PHOTO: Must be running suntools on the console"); ! 61: return (-1); ! 62: } ! 63: ! 64: if (( tool = tool_make (WIN_LABEL,name,WIN_TOP,sx,WIN_LEFT,sy,0)) == NULL) { ! 65: (void) fprintf (stderr,"PHOTO: can't create window"); ! 66: return (-1); ! 67: } ! 68: ! 69: signal (SIGWINCH,sigwinched); ! 70: ! 71: gfx_sw = gfxsw_createtoolsubwindow (tool,"",TOOL_SWEXTENDTOEDGE,TOOL_SWEXTENDTOEDGE,NULL); ! 72: gfx = (struct gfxsubwindow *) gfx_sw->ts_data; ! 73: gfxsw_getretained (gfx); ! 74: ! 75: tool_install (tool); ! 76: ! 77: /* return 0 if sucessful -1 if not */ ! 78: return (0); ! 79: } ! 80: ! 81: ! 82: photo_end (name) ! 83: char * name; ! 84: { ! 85: /* Decoding has finished - display the photo */ ! 86: ! 87: (void) printf ("(See sunview window)"); ! 88: (void) fflush (stdout); ! 89: (void) close (1); ! 90: ! 91: /* return 0 if sucessful -1 if not */ ! 92: tool_set_attributes (tool,WIN_WIDTH,PIC_LINESIZE+40,WIN_HEIGHT,sy+40,0); ! 93: tool_select (tool,0); ! 94: ! 95: return (0); ! 96: } ! 97: ! 98: photo_black (length) ! 99: int length; ! 100: { ! 101: /* draw a black line of 'length' pixels */ ! 102: } ! 103: ! 104: photo_white (length) ! 105: int length; ! 106: { ! 107: /* draw a white line of 'length' pixels */ ! 108: } ! 109: ! 110: ! 111: photo_line_end (line) ! 112: bit_string * line; ! 113: { ! 114: struct pixrect * pix; ! 115: ! 116: /* the end of a line has been reached */ ! 117: /* A bit string is stored in line->dbuf_top */ ! 118: ! 119: pix = mem_point (PIC_LINESIZE,1,1,line->dbuf_top); ! 120: pw_write (gfx->gfx_pixwin, sx, sy, PIC_LINESIZE-sx, 1, PIX_SRC,pix,0,0); ! 121: sy++; ! 122: ! 123: } ! 124: ! 125:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.