FTEQW
Documentation of the FTE engine source tree.
image.c File Reference

Typedefs

typedef struct my_error_mgr * my_error_ptr
 
typedef my_source_mgr * my_src_ptr
 
typedef struct bmpheader_s bmpheader_t
 
typedef struct bmpheaderv4_s bmpheaderv4_t
 
typedef void ImfInputFile
 
typedef void ImfHeader
 
typedef void ImfRgba
 

Functions

float FloatSwap (float l)
 
qboolean Image_RegisterLoader (void *module, plugimageloaderfuncs_t *driver)
 
voidReadTargaFile (qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean greyonly, uploadfmt_t forceformat)
 
qboolean WriteTGA (const char *filename, enum fs_relative fsroot, const qbyte *fte_restrict rgb_buffer, qintptr_t bytestride, int width, int height, enum uploadfmt fmt)
 
static png_const_charp error_message PSTATIC (png_error)
 
static png_infop info_ptr PSTATIC (png_read_end)
 
static png_bytepp image PSTATIC (png_read_image)
 
static png_const_inforp info_ptr PSTATIC (png_get_bit_depth)
 
static png_const_inforp info_ptr PSTATIC (png_get_channels)
 
static png_const_inforp info_ptr PSTATIC (png_get_rowbytes)
 
static png_infop info_ptr PSTATIC (png_read_update_info)
 
static png_const_infop png_uint_32 flag PSTATIC (png_get_valid)
 
static png_uint_32 int flags PSTATIC (png_set_filler)
 
static png_const_inforp png_uint_32 png_uint_32 int int int int int *filter_method PSTATIC (png_get_IHDR)
 
static png_inforp png_colorp int *num_palette PSTATIC (png_get_PLTE)
 
static png_inforp png_bytep int png_color_16p *trans_color PSTATIC (png_get_tRNS)
 
static png_infop info_ptr PSTATIC (png_read_info)
 
static int num_bytes PSTATIC (png_set_sig_bytes)
 
static png_voidp png_rw_ptr read_data_fn PSTATIC (png_set_read_fn)
 
static png_infopp png_infopp end_info_ptr_ptr PSTATIC (png_destroy_read_struct)
 
static png_voidp png_error_ptr png_error_ptr warn_fn PSTATIC (png_create_read_struct)
 
static png_size_t png_size_t num_to_check PSTATIC (png_sig_cmp)
 
static png_inforp info_ptr PSTATIC (png_write_end)
 
static png_bytepp image PSTATIC (png_write_image)
 
static png_const_inforp info_ptr PSTATIC (png_write_info)
 
static png_infop png_const_textp int num_text PSTATIC (png_set_text)
 
static png_infop png_uint_32 png_uint_32 int int int int int filter_method PSTATIC (png_set_IHDR)
 
static png_inforp png_const_colorp int num_palette PSTATIC (png_set_PLTE)
 
static int level PSTATIC (png_set_compression_level)
 
static png_FILE_p fp PSTATIC (png_init_io)
 
static png_infopp info_ptr_ptr PSTATIC (png_destroy_write_struct)
 
static png_voidp png_error_ptr png_error_ptr warn_fn PSTATIC (png_create_write_struct)
 
static png_inforp png_const_unknown_chunkp int num_unknowns PSTATIC (png_set_unknown_chunks)
 
qboolean LibPNG_Init (void)
 
qbyteReadPNGFile (const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32)
 
int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compression, void **buffers, int numbuffers, qintptr_t bufferstride, int width, int height, enum uploadfmt fmt, qboolean writemetadata)
 
static int desired JSTATIC (jpeg_resync_to_restart)
 
static JSAMPARRAY JDIMENSION max_lines JSTATIC (jpeg_read_scanlines)
 
static boolean require_image JSTATIC (jpeg_read_header)
 
static int size_t structsize JSTATIC (jpeg_CreateDecompress)
 
 METHODDEF (void)
 
 METHODDEF (JPEG_boolean)
 
 GLOBAL (void)
 
qbyteReadJPEGFile (qbyte *infile, int length, int *width, int *height)
 
qboolean screenshotJPEG (char *filename, enum fs_relative fsroot, int compression, qbyte *screendata, qintptr_t stride, int screenwidth, int screenheight, enum uploadfmt fmt, unsigned int writemeta)
 
qboolean WritePCXfile (const char *filename, enum fs_relative fsroot, qbyte *data, int width, int height, int rowbytes, qbyte *palette, qboolean upload)
 
qbyteReadPCXFile (qbyte *buf, int length, int *width, int *height)
 
qbyteReadPCXData (qbyte *buf, int length, int width, int height, qbyte *result)
 
qbyteReadPCXPalette (qbyte *buf, int len, qbyte *out)
 
qboolean WriteBMPFile (char *filename, enum fs_relative fsroot, qbyte *in, qintptr_t instride, int width, int height, uploadfmt_t fmt)
 

Variables

cvar_t r_dodgytgafiles = CVARD("r_dodgytgafiles", "0", "Many old glquake engines had a buggy tga loader that ignored bottom-up flags. Naturally people worked around this and the world was plagued with buggy images. Most engines have now fixed the bug, but you can reenable it if you have bugged tga files.")
 
cvar_t r_dodgypcxfiles = CVARD("r_dodgypcxfiles", "0", "When enabled, this will ignore the palette stored within pcx files, for compatibility with quake2.")
 
cvar_t r_dodgymiptex = CVARD("r_dodgymiptex", "1", "When enabled, this will force regeneration of mipmaps, discarding mips1-4 like glquake did. This may eg solve fullbright issues with some maps, but may reduce distant detail levels.")
 
cvar_t r_keepimages = CVARD("r_keepimages", "0", "Retain unused images in memory for slightly faster map loading.\n0: Redundant images will be purged after each map change.\n1: Images will be retained until vid_reload (potentially consuming a lot of ram).")
 
cvar_t r_ignoremapprefixes = CVARD("r_ignoremapprefixes", "0", "Ignores when textures were loaded from map-specific paths.\n0: textures/foo/tex.tga will not be confused with textures/foo/tex.tga.\n1: The same texture might be loaded multiple times over.")
 
char * r_defaultimageextensions
 
cvar_t r_imageextensions = CVARCD("r_imageextensions", NULL, R_ImageExtensions_Callback, "The list of image file extensions which might exist on disk (note that this does not list all supported formats, only the extensions that should be searched for).")
 
cvar_t r_image_downloadsizelimit = CVARFD("r_image_downloadsizelimit", "131072", CVAR_NOTFROMSERVER, "The maximum allowed file size of images loaded from a web-based url. 0 disables completely, while empty imposes no limit.")
 
cvar_t scr_sshot_compression
 
cvar_t gl_lerpimages
 
cvar_t gl_picmip2d
 
cvar_t gl_picmip
 
cvar_t gl_picmip_world
 
cvar_t gl_picmip_sprites
 
cvar_t gl_picmip_other
 
cvar_t r_shadow_bumpscale_basetexture
 
cvar_t r_shadow_bumpscale_bumpmap
 
cvar_t r_shadow_heightscale_basetexture
 
cvar_t r_shadow_heightscale_bumpmap
 
const float rgb9e5tab [32]
 
static png_const_infop info_ptr
 
static png_uint_32 filler
 
static png_const_inforp png_uint_32width
 
static png_const_inforp png_uint_32 png_uint_32height
 
static png_const_inforp png_uint_32 png_uint_32 intbit_depth
 
static png_const_inforp png_uint_32 png_uint_32 int intcolor_type
 
static png_const_inforp png_uint_32 png_uint_32 int int intinterlace_method
 
static png_const_inforp png_uint_32 png_uint_32 int int int intcompression_method
 
static png_inforp png_colorp * palette
 
static png_inforp png_bytep * trans_alpha
 
static png_inforp png_bytep intnum_trans
 
static png_voidp io_ptr
 
static png_infopp info_ptr_ptr
 
static png_voidp error_ptr
 
static png_voidp png_error_ptr error_fn
 
static png_size_t start
 
static png_infop png_const_textp text_ptr
 
static png_inforp png_const_unknown_chunkp unknowns
 
static JSAMPARRAY scanlines
 
static int version
 

Typedef Documentation

◆ bmpheader_t

typedef struct bmpheader_s bmpheader_t

◆ bmpheaderv4_t

typedef struct bmpheaderv4_s bmpheaderv4_t

◆ ImfHeader

typedef void ImfHeader

◆ ImfInputFile

typedef void ImfInputFile

◆ ImfRgba

typedef void ImfRgba

◆ my_error_ptr

typedef struct my_error_mgr* my_error_ptr

◆ my_src_ptr

typedef my_source_mgr* my_src_ptr

Function Documentation

◆ FloatSwap()

float FloatSwap ( float  l)

◆ GLOBAL()

GLOBAL ( void  )

◆ Image_RegisterLoader()

qboolean Image_RegisterLoader ( void module,
plugimageloaderfuncs_t driver 
)

◆ Image_WritePNG()

int Image_WritePNG ( const char *  filename,
enum fs_relative  fsroot,
int  compression,
void **  buffers,
int  numbuffers,
qintptr_t  bufferstride,
int  width,
int  height,
enum uploadfmt  fmt,
qboolean  writemetadata 
)

◆ JSTATIC() [1/4]

static int size_t structsize JSTATIC ( jpeg_CreateDecompress  )

◆ JSTATIC() [2/4]

static boolean require_image JSTATIC ( jpeg_read_header  )

◆ JSTATIC() [3/4]

static JSAMPARRAY JDIMENSION max_lines JSTATIC ( jpeg_read_scanlines  )

◆ JSTATIC() [4/4]

static int desired JSTATIC ( jpeg_resync_to_restart  )

◆ LibPNG_Init()

qboolean LibPNG_Init ( void  )

◆ METHODDEF() [1/2]

METHODDEF ( JPEG_boolean  )

◆ METHODDEF() [2/2]

METHODDEF ( void  )

◆ PSTATIC() [1/29]

static png_voidp png_error_ptr png_error_ptr warn_fn PSTATIC ( png_create_read_struct  )

◆ PSTATIC() [2/29]

static png_voidp png_error_ptr png_error_ptr warn_fn PSTATIC ( png_create_write_struct  )

◆ PSTATIC() [3/29]

static png_infopp png_infopp end_info_ptr_ptr PSTATIC ( png_destroy_read_struct  )

◆ PSTATIC() [4/29]

static png_infopp info_ptr_ptr PSTATIC ( png_destroy_write_struct  )

◆ PSTATIC() [5/29]

static png_const_charp error_message PSTATIC ( png_error  )

◆ PSTATIC() [6/29]

static png_const_inforp info_ptr PSTATIC ( png_get_bit_depth  )

◆ PSTATIC() [7/29]

static png_const_inforp info_ptr PSTATIC ( png_get_channels  )

◆ PSTATIC() [8/29]

static png_const_inforp png_uint_32 png_uint_32 int int int int int *filter_method PSTATIC ( png_get_IHDR  )

◆ PSTATIC() [9/29]

static png_inforp png_colorp int *num_palette PSTATIC ( png_get_PLTE  )

◆ PSTATIC() [10/29]

png_const_inforp info_ptr PSTATIC ( png_get_rowbytes  )

◆ PSTATIC() [11/29]

static png_inforp png_bytep int png_color_16p *trans_color PSTATIC ( png_get_tRNS  )

◆ PSTATIC() [12/29]

static png_const_infop png_uint_32 flag PSTATIC ( png_get_valid  )

◆ PSTATIC() [13/29]

static png_FILE_p fp PSTATIC ( png_init_io  )

◆ PSTATIC() [14/29]

static png_infop info_ptr PSTATIC ( png_read_end  )

◆ PSTATIC() [15/29]

static png_bytepp image PSTATIC ( png_read_image  )

◆ PSTATIC() [16/29]

static png_infop info_ptr PSTATIC ( png_read_info  )

◆ PSTATIC() [17/29]

static png_infop info_ptr PSTATIC ( png_read_update_info  )

◆ PSTATIC() [18/29]

static int level PSTATIC ( png_set_compression_level  )

◆ PSTATIC() [19/29]

static png_uint_32 int flags PSTATIC ( png_set_filler  )

◆ PSTATIC() [20/29]

static png_infop png_uint_32 png_uint_32 int int int int int filter_method PSTATIC ( png_set_IHDR  )

◆ PSTATIC() [21/29]

static png_inforp png_const_colorp int num_palette PSTATIC ( png_set_PLTE  )

◆ PSTATIC() [22/29]

static png_voidp png_rw_ptr read_data_fn PSTATIC ( png_set_read_fn  )

◆ PSTATIC() [23/29]

static int num_bytes PSTATIC ( png_set_sig_bytes  )

◆ PSTATIC() [24/29]

static png_infop png_const_textp int num_text PSTATIC ( png_set_text  )

◆ PSTATIC() [25/29]

static png_inforp png_const_unknown_chunkp int num_unknowns PSTATIC ( png_set_unknown_chunks  )

◆ PSTATIC() [26/29]

static png_size_t png_size_t num_to_check PSTATIC ( png_sig_cmp  )

◆ PSTATIC() [27/29]

static png_inforp info_ptr PSTATIC ( png_write_end  )

◆ PSTATIC() [28/29]

static png_bytepp image PSTATIC ( png_write_image  )

◆ PSTATIC() [29/29]

static png_const_inforp info_ptr PSTATIC ( png_write_info  )

◆ ReadJPEGFile()

qbyte * ReadJPEGFile ( qbyte infile,
int  length,
int width,
int height 
)

◆ ReadPCXData()

qbyte * ReadPCXData ( qbyte buf,
int  length,
int  width,
int  height,
qbyte result 
)

◆ ReadPCXFile()

qbyte * ReadPCXFile ( qbyte buf,
int  length,
int width,
int height 
)

◆ ReadPCXPalette()

qbyte * ReadPCXPalette ( qbyte buf,
int  len,
qbyte out 
)

◆ ReadPNGFile()

qbyte * ReadPNGFile ( const char *  fname,
qbyte buf,
int  length,
int width,
int height,
uploadfmt_t format,
qboolean  force_rgb32 
)

◆ ReadTargaFile()

void * ReadTargaFile ( qbyte buf,
int  length,
int width,
int height,
uploadfmt_t format,
qboolean  greyonly,
uploadfmt_t  forceformat 
)

◆ screenshotJPEG()

qboolean screenshotJPEG ( char *  filename,
enum fs_relative  fsroot,
int  compression,
qbyte screendata,
qintptr_t  stride,
int  screenwidth,
int  screenheight,
enum uploadfmt  fmt,
unsigned int  writemeta 
)

◆ WriteBMPFile()

qboolean WriteBMPFile ( char *  filename,
enum fs_relative  fsroot,
qbyte in,
qintptr_t  instride,
int  width,
int  height,
uploadfmt_t  fmt 
)

◆ WritePCXfile()

qboolean WritePCXfile ( const char *  filename,
enum fs_relative  fsroot,
qbyte data,
int  width,
int  height,
int  rowbytes,
qbyte palette,
qboolean  upload 
)

◆ WriteTGA()

qboolean WriteTGA ( const char *  filename,
enum fs_relative  fsroot,
const qbyte *fte_restrict  rgb_buffer,
qintptr_t  bytestride,
int  width,
int  height,
enum uploadfmt  fmt 
)

Variable Documentation

◆ bit_depth

◆ CloseInputFile

int(* CloseInputFile) (ImfInputFile *in) ( ImfInputFile in)

◆ color_type

◆ compression_method

◆ error_fn

png_voidp png_error_ptr error_fn

◆ error_ptr

png_voidp error_ptr

◆ filler

png_uint_32 filler

◆ funcs

◆ gl_lerpimages

cvar_t gl_lerpimages
extern

◆ gl_picmip

cvar_t gl_picmip
extern

◆ gl_picmip2d

cvar_t gl_picmip2d
extern

◆ gl_picmip_other

cvar_t gl_picmip_other
extern

◆ gl_picmip_sprites

cvar_t gl_picmip_sprites
extern

◆ gl_picmip_world

cvar_t gl_picmip_world
extern

◆ handle

void* handle

◆ HeaderDataWindow

void(* HeaderDataWindow) (const ImfHeader *hdr, int *xMin, int *yMin, int *xMax, int *yMax) ( const ImfHeader hdr,
int xMin,
int yMin,
int xMax,
int yMax 
)

◆ height

◆ info_ptr

png_inforp info_ptr

◆ info_ptr_ptr

png_infopp info_ptr_ptr

◆ InputHeader

const ImfHeader *(* InputHeader) (const ImfInputFile *in) ( const ImfInputFile in)

◆ InputReadPixels

int(* InputReadPixels) (ImfInputFile *in, int scanLine1, int scanLine2) ( ImfInputFile in,
int  scanLine1,
int  scanLine2 
)

◆ InputSetFrameBuffer

int(* InputSetFrameBuffer) (ImfInputFile *in, ImfRgba *base, size_t xStride, size_t yStride) ( ImfInputFile in,
ImfRgba base,
size_t  xStride,
size_t  yStride 
)

◆ interlace_method

◆ io_ptr

png_voidp io_ptr

◆ module

void* module

◆ num_trans

png_inforp png_bytep int* num_trans

◆ OpenInputFile

ImfInputFile *(* OpenInputFile) (const char name[]) ( const char  name[])

◆ palette

static png_inforp png_const_colorp palette

◆ r_defaultimageextensions

char* r_defaultimageextensions

◆ r_dodgymiptex

cvar_t r_dodgymiptex = CVARD("r_dodgymiptex", "1", "When enabled, this will force regeneration of mipmaps, discarding mips1-4 like glquake did. This may eg solve fullbright issues with some maps, but may reduce distant detail levels.")

◆ r_dodgypcxfiles

cvar_t r_dodgypcxfiles = CVARD("r_dodgypcxfiles", "0", "When enabled, this will ignore the palette stored within pcx files, for compatibility with quake2.")

◆ r_dodgytgafiles

cvar_t r_dodgytgafiles = CVARD("r_dodgytgafiles", "0", "Many old glquake engines had a buggy tga loader that ignored bottom-up flags. Naturally people worked around this and the world was plagued with buggy images. Most engines have now fixed the bug, but you can reenable it if you have bugged tga files.")

◆ r_ignoremapprefixes

cvar_t r_ignoremapprefixes = CVARD("r_ignoremapprefixes", "0", "Ignores when textures were loaded from map-specific paths.\n0: textures/foo/tex.tga will not be confused with textures/foo/tex.tga.\n1: The same texture might be loaded multiple times over.")

◆ r_image_downloadsizelimit

cvar_t r_image_downloadsizelimit = CVARFD("r_image_downloadsizelimit", "131072", CVAR_NOTFROMSERVER, "The maximum allowed file size of images loaded from a web-based url. 0 disables completely, while empty imposes no limit.")

◆ r_imageextensions

cvar_t r_imageextensions = CVARCD("r_imageextensions", NULL, R_ImageExtensions_Callback, "The list of image file extensions which might exist on disk (note that this does not list all supported formats, only the extensions that should be searched for).")

◆ r_keepimages

cvar_t r_keepimages = CVARD("r_keepimages", "0", "Retain unused images in memory for slightly faster map loading.\n0: Redundant images will be purged after each map change.\n1: Images will be retained until vid_reload (potentially consuming a lot of ram).")

◆ r_shadow_bumpscale_basetexture

cvar_t r_shadow_bumpscale_basetexture
extern

◆ r_shadow_bumpscale_bumpmap

cvar_t r_shadow_bumpscale_bumpmap
extern

◆ r_shadow_heightscale_basetexture

cvar_t r_shadow_heightscale_basetexture
extern

◆ r_shadow_heightscale_bumpmap

cvar_t r_shadow_heightscale_bumpmap
extern

◆ rgb9e5tab

const float rgb9e5tab[32]
Initial value:
= {
1.0/(1<<24), 1.0/(1<<23), 1.0/(1<<22), 1.0/(1<<21), 1.0/(1<<20), 1.0/(1<<19), 1.0/(1<<18), 1.0/(1<<17),
1.0/(1<<16), 1.0/(1<<15), 1.0/(1<<14), 1.0/(1<<13), 1.0/(1<<12), 1.0/(1<<11), 1.0/(1<<10), 1.0/(1<<9),
1.0/(1<<8), 1.0/(1<<7), 1.0/(1<<6), 1.0/(1<<5), 1.0/(1<<4), 1.0/(1<<3), 1.0/(1<<2), 1.0/(1<<1),
1.0, 1.0*(1<<1), 1.0*(1<<2), 1.0*(1<<3), 1.0*(1<<4), 1.0*(1<<5), 1.0*(1<<6), 1.0*(1<<7),
}

◆ scanlines

JSAMPARRAY scanlines

◆ scr_sshot_compression

cvar_t scr_sshot_compression
extern

◆ start

png_size_t start

◆ text_ptr

png_infop png_const_textp text_ptr

◆ trans_alpha

png_inforp png_bytep* trans_alpha

◆ unknowns

png_inforp png_const_unknown_chunkp unknowns

◆ version

int version

◆ width