imagelib.c File Reference

Image related code. More...

#include "shared.h"
#include "imagelib.h"
#include <jpeglib.h>
#include <png.h>
Include dependency graph for imagelib.c:

Go to the source code of this file.

Data Structures

struct  _TargaHeader
struct  pngBuf_s

Typedefs

typedef struct _TargaHeader TargaHeader
typedef struct pngBuf_s pngBuf_t

Functions

static void LoadTGA (const char *name, byte **pic, int *width, int *height)
int TryLoadTGA (const char *path, miptex_t **mt)
 This is robbed from the engine source code, and refactored for use during map compilation.
static void PngReadFunc (png_struct *Png, png_bytep buf, png_size_t size)
static void LoadPNG (const char *name, byte **pic, int *width, int *height)
int TryLoadPNG (const char *path, miptex_t **mt)
 This is robbed from the engine source code, and refactored for use during map compilation.
static void ufo_jpg_null (j_decompress_ptr cinfo)
static boolean ufo_jpg_fill_input_buffer (j_decompress_ptr cinfo)
static void ufo_jpg_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
static void ufo_jpeg_mem_src (j_decompress_ptr cinfo, byte *mem, int len)
static void LoadJPG (const char *filename, byte **pic, int *width, int *height)
int TryLoadJPG (const char *path, miptex_t **mt)
 This is robbed from the engine source code, and refactored for use during map compilation.

Detailed Description

Image related code.

Definition in file imagelib.c.


Typedef Documentation

typedef struct pngBuf_s pngBuf_t
typedef struct _TargaHeader TargaHeader

Function Documentation

static void LoadJPG ( const char *  filename,
byte **  pic,
int *  width,
int *  height 
) [static]
See also:
LoadTGA
LoadPNG
R_FindImage

Definition at line 480 of file imagelib.c.

References byte, Com_Printf(), FS_LoadFile(), i, Mem_Alloc, Mem_Free, qtrue, Sys_Error(), and ufo_jpeg_mem_src().

Referenced by TryLoadJPG().

static void LoadPNG ( const char *  name,
byte **  pic,
int *  width,
int *  height 
) [static]
See also:
LoadTGA
LoadJPG

we want to treat all images the same way The following code transforms grayscale images of less than 8 to 8 bits, changes paletted images to RGB, and adds a full alpha channel if there is transparency information in a tRNS chunk.

Definition at line 287 of file imagelib.c.

References pngBuf_s::buffer, byte, Com_Printf(), FS_FreeFile(), FS_LoadFile(), i, int(), Mem_Alloc, PngReadFunc(), pngBuf_s::pos, and Sys_Error().

Referenced by TryLoadPNG().

static void LoadTGA ( const char *  name,
byte **  pic,
int *  width,
int *  height 
) [static]
static void PngReadFunc ( png_struct *  Png,
png_bytep  buf,
png_size_t  size 
) [static]

Definition at line 276 of file imagelib.c.

References pngBuf_s::buffer, and pngBuf_s::pos.

Referenced by LoadPNG().

int TryLoadJPG ( const char *  path,
miptex_t **  mt 
)

This is robbed from the engine source code, and refactored for use during map compilation.

Definition at line 581 of file imagelib.c.

References byte, dest, LoadJPG(), Mem_Alloc, and Mem_Free.

int TryLoadPNG ( const char *  path,
miptex_t **  mt 
)

This is robbed from the engine source code, and refactored for use during map compilation.

Definition at line 410 of file imagelib.c.

References byte, dest, LoadPNG(), Mem_Alloc, and Mem_Free.

int TryLoadTGA ( const char *  path,
miptex_t **  mt 
)

This is robbed from the engine source code, and refactored for use during map compilation.

Definition at line 237 of file imagelib.c.

References byte, dest, LoadTGA(), Mem_Alloc, and Mem_Free.

static void ufo_jpeg_mem_src ( j_decompress_ptr  cinfo,
byte mem,
int  len 
) [static]

Definition at line 463 of file imagelib.c.

References ufo_jpg_fill_input_buffer(), ufo_jpg_null(), and ufo_jpg_skip_input_data().

Referenced by LoadJPG().

static boolean ufo_jpg_fill_input_buffer ( j_decompress_ptr  cinfo  )  [static]

Definition at line 448 of file imagelib.c.

References VERB_EXTRA, and Verb_Printf().

Referenced by ufo_jpeg_mem_src().

static void ufo_jpg_null ( j_decompress_ptr  cinfo  )  [static]

Definition at line 444 of file imagelib.c.

Referenced by ufo_jpeg_mem_src().

static void ufo_jpg_skip_input_data ( j_decompress_ptr  cinfo,
long  num_bytes 
) [static]

Definition at line 454 of file imagelib.c.

References VERB_EXTRA, and Verb_Printf().

Referenced by ufo_jpeg_mem_src().


Generated by  doxygen 1.6.2