| 1 |
< |
/* Copyright (c) 1990 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 580 |
|
avgbox(clr) /* average color over current box */ |
| 581 |
|
COLOR clr; |
| 582 |
|
{ |
| 583 |
+ |
static COLOR lc; |
| 584 |
+ |
static int ll, lr, lt, lb; |
| 585 |
|
int left, right, top, bottom; |
| 586 |
|
int y; |
| 587 |
|
double d; |
| 605 |
|
bottom = ymax; |
| 606 |
|
if (top >= bottom) |
| 607 |
|
return(-1); |
| 608 |
+ |
if (left == ll && right == lr && top == lt && bottom == lb) { |
| 609 |
+ |
copycolor(clr, lc); |
| 610 |
+ |
return; |
| 611 |
+ |
} |
| 612 |
|
for (y = top; y < bottom; y++) { |
| 613 |
|
if (getscan(y) == -1) |
| 614 |
|
return(-1); |
| 619 |
|
} |
| 620 |
|
d = 1.0/((right-left)*(bottom-top)); |
| 621 |
|
scalecolor(clr, d); |
| 622 |
+ |
ll = left; lr = right; lt = top; lb = bottom; |
| 623 |
+ |
copycolor(lc, clr); |
| 624 |
|
return(0); |
| 625 |
|
} |
| 626 |
|
|