1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Integer operations on COLR scanlines |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
+ |
#include <stdio.h> |
11 |
+ |
#include <math.h> |
12 |
|
#include "color.h" |
13 |
|
|
13 |
– |
#define NULL 0 |
14 |
– |
|
14 |
|
extern char *bmalloc(); |
15 |
|
|
16 |
|
#define MAXGSHIFT 31 /* maximum shift for gamma table */ |
19 |
|
|
20 |
|
static BYTE (*g_bval)[256] = NULL; |
21 |
|
|
23 |
– |
#ifndef pow |
24 |
– |
extern double pow(); |
25 |
– |
#endif |
22 |
|
|
23 |
< |
|
23 |
> |
int |
24 |
|
setcolrcor(f, a2) /* set brightness correction */ |
25 |
|
double (*f)(); |
26 |
|
double a2; |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
+ |
int |
46 |
|
setcolrinv(f, a2) /* set inverse brightness correction */ |
47 |
|
double (*f)(); |
48 |
|
double a2; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
+ |
int |
72 |
|
setcolrgam(g) /* set gamma conversion */ |
73 |
|
double g; |
74 |
|
{ |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
+ |
int |
82 |
|
colrs_gambs(scan, len) /* convert scanline of colrs to gamma bytes */ |
83 |
|
register COLR *scan; |
84 |
|
int len; |
128 |
|
} |
129 |
|
|
130 |
|
|
131 |
+ |
int |
132 |
|
gambs_colrs(scan, len) /* convert gamma bytes to colr scanline */ |
133 |
|
register COLR *scan; |
134 |
|
int len; |
135 |
|
{ |
136 |
|
register int nexpo; |
137 |
|
|
138 |
< |
if (g_mant == NULL | g_nexp == NULL) |
138 |
> |
if ((g_mant == NULL) | (g_nexp == NULL)) |
139 |
|
return(-1); |
140 |
|
while (len-- > 0) { |
141 |
|
nexpo = g_nexp[scan[0][RED]]; |
165 |
|
} |
166 |
|
|
167 |
|
|
168 |
+ |
void |
169 |
|
shiftcolrs(scan, len, adjust) /* shift a scanline of colors by 2^adjust */ |
170 |
|
register COLR *scan; |
171 |
|
register int len; |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
+ |
void |
191 |
|
normcolrs(scan, len, adjust) /* normalize a scanline of colrs */ |
192 |
|
register COLR *scan; |
193 |
|
int len; |