1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
14 |
|
|
15 |
|
#include "color.h" |
16 |
|
|
17 |
< |
#define FTINY 1e-7 |
17 |
> |
#define FTINY 1e-7 |
18 |
|
|
19 |
|
extern double rad; /* output pixel radius for filtering */ |
20 |
|
|
38 |
|
|
39 |
|
float *exptable; /* exponent table */ |
40 |
|
|
41 |
< |
#define lookexp(x) exptable[(int)(-10.*(x)+.5)] |
41 |
> |
#define lookexp(x) exptable[(int)(-10.*(x)+.5)] |
42 |
|
|
43 |
|
|
44 |
|
initmask() /* initialize gaussian lookup table */ |
66 |
|
static double d; |
67 |
|
static int y; |
68 |
|
register int x; |
69 |
< |
register COLOR *scan; |
69 |
> |
register COLOR *scan; |
70 |
|
|
71 |
|
wsum = 0; |
72 |
|
setcolor(csum, 0.0, 0.0, 0.0); |
101 |
|
static COLOR ctmp; |
102 |
|
static int y; |
103 |
|
register int x; |
104 |
< |
register COLOR *scan; |
104 |
> |
register COLOR *scan; |
105 |
|
|
106 |
|
wsum = FTINY; |
107 |
|
setcolor(csum, 0.0, 0.0, 0.0); |
108 |
< |
for (y = ycent+1-yrad; y <= ycent+yrad; y++) { |
108 |
> |
for (y = ycent-yrad; y <= ycent+yrad; y++) { |
109 |
|
if (y < 0 || y >= yres) |
110 |
|
continue; |
111 |
< |
dy = (y_r*y - r)/rad; |
111 |
> |
dy = (y_r*(y+.5) - (r+.5))/rad; |
112 |
|
scan = scanin[y%barsize]; |
113 |
< |
for (x = xcent+1-xrad; x <= xcent+xrad; x++) { |
113 |
> |
for (x = xcent-xrad; x <= xcent+xrad; x++) { |
114 |
|
if (x < 0 || x >= xres) |
115 |
|
continue; |
116 |
< |
dx = (x_c*x - c)/rad; |
116 |
> |
dx = (x_c*(x+.5) - (c+.5))/rad; |
117 |
|
weight = lookexp(-(dx*dx + dy*dy)); |
118 |
|
wsum += weight; |
119 |
|
copycolor(ctmp, scan[x]); |