![]() |
DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
|
|
#include "quakedef.h"#include "image.h"#include "jpeg.h"#include "image_png.h"#include "r_shadow.h"#include "wad.h"#include "lhfont.h"Go to the source code of this file.
Data Structures | |
| struct | embeddedpic_t |
| struct | imageformat_t |
| struct | pcx_t |
| struct | q2wal_t |
| struct | TargaHeader |
Macros | |
| #define | FIXTRANS_PIXEL (y*w+x) |
| #define | FIXTRANS_PIXEL_D (((y+1)%h)*w+x) |
| #define | FIXTRANS_PIXEL_L (y*w+((x+w-1)%w)) |
| #define | FIXTRANS_PIXEL_R (y*w+((x+1)%w)) |
| #define | FIXTRANS_PIXEL_U (((y+h-1)%h)*w+x) |
| #define | LERPBYTE(i) |
Functions | |
| int | fixtransparentpixels (unsigned char *data, int w, int h) |
| void | Image_Copy8bitBGRA (const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal) |
| static void | Image_CopyAlphaFromBlueBGRA (unsigned char *outpixels, const unsigned char *inpixels, int w, int h) |
| void | Image_CopyMux (unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices) |
| void | Image_FixTransparentPixels_f (cmd_state_t *cmd) |
| void | Image_GammaRemapRGB (const unsigned char *in, unsigned char *out, int pixels, const unsigned char *gammar, const unsigned char *gammag, const unsigned char *gammab) |
| static unsigned char * | Image_GenerateConChars (void) |
| static unsigned char * | Image_GenerateDitherPattern (void) |
| unsigned char * | Image_GenerateNoTexture (void) |
| static unsigned char * | Image_GenerateWhite (void) |
| static unsigned char * | Image_GetEmbeddedPicBGRA (const char *name) |
| qbool | Image_GetStockPicSize (const char *filename, int *returnwidth, int *returnheight) |
| void | Image_HeightmapToNormalmap_BGRA (const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale) |
| void | Image_MakeLinearColorsFromsRGB (unsigned char *pout, const unsigned char *pin, int numpixels) |
| void | Image_MakesRGBColorsFromLinear_Lightmap (unsigned char *pout, const unsigned char *pin, int numpixels) |
| void | Image_MipReduce32 (const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth) |
| void | Image_Resample32 (const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int quality) |
| static void | Image_Resample32Lerp (const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight) |
| static void | Image_Resample32LerpLine (const unsigned char *in, unsigned char *out, int inwidth, int outwidth) |
| static void | Image_Resample32Nolerp (const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight) |
| void | Image_StripImageExtension (const char *in, char *out, size_t size_out) |
| qbool | Image_WriteTGABGR_preflipped (const char *filename, int width, int height, const unsigned char *data) |
| qbool | Image_WriteTGABGRA (const char *filename, int width, int height, const unsigned char *data) |
| static unsigned char * | LoadConChars_BGRA (const unsigned char *f, int filesize, int *miplevel) |
| unsigned char * | loadimagepixelsbgra (const char *filename, qbool complain, qbool allowFixtrans, qbool convertsRGB, int *miplevel) |
| static unsigned char * | LoadLMP_BGRA (const unsigned char *f, int filesize, int *miplevel) |
| static unsigned char * | LoadPCX_BGRA (const unsigned char *f, int filesize, int *miplevel) |
| qbool | LoadPCX_PaletteOnly (const unsigned char *f, int filesize, unsigned char *palette768b) |
| qbool | LoadPCX_QWSkin (const unsigned char *f, int filesize, unsigned char *pixels, int outwidth, int outheight) |
| rtexture_t * | loadtextureimage (rtexturepool_t *pool, const char *filename, qbool complain, int flags, qbool allowFixtrans, qbool sRGB) |
| unsigned char * | LoadTGA_BGRA (const unsigned char *f, int filesize, int *miplevel) |
| static unsigned char * | LoadWAL_BGRA (const unsigned char *f, int filesize, int *miplevel) |
| qbool | LoadWAL_GetMetadata (const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c) |
| static void | PrintTargaHeader (TargaHeader *t) |
Variables | |
| static const embeddedpic_t | embeddedpics [] |
| cvar_t | gl_picmip |
| int | image_height |
| static unsigned char | image_linearfromsrgb [256] |
| static unsigned char | image_srgbfromlinear_lightmap [256] |
| int | image_width |
| imageformat_t | imageformats_dq [] |
| imageformat_t | imageformats_gfx [] |
| imageformat_t | imageformats_other [] |
| imageformat_t | imageformats_tenebrae [] |
| imageformat_t | imageformats_textures [] |
Referenced by fixtransparentpixels().
Referenced by fixtransparentpixels().
Referenced by fixtransparentpixels().
Referenced by fixtransparentpixels().
| #define LERPBYTE | ( | i | ) |
Definition at line 1246 of file image.c.
References a, b, data, FIXTRANS_PIXEL, FIXTRANS_PIXEL_D, FIXTRANS_PIXEL_L, FIXTRANS_PIXEL_R, FIXTRANS_PIXEL_U, g, Mem_Alloc, r, tempmempool, w, x, and y.
Referenced by Image_FixTransparentPixels_f(), and loadimagepixelsbgra().
| void Image_Copy8bitBGRA | ( | const unsigned char * | in, |
| unsigned char * | out, | ||
| int | pixels, | ||
| const unsigned int * | pal ) |
Definition at line 129 of file image.c.
References pixels.
Referenced by LoadWAL_BGRA(), Mod_Sprite_SharedSetup(), R_SkinFrame_GenerateTexturesFromQPixels(), and R_UploadFullTexture().
| void Image_CopyMux | ( | unsigned char * | outpixels, |
| const unsigned char * | inpixels, | ||
| int | inputwidth, | ||
| int | inputheight, | ||
| qbool | inputflipx, | ||
| qbool | inputflipy, | ||
| qbool | inputflipdiagonal, | ||
| int | numoutputcomponents, | ||
| int | numinputcomponents, | ||
| int * | outputinputcomponentindices ) |
Definition at line 24 of file image.c.
Referenced by Image_Compress(), R_LoadCubemap(), R_LoadSkyBox(), R_SetupTexture(), and SCR_ScreenShot().
| void Image_FixTransparentPixels_f | ( | cmd_state_t * | cmd | ) |
Definition at line 1365 of file image.c.
References buf, cmd(), Cmd_Argc(), Cmd_Argv(), Con_Printf(), data, dpsnprintf(), fssearch_t::filenames, fixtransparentpixels(), FS_FreeSearch(), FS_Search(), image_height, Image_StripImageExtension(), image_width, Image_WriteTGABGRA(), loadimagepixelsbgra(), MAX_QPATH, Mem_Free, n, NULL, and fssearch_t::numfilenames.
Referenced by CL_InitCommands().
|
static |
Definition at line 1802 of file image.c.
References concharimage, data, image_height, image_width, Image_WriteTGABGRA(), lhrandom, LoadTGA_BGRA(), NULL, and random().
Referenced by Image_GetEmbeddedPicBGRA().
|
static |
Definition at line 1856 of file image.c.
References data, image_height, image_width, Mem_Alloc, tempmempool, x, and y.
Referenced by Image_GetEmbeddedPicBGRA().
| unsigned char * Image_GenerateNoTexture | ( | void | ) |
Definition at line 1876 of file image.c.
References data, image_height, image_width, Mem_Alloc, tempmempool, x, and y.
Referenced by R_BuildNoTexture(), R_SkinFrame_LoadExternal_SkinFrame(), and R_SkinFrame_LoadNoTexture().
|
static |
Definition at line 1896 of file image.c.
References data, image_height, image_width, Mem_Alloc, and tempmempool.
Referenced by Image_GetEmbeddedPicBGRA().
|
static |
Definition at line 2068 of file image.c.
References data, embeddedpics, embeddedpic_t::height, Image_GenerateConChars(), Image_GenerateDitherPattern(), Image_GenerateWhite(), image_height, image_width, Mem_Alloc, embeddedpic_t::name, name, NULL, palette_bgra_embeddedpic, embeddedpic_t::pixels, tempmempool, Vector4Copy, and embeddedpic_t::width.
Referenced by loadimagepixelsbgra().
Definition at line 1185 of file image.c.
References data, dpsnprintf(), FS_LoadFile(), MAX_QPATH, Mem_Free, tempmempool, w, and W_GetLumpName().
Referenced by Draw_CachePic_Flags().
| void Image_HeightmapToNormalmap_BGRA | ( | const unsigned char * | inpixels, |
| unsigned char * | outpixels, | ||
| int | width, | ||
| int | height, | ||
| int | clamp, | ||
| float | bumpscale ) |
Definition at line 1758 of file image.c.
References b, height, int(), n, VectorNormalize, width, x, x1, x2, y, and y2.
Referenced by R_SkinFrame_GenerateTexturesFromQPixels(), R_SkinFrame_LoadExternal_SkinFrame(), and R_SkinFrame_LoadInternalBGRA().
| void Image_MakeLinearColorsFromsRGB | ( | unsigned char * | pout, |
| const unsigned char * | pin, | ||
| int | numpixels ) |
Definition at line 930 of file image.c.
References floor(), Image_LinearFloatFromsRGB, and image_linearfromsrgb.
Referenced by loadimagepixelsbgra(), R_LoadTextureDDSFile(), and R_SetupTexture().
| void Image_MakesRGBColorsFromLinear_Lightmap | ( | unsigned char * | pout, |
| const unsigned char * | pin, | ||
| int | numpixels ) |
Definition at line 946 of file image.c.
References bound, floor(), Image_sRGBFloatFromLinear_Lightmap, and image_srgbfromlinear_lightmap.
Referenced by Mod_Q3BSP_LoadLightmaps(), and R_BuildLightMap().
| void Image_MipReduce32 | ( | const unsigned char * | in, |
| unsigned char * | out, | ||
| int * | width, | ||
| int * | height, | ||
| int * | depth, | ||
| int | destwidth, | ||
| int | destheight, | ||
| int | destdepth ) |
Definition at line 1678 of file image.c.
References Con_Printf(), depth, height, width, x, and y.
Referenced by Image_Compress(), and R_UploadFullTexture().
| void Image_Resample32 | ( | const void * | indata, |
| int | inwidth, | ||
| int | inheight, | ||
| int | indepth, | ||
| void * | outdata, | ||
| int | outwidth, | ||
| int | outheight, | ||
| int | outdepth, | ||
| int | quality ) |
Definition at line 1664 of file image.c.
References Con_Printf(), Image_Resample32Lerp(), and Image_Resample32Nolerp().
Referenced by R_UploadFullTexture().
|
static |
Definition at line 1518 of file image.c.
References f, Image_Resample32LerpLine(), int(), LERPBYTE, Mem_Alloc, Mem_Free, NULL, r, and tempmempool.
Referenced by Image_Resample32().
|
static |
Definition at line 1486 of file image.c.
Referenced by Image_Resample32Lerp().
|
static |
Definition at line 1622 of file image.c.
Referenced by Image_Resample32().
| void Image_StripImageExtension | ( | const char * | in, |
| char * | out, | ||
| size_t | size_out ) |
Definition at line 913 of file image.c.
References dp_strlcpy, FS_FileExtension(), and FS_StripExtension().
Referenced by Image_FixTransparentPixels_f(), loadimagepixelsbgra(), Mod_BuildAliasSkinsFromSkinFiles(), R_SkinFrame_Find(), R_SkinFrame_FindNextByName(), and R_SkinFrame_LoadExternal_SkinFrame().
| qbool Image_WriteTGABGR_preflipped | ( | const char * | filename, |
| int | width, | ||
| int | height, | ||
| const unsigned char * | data ) |
Definition at line 1401 of file image.c.
References buffer, buffers, data, FS_WriteFileInBlocks(), height, ret, and width.
Referenced by SCR_ScreenShot().
| qbool Image_WriteTGABGRA | ( | const char * | filename, |
| int | width, | ||
| int | height, | ||
| const unsigned char * | data ) |
Definition at line 1425 of file image.c.
References buffer, data, FS_WriteFile(), height, Mem_Alloc, Mem_Free, ret, tempmempool, width, and y.
Referenced by Image_FixTransparentPixels_f(), Image_GenerateConChars(), loadimagepixelsbgra(), R_InitParticleTexture(), R_Shadow_DrawModelShadowMaps(), and SCR_ScreenShot().
Definition at line 881 of file image.c.
References Con_Print(), Con_Printf(), f, image_height, image_width, Mem_Alloc, NULL, palette_bgra_font, and tempmempool.
Referenced by loadimagepixelsbgra().
| unsigned char * loadimagepixelsbgra | ( | const char * | filename, |
| qbool | complain, | ||
| qbool | allowFixtrans, | ||
| qbool | convertsRGB, | ||
| int * | miplevel ) |
Definition at line 1034 of file image.c.
References buf, CL_KeepaliveMessage(), Con_DPrintf(), CON_ERROR, Con_Printf(), data, developer_loading, developer_texturelogging, dp_strlcpy, dpsnprintf(), f, fixtransparentpixels(), format, FS_FileExists(), FS_LoadFile(), FS_SanitizePath(), GAME_DELUXEQUAKE, GAME_TENEBRAE, gamemode, Image_CopyAlphaFromBlueBGRA(), Image_GetEmbeddedPicBGRA(), image_height, Image_MakeLinearColorsFromsRGB(), Image_StripImageExtension(), image_width, Image_WriteTGABGRA(), imageformats_dq, imageformats_gfx, imageformats_other, imageformats_tenebrae, imageformats_textures, int(), JPEG_LoadImage_BGRA(), LoadConChars_BGRA(), LoadLMP_BGRA(), Log_Printf(), MAX_QPATH, Mem_Free, n, name, NULL, r_fixtrans_auto, tempmempool, va(), and W_GetLumpName().
Referenced by Image_Compress(), Image_FixTransparentPixels_f(), loadtextureimage(), Mod_Q1BSP_LoadTextures(), Mod_Q3BSP_LoadLightmaps(), R_BuildFogHeightTexture(), R_LoadCubemap(), R_LoadSkyBox(), and R_SkinFrame_LoadExternal_SkinFrame().
Definition at line 841 of file image.c.
References Con_Print(), Con_Printf(), f, image_height, image_width, Mem_Alloc, NULL, palette_bgra_transparent, and tempmempool.
Referenced by loadimagepixelsbgra().
Definition at line 195 of file image.c.
References a, b, pcx_t::bits_per_pixel, pcx_t::bytes_per_line, Con_Print(), Con_Printf(), pcx_t::encoding, f, pcx_t::hres, image_height, image_width, LittleShort, pcx_t::manufacturer, Mem_Alloc, NULL, pcx_t::palette_type, tempmempool, pcx_t::version, pcx_t::vres, x, x2, pcx_t::xmax, pcx_t::xmin, y, pcx_t::ymax, and pcx_t::ymin.
Definition at line 365 of file image.c.
References f.
Referenced by Palette_LoadQ2Colormap().
| qbool LoadPCX_QWSkin | ( | const unsigned char * | f, |
| int | filesize, | ||
| unsigned char * | pixels, | ||
| int | outwidth, | ||
| int | outheight ) |
Definition at line 286 of file image.c.
References a, pcx_t::bits_per_pixel, pcx_t::bytes_per_line, pcx_t::encoding, f, pcx_t::hres, image_height, image_width, LittleShort, pcx_t::manufacturer, pcx_t::palette_type, pixels, pcx_t::version, pcx_t::vres, x, x2, pcx_t::xmax, pcx_t::xmin, y, pcx_t::ymax, and pcx_t::ymin.
Referenced by R_LoadQWSkin().
| rtexture_t * loadtextureimage | ( | rtexturepool_t * | pool, |
| const char * | filename, | ||
| qbool | complain, | ||
| int | flags, | ||
| qbool | allowFixtrans, | ||
| qbool | sRGB ) |
Definition at line 1234 of file image.c.
References data, flags, image_height, image_width, loadimagepixelsbgra(), Mem_Free, NULL, R_LoadTexture2D(), R_PicmipForFlags(), TEXTYPE_BGRA, and TEXTYPE_SRGB_BGRA.
Referenced by R_InitParticleTexture().
Definition at line 401 of file image.c.
References TargaHeader::attributes, b, TargaHeader::colormap_index, TargaHeader::colormap_length, TargaHeader::colormap_size, TargaHeader::colormap_type, Con_Print(), Con_Printf(), f, TargaHeader::height, TargaHeader::id_length, image_height, TargaHeader::image_type, image_width, Mem_Alloc, NULL, TargaHeader::pixel_size, PrintTargaHeader(), tempmempool, TargaHeader::width, x, TargaHeader::x_origin, y, and TargaHeader::y_origin.
Referenced by Image_GenerateConChars().
Definition at line 765 of file image.c.
References Con_Print(), Con_Printf(), f, q2wal_t::height, Image_Copy8bitBGRA(), image_height, image_width, LittleLong, Mem_Alloc, NULL, q2wal_t::offsets, q2palette_bgra_complete, tempmempool, and q2wal_t::width.
| qbool LoadWAL_GetMetadata | ( | const unsigned char * | f, |
| int | filesize, | ||
| int * | retwidth, | ||
| int * | retheight, | ||
| int * | retflags, | ||
| int * | retvalue, | ||
| int * | retcontents, | ||
| char * | retanimname32c ) |
Definition at line 800 of file image.c.
References q2wal_t::animname, Con_Print(), q2wal_t::contents, f, q2wal_t::flags, q2wal_t::height, LittleLong, q2wal_t::value, and q2wal_t::width.
Referenced by Mod_Q2BSP_LoadTexinfo().
|
static |
Definition at line 391 of file image.c.
References TargaHeader::attributes, TargaHeader::colormap_index, TargaHeader::colormap_length, TargaHeader::colormap_size, TargaHeader::colormap_type, Con_Printf(), TargaHeader::height, TargaHeader::id_length, TargaHeader::image_type, TargaHeader::pixel_size, TargaHeader::width, TargaHeader::x_origin, and TargaHeader::y_origin.
Referenced by LoadTGA_BGRA().
|
static |
Definition at line 1914 of file image.c.
Referenced by Image_GetEmbeddedPicBGRA().
|
extern |
Definition at line 29 of file gl_textures.c.
| int image_height |
Definition at line 10 of file image.c.
Referenced by Curl_EndDownload(), Image_Compress(), Image_FixTransparentPixels_f(), Image_GenerateConChars(), Image_GenerateDitherPattern(), Image_GenerateNoTexture(), Image_GenerateWhite(), Image_GetEmbeddedPicBGRA(), JPEG_LoadImage_BGRA(), LoadConChars_BGRA(), loadimagepixelsbgra(), LoadLMP_BGRA(), LoadPCX_BGRA(), LoadPCX_QWSkin(), loadtextureimage(), LoadTGA_BGRA(), LoadWAL_BGRA(), Mod_Q1BSP_LoadTextures(), Mod_Q3BSP_LoadLightmaps(), PNG_LoadImage_BGRA(), R_InitParticleTexture(), R_LoadCubemap(), R_LoadQWSkin(), R_LoadSkyBox(), R_SkinFrame_LoadExternal_SkinFrame(), VM_CL_ReadPicture(), W_ConvertWAD3TextureBGRA(), and W_GetTextureBGRA().
|
static |
Definition at line 927 of file image.c.
Referenced by Image_MakeLinearColorsFromsRGB().
|
static |
Definition at line 928 of file image.c.
Referenced by Image_MakesRGBColorsFromLinear_Lightmap().
| int image_width |
Definition at line 9 of file image.c.
Referenced by Curl_EndDownload(), Image_Compress(), Image_FixTransparentPixels_f(), Image_GenerateConChars(), Image_GenerateDitherPattern(), Image_GenerateNoTexture(), Image_GenerateWhite(), Image_GetEmbeddedPicBGRA(), JPEG_LoadImage_BGRA(), LoadConChars_BGRA(), loadimagepixelsbgra(), LoadLMP_BGRA(), LoadPCX_BGRA(), LoadPCX_QWSkin(), loadtextureimage(), LoadTGA_BGRA(), LoadWAL_BGRA(), Mod_Q1BSP_LoadTextures(), Mod_Q3BSP_LoadLightmaps(), PNG_LoadImage_BGRA(), R_BuildFogHeightTexture(), R_InitParticleTexture(), R_LoadCubemap(), R_LoadQWSkin(), R_LoadSkyBox(), R_SkinFrame_LoadExternal_SkinFrame(), VM_CL_ReadPicture(), W_ConvertWAD3TextureBGRA(), and W_GetTextureBGRA().
| imageformat_t imageformats_dq[] |
Definition at line 988 of file image.c.
Referenced by loadimagepixelsbgra().
| imageformat_t imageformats_gfx[] |
Definition at line 1007 of file image.c.
Referenced by loadimagepixelsbgra().
| imageformat_t imageformats_other[] |
Definition at line 1017 of file image.c.
Referenced by loadimagepixelsbgra().
| imageformat_t imageformats_tenebrae[] |
Definition at line 970 of file image.c.
Referenced by loadimagepixelsbgra().
| imageformat_t imageformats_textures[] |
Definition at line 997 of file image.c.
Referenced by loadimagepixelsbgra().