Go to the documentation of this file.
24 #define MAX_RIMAGES 1024
93 int dataByte, runLength;
135 out = malloc ( (pcx->
ymax+1) * (pcx->
xmax+1) );
143 *palette = malloc(768);
144 memcpy (*palette, (
byte *)pcx + len - 768, 768);
154 for (
x=0 ;
x<=pcx->
xmax ; )
158 if((dataByte & 0xC0) == 0xC0)
160 runLength = dataByte & 0x3F;
166 while(runLength-- > 0)
172 if ( raw - (
byte *)pcx > len)
206 int columns, rows, numPixels;
257 columns = targa_header.
width;
258 rows = targa_header.
height;
259 numPixels = columns * rows;
266 targa_rgba = malloc (numPixels*4);
273 for(row=rows-1; row>=0; row--) {
274 pixbuf = targa_rgba + row*columns*4;
275 for(column=0; column<columns; column++) {
292 alphabyte = *buf_p++;
296 *pixbuf++ = alphabyte;
303 unsigned char red,
green,
blue,alphabyte,packetHeader,packetSize,
j;
304 for(row=rows-1; row>=0; row--) {
305 pixbuf = targa_rgba + row*columns*4;
306 for(column=0; column<columns; ) {
307 packetHeader= *buf_p++;
308 packetSize = 1 + (packetHeader & 0x7f);
309 if (packetHeader & 0x80) {
321 alphabyte = *buf_p++;
325 for(
j=0;
j<packetSize;
j++) {
331 if (column==columns) {
337 pixbuf = targa_rgba + row*columns*4;
342 for(
j=0;
j<packetSize;
j++) {
357 alphabyte = *buf_p++;
361 *pixbuf++ = alphabyte;
365 if (column==columns) {
371 pixbuf = targa_rgba + row*columns*4;
420 if (strlen(
name) >=
sizeof(image->
name))
430 image->
pixels[0] = malloc (c);
432 for (
i=0 ;
i<c ;
i++)
469 size = image->
width*image->
height * (256+64+16+4)/256;
470 image->
pixels[0] = malloc (size);
476 memcpy ( image->
pixels[0], (
byte *)mt + ofs, size);
519 if (!strcmp(
name+len-4,
".pcx"))
526 else if (!strcmp(
name+len-4,
".wal"))
530 else if (!strcmp(
name+len-4,
".tga"))
582 memset (image, 0,
sizeof(*image));
614 memset (image, 0,
sizeof(*image));
image_t * GL_LoadPic(char *name, byte *pic, int width, int height, imagetype_t type)
short LittleShort(short l)
CONST PIXELFORMATDESCRIPTOR int
void R_ShutdownImages(void)
void LoadTGA(char *name, byte **pic, int *width, int *height)
int(* FS_LoadFile)(char *name, void **buf)
image_t * R_FindImage(char *name, imagetype_t type)
image_t * r_notexture_mip
int registration_sequence
void(* FS_FreeFile)(void *buf)
void R_FreeUnusedImages(void)
void(* Con_Printf)(int print_level, char *str,...)
struct _TargaHeader TargaHeader
image_t * R_LoadWal(char *name)
image_t r_images[MAX_RIMAGES]
struct image_s * R_RegisterSkin(char *name)
void(* Sys_Error)(int err_level, char *str,...)
unsigned short palette_type
image_t * R_FindFreeImage(void)
void Com_PageInMemory(byte *buffer, int size)
int registration_sequence
void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height)
unsigned short bytes_per_line