#include "shared.h"
#include "imagelib.h"
#include <jpeglib.h>
#include <png.h>
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. |
Image related code.
Definition in file imagelib.c.
typedef struct _TargaHeader TargaHeader |
static void LoadJPG | ( | const char * | filename, | |
byte ** | pic, | |||
int * | width, | |||
int * | height | |||
) | [static] |
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] |
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] |
Definition at line 46 of file imagelib.c.
References _TargaHeader::attributes, byte, _TargaHeader::colormap_index, _TargaHeader::colormap_length, _TargaHeader::colormap_size, _TargaHeader::colormap_type, FS_FreeFile(), FS_LoadFile(), green, _TargaHeader::height, _TargaHeader::id_length, _TargaHeader::image_type, LittleShort(), Mem_Alloc, _TargaHeader::pixel_size, red, Sys_Error(), _TargaHeader::width, _TargaHeader::x_origin, and _TargaHeader::y_origin.
Referenced by TryLoadTGA().
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 | |||
) |
int TryLoadPNG | ( | const char * | path, | |
miptex_t ** | mt | |||
) |
int TryLoadTGA | ( | const char * | path, | |
miptex_t ** | mt | |||
) |
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().