Annotation of 43BSDReno/contrib/isode-beta/others/quipu/uips/pod/photo.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char *rcsid = "$Header: /f/osi/others/quipu/uips/pod/RCS/photo.c,v 7.0 90/06/12 13:15:50 mrose Exp $";
                      3: #endif
                      4: 
                      5: /*
                      6:  * $Header: /f/osi/others/quipu/uips/pod/RCS/photo.c,v 7.0 90/06/12 13:15:50 mrose Exp $
                      7:  */
                      8: 
                      9: /*
                     10:  * $Log:       photo.c,v $
                     11:  * Revision 7.0  90/06/12  13:15:50  mrose
                     12:  * *** empty log message ***
                     13:  * 
                     14:  * Revision 1.5  90/04/26  10:21:15  emsrdsm
                     15:  * *** empty log message ***
                     16:  * 
                     17:  * Revision 1.4  90/04/25  13:47:26  emsrdsm
                     18:  * i) lint'ed
                     19:  * 
                     20:  * Revision 1.3  90/04/20  10:28:20  emsrdsm
                     21:  * (i) fixed form bug
                     22:  * 
                     23:  * Revision 1.2  90/04/18  18:48:19  emsrdsm
                     24:  * i) added logging
                     25:  * 
                     26:  * Revision 1.1  90/04/10  16:44:23  emsrdsm
                     27:  * Initial revision
                     28:  * 
                     29:  */
                     30: 
                     31: #include "quipu/photo.h"
                     32: #include "pod.h"
                     33: 
                     34: extern Widget toplevel;
                     35: extern Widget PhotoWindow;
                     36: 
                     37: extern GC XCreateGC();
                     38: GC gc;
                     39: char photo_name[1024];
                     40: Pixmap photo_pixmap = 0;
                     41: Display *dpy;
                     42: Screen *scr;
                     43: int winX, winY, winW, winH;
                     44: extern int NUMLINES,PIC_LINESIZE;
                     45: extern unsigned position;
                     46: unsigned long XorVal;
                     47: 
                     48: static int passno = 1;
                     49: static int x, y;
                     50: int px, py, maxx;
                     51: 
                     52: extern int two_passes;
                     53: 
                     54: /*ARGSUSED*/
                     55: photo_start (name)
                     56: char *name;
                     57: {
                     58:   x = y = 0;
                     59:   if (passno == 1)
                     60:     maxx = 0, two_passes = 1;
                     61:   return 0;
                     62: }
                     63: 
                     64: photo_end (name)
                     65: char *name;
                     66: {
                     67:   if (passno == 1) {
                     68:     passno = 2;
                     69:     px = x = maxx;
                     70:     py = --y;
                     71:   
                     72:     if (photo_pixmap) {
                     73:       XFreePixmap(XtDisplay(toplevel), photo_pixmap);
                     74:       photo_pixmap = 0;
                     75:     }
                     76: 
                     77:     kill_photo();
                     78:     make_photo_widget();
                     79: 
                     80:     dpy = XtDisplay(toplevel);
                     81:     scr = DefaultScreenOfDisplay(dpy);
                     82:     
                     83:     winW = x;
                     84:     winH = y;
                     85: 
                     86:     photo_pixmap = XCreatePixmap(dpy, XtWindow(PhotoWindow),
                     87:                                 x, y, DefaultDepthOfScreen(scr));
                     88:     gc = XCreateGC(dpy, photo_pixmap, 0, NULL);
                     89: 
                     90:     XSetFunction(dpy, gc, GXclear);
                     91:     
                     92:     XSetForeground(dpy, gc, WhitePixelOfScreen(scr));
                     93:     XSetBackground(dpy, gc, BlackPixelOfScreen(scr));
                     94:     
                     95:     XFillRectangle(dpy, photo_pixmap, gc, 0, 0, winW,winH);
                     96: 
                     97:     XSetFunction(dpy, gc, GXcopy);
                     98: 
                     99:     XSetForeground(dpy, gc, BlackPixelOfScreen(scr));
                    100:     XSetBackground(dpy, gc, WhitePixelOfScreen(scr));
                    101: 
                    102:     XFillRectangle(dpy, photo_pixmap, gc, 0, 0, winW,winH);
                    103: 
                    104:     XSetForeground(dpy, gc, WhitePixelOfScreen(scr));
                    105:     XSetBackground(dpy, gc, BlackPixelOfScreen(scr));
                    106:     
                    107:     XorVal = WhitePixelOfScreen(scr) ^ BlackPixelOfScreen(scr);
                    108:     
                    109:     return 0;
                    110:   }
                    111:   if (name && *name) (void) strcpy(photo_name, name);
                    112:   passno = 1;
                    113:   x = y = maxx = 0;
                    114:   return 0;
                    115: }
                    116: 
                    117: /*ARGSUSED*/
                    118: photo_line_end (line)
                    119: bit_string * line;
                    120: {
                    121:   /* the end of a line has been reached */
                    122:   /* A bit string is stored in line->dbuf_top */
                    123:   
                    124:   if (passno == 1 && x > maxx)
                    125:     maxx = x;
                    126:   x = 0, y++;
                    127:   
                    128:   return 0;
                    129: }
                    130: 
                    131: photo_black (length)
                    132: int length;
                    133: {
                    134:   if (passno == 1) {
                    135:     x += length;
                    136:     return 0;
                    137:   }
                    138:   /* draw a black line of 'length' pixels */
                    139:   
                    140:   return 0;
                    141: }
                    142: 
                    143: photo_white (length)
                    144: int length;
                    145: {
                    146:   if (passno == 1) {
                    147:     x += length;
                    148:     return 0;
                    149:   }
                    150:   
                    151:   /* draw a white line of 'length' pixels */
                    152:   XDrawLine (dpy, photo_pixmap, gc, 
                    153:             position, NUMLINES, length+position-1, NUMLINES);
                    154:   
                    155:   return 0;
                    156: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.