Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!samsung!viewlog.viewlogic.com!josh From: josh@suntan.viewlogic.com (Josh Marantz) Newsgroups: comp.windows.x Subject: Visible pixel boundaries in xmag Message-ID: <1991May30.005300.2144@viewlogic.com> Date: 30 May 91 00:53:00 GMT Sender: news@viewlogic.com Organization: Viewlogic Systems, Inc., Marlboro, MA Lines: 78 Originator: josh@concept Nntp-Posting-Host: concept I find the program xmag really useful, but my eyes got tired trying to count pixels. So I made a quick hack to the program that draws lines between the blown-up pixels so you can count them. It uses XOR mode to show contrast, and we all know how perilous that can be, but the behavior seems acceptable after minimal testing on X11R4/Sparc I/Sun 4.1.1. I don't know whether this could go into the R5 distribution, but I guess we'd need a new command line option (right now it always behaves this way), and a man page update. Here's the (short) context diff: -Josh *** /u/olivaw/X11R4/clients/xmag/xmag.c Sun Dec 10 17:24:10 1989 --- xmag.c Wed May 29 20:46:15 1991 *************** *** 42,47 **** --- 42,48 ---- Window w; /* enlargement window */ Window root; /* root window of screen */ GC fillGC = (GC) NULL; /* for drawing enlargement */ + GC invGC = (GC) NULL; /* for drawing source region outline */ Bool do_grab = False; /* grab server */ char *pix_font = NULL; /* for displaying pixel value */ *************** *** 545,551 **** int lastx, lasty; unsigned int mask; Bool done; - static GC invGC = (GC) NULL; /* for drawing source region outline */ static Cursor invCursor; if (!invGC) { /* make it the first time */ --- 546,551 ---- *************** *** 864,869 **** --- 864,893 ---- r_y += magnification; /* advance to next scanline */ } /* end for */ + + /* + * Draw lines between the rows and columns so we can count the pixels! + * Use XOR mode to hopefully get some sort of contrast. + * + * -5/29/91, Joshua Marantz, Viewlogic Systems, Inc., josh@viewlogic.com + */ + for (row = e_row; row <= maxrow; row++) { + int y = row * magnification; + XDrawLine (dpy, w, invGC, + initialx, y, + initialx + (1 + maxcolumn) * magnification, y); + } /* for */ + + { + int initial_y = e_row * magnification; + + for (column = e_column; column <= maxcolumn; column++) { + int x = column * magnification; + XDrawLine (dpy, w, invGC, + x, initial_y, + x, initial_y + (1 + maxrow) * magnification); + } /* for */ + } XFlush (dpy); return; -- Joshua Marantz Viewlogic Systems, Inc. josh@viewlogic.com Why not pass the time by playing a little solitaire?