30 |
|
#include "pic.h" |
31 |
|
#include "x11raster.h" |
32 |
|
#include "random.h" |
33 |
+ |
#include "x11icon.h" |
34 |
|
|
35 |
|
#define FONTNAME "8x13" /* text font we'll use */ |
36 |
|
|
78 |
|
|
79 |
|
double exposure = 1.0; /* exposure compensation used */ |
80 |
|
|
81 |
+ |
int wrongformat = 0; /* input in another format? */ |
82 |
+ |
|
83 |
|
GC revgc; /* graphics context with GXinvert */ |
84 |
|
|
85 |
|
XRASTER *ourras; /* our stored image */ |
159 |
|
} else if (i != argc) |
160 |
|
goto userr; |
161 |
|
/* get header */ |
162 |
< |
getheader(fin, headline); |
162 |
> |
getheader(fin, headline, NULL); |
163 |
|
/* get picture dimensions */ |
164 |
< |
if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
165 |
< |
quiterr("bad picture size"); |
164 |
> |
if (wrongformat || fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
165 |
> |
quiterr("bad picture format"); |
166 |
|
/* set view parameters */ |
167 |
|
if (gotview && setview(&ourview) != NULL) |
168 |
|
gotview = 0; |
186 |
|
{ |
187 |
|
static char *altname[] = {"rview","rpict","pinterp",VIEWSTR,NULL}; |
188 |
|
register char **an; |
189 |
+ |
char fmt[32]; |
190 |
|
|
191 |
|
if (isexpos(s)) |
192 |
|
exposure *= exposval(s); |
193 |
< |
else |
193 |
> |
else if (isformat(s)) { |
194 |
> |
formatval(fmt, s); |
195 |
> |
wrongformat = strcmp(fmt, COLRFMT); |
196 |
> |
} else |
197 |
|
for (an = altname; *an != NULL; an++) |
198 |
|
if (!strncmp(*an, s, strlen(*an))) { |
199 |
|
if (sscanview(&ourview, s+strlen(*an)) > 0) |
205 |
|
|
206 |
|
init() /* get data and open window */ |
207 |
|
{ |
208 |
+ |
XWMHints ourxwmhints; |
209 |
|
XSetWindowAttributes ourwinattr; |
210 |
|
XSizeHints oursizhints; |
211 |
|
register int i; |
268 |
|
} |
269 |
|
XSetNormalHints(thedisplay, wind, &oursizhints); |
270 |
|
} |
271 |
+ |
ourxwmhints.flags = InputHint|IconPixmapHint; |
272 |
+ |
ourxwmhints.input = True; |
273 |
+ |
ourxwmhints.icon_pixmap = XCreateBitmapFromData(thedisplay, |
274 |
+ |
wind, x11icon_bits, x11icon_width, x11icon_height); |
275 |
+ |
XSetWMHints(thedisplay, wind, &ourxwmhints); |
276 |
|
XSelectInput(thedisplay, wind, ButtonPressMask|ButtonReleaseMask |
277 |
|
|ButtonMotionMask|StructureNotifyMask |
278 |
|
|KeyPressMask|ExposureMask); |
424 |
|
sprintf(buf, "%.3f", intens(cval)/exposure); |
425 |
|
break; |
426 |
|
case 'l': /* luminance */ |
427 |
< |
sprintf(buf, "%.0fn", bright(cval)*683.0/exposure); |
427 |
> |
sprintf(buf, "%.0fL", luminance(cval)/exposure); |
428 |
|
break; |
429 |
|
case 'c': /* color */ |
430 |
|
comp = pow(2.0, (double)scale); |