Go to the documentation of this file.
28 #define COLORLEVELS 64
29 #define PALBRIGHTS 0 //qb: wow, Q2 doesn't have fullbrights?
42 if (
name[0] !=
'/' &&
name[0] !=
'\\')
69 for (
i = 0;
i<256;
i++)
80 v = (255 << 24) + (
r << 0) + (g << 8) + (b << 16);
100 if (
r > 255)
r = 255;
if (
r < 0)
r = 0;
101 if (g > 255)g = 255;
if (g < 0)g = 0;
102 if (b > 255)b = 255;
if (b < 0)b = 0;
103 bestcolor =
palmap2[
r >> 3][g >> 3][b >> 3];
139 int bestdistortion, distortion;
147 bestdistortion = 256 * 256 * 4;
150 if (
r > 255)
r = 255;
151 if (g > 255) g = 255;
152 if (b > 255) b = 255;
155 for (
i = start;
i <= stop;
i++)
157 dr =
r - (
int)pal[0];
158 dg = g - (
int)pal[1];
159 db = b - (
int)pal[2];
161 distortion = dr*dr + dg*dg + db*db + dr * 5 + dg * 5 + db * 5;
162 if (distortion < bestdistortion)
167 bestdistortion = distortion;
177 float ra, ga, ba, ia;
179 float mypow = 1 / 1.3;
189 for (
r = 0;
r < 256;
r += 4)
191 for (g = 0; g < 256; g += 4)
193 for (b = 0; b < 256; b += 4)
197 ra = pow(
r / mydiv, mypow) * mydiv;
198 ga = pow(g / mydiv, mypow) * mydiv;
199 ba = pow(b / mydiv, mypow) * mydiv;
201 ia = (ra * 0.333) + (ga * 0.333) + (ba * 0.333);
202 ra = ia + (ra - ia) * mysat;
203 ga = ia + (ga - ia) * mysat;
204 ba = ia + (ba - ia) * mysat;
206 beastcolor =
BestColor((
int)ra, (
int)ga, (
int)ba, 1, 254);
208 palmap2[
r >> 2][g >> 2][b >> 2] = beastcolor;
248 int row, col, f,
i,
v,
skip = 0;
249 int fstep, tbyte,
sv;
253 if (num == 32 || num == 32 + 128)
268 if (num < 0 || num > 255)
279 drawline = 8 * scale->
value +
y;
284 drawline = 8 * scale->
value;
287 fstep = 0x8000 / scale->
value;
295 for (
i = 0;
i < 8 * scale->
value;
i += 4)
351 w = (
int)(
w / 4) * 4;
376 memcpy(dest, source,
w);
380 fstep = pic->
width * 0x10000 /
w;
381 for (
u = 0;
u <
w;
u += 4)
454 if (scale->
value > 1.f)
480 memcpy(dest, source, pic->
width);
482 source += pic->
width;
496 source += pic->
width;
523 source += pic->
width;
559 if (
w <= 0 || h <= 0)
609 for (
u = 0;
u <
w;
u++)
CONST PIXELFORMATDESCRIPTOR int
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data)
cvar_t *(* Cvar_Get)(char *name, char *value, int flags)
image_t * R_FindImage(char *name, imagetype_t type)
void Draw_Char(int x, int y, int num)
static void skip(vorb *z, int n)
byte BestColor(int r, int g, int b, int start, int stop)
unsigned d_8to24tabble[256]
void Draw_8to24(byte *palette)
void Draw_Fill(int x, int y, int w, int h, int c)
void Draw_InitRGBMap(void)
void(* Con_Printf)(int print_level, char *str,...)
void Draw_FadeScreen(void)
void Draw_InitLocal(void)
void Draw_StretchPicImplementation(int x, int y, int w, int h, image_t *pic)
void(* Sys_Error)(int err_level, char *str,...)
void Draw_TileClear(int x, int y, int w, int h, char *name)
unsigned d_8to24table[256]
void Draw_GetPicSize(int *w, int *h, char *pic)
void Draw_Pic(int x, int y, char *name)
image_t * Draw_FindPic(char *name)
int FindColor(int r, int g, int b)
GLdouble GLdouble GLdouble w
void Draw_StretchPic(int x, int y, int w, int h, char *name)
cvar_t * r_lightsaturation
#define TRANSPARENT_COLOR
void Com_sprintf(char *dest, int size, char *fmt,...)