2 |
|
# SCCSid "$SunId$ LBL" |
3 |
|
# |
4 |
|
# Normalize a pattern for tiling (-b option blends edges) by removing |
5 |
< |
# lowest frequencies from image and reducing to standard size (-r option) |
5 |
> |
# lowest frequencies from image (-f option) and reducing to |
6 |
> |
# standard size (-r option) |
7 |
|
# |
8 |
+ |
set ha=$0 |
9 |
+ |
set ha=$ha:t |
10 |
|
set pf="pfilt -e 2" |
11 |
|
while ($#argv > 0) |
12 |
|
switch ($argv[1]) |
14 |
|
shift argv |
15 |
|
set pf="$pf -x $argv[1] -y $argv[1] -p 1" |
16 |
|
breaksw |
17 |
+ |
case -f: |
18 |
+ |
set ha="$ha -f" |
19 |
+ |
set dofsub |
20 |
+ |
breaksw |
21 |
|
case -b: |
22 |
+ |
set ha="$ha -b" |
23 |
|
set blend |
24 |
|
breaksw |
25 |
|
case -v: |
37 |
|
onintr quit |
38 |
|
set td=/usr/tmp/np$$ |
39 |
|
mkdir $td |
32 |
– |
set ha=$0 |
33 |
– |
set ha=$ha:t |
34 |
– |
if ( $?blend ) then |
35 |
– |
set ha="$ha -b" |
36 |
– |
else |
37 |
– |
mknod $td/hf p |
38 |
– |
endif |
40 |
|
cat > $td/coef.fmt << '_EOF_' |
41 |
|
rcx=${ $1 }; rcy=${ $2 }; rsx=${ $3 }; rsy=${ $4 }; |
42 |
|
rcxcy=${ $5 }; rcxsy=${ $6 }; rsxcy=${ $7 }; rsxsy=${ $8 }; |
83 |
|
q |
84 |
|
_EOF_ |
85 |
|
set resolu=`getinfo -d < $td/pf | sed 's/-Y \([0-9]*\) +X \([0-9]*\)/\2 \1/'` |
86 |
+ |
if ( ! $?dofsub ) then |
87 |
+ |
mv $td/pf $td/hf |
88 |
+ |
goto donefsub |
89 |
+ |
endif |
90 |
|
if ( $?verb ) then |
91 |
|
echo computing Fourier coefficients... |
92 |
|
endif |
98 |
|
cat $td/coef |
99 |
|
echo removing low frequencies... |
100 |
|
endif |
96 |
– |
if ( ! $?blend ) then |
97 |
– |
( getinfo - < $td/hf >> $f & ) > /dev/null |
98 |
– |
endif |
101 |
|
pcomb -f $td/fsub.cal -f $td/coef \ |
102 |
|
-e "xres=$resolu[1];yres=$resolu[2]" \ |
103 |
|
$td/pf > $td/hf |
104 |
+ |
donefsub: |
105 |
|
if ( $?blend ) then |
106 |
|
if ( $?verb ) then |
107 |
|
echo blending edges... |
128 |
|
$td/bottom $td/top > $td/top.patch |
129 |
|
pcompos $td/hflr 0 0 $td/bottom.patch 0 0 $td/top.patch 0 $mar \ |
130 |
|
| getinfo - >> $f |
131 |
+ |
else |
132 |
+ |
getinfo - < $td/hf >> $f |
133 |
|
endif |
134 |
|
if ( $?verb ) then |
135 |
|
echo $f done. |