]> icculus.org git repositories - divverent/darkplaces.git/blob - image.h
updated darkplaces.dev from m0rfar
[divverent/darkplaces.git] / image.h
1
2 #ifndef IMAGE_H
3 #define IMAGE_H
4
5
6 extern int image_width, image_height;
7
8
9 // swizzle components (even converting number of components) and flip images
10 // (warning: input must be different than output due to non-linear read/write)
11 // (tip: component indices can contain values | 0x80000000 to tell it to
12 // store them directly into output, so 255 | 0x80000000 would write 255)
13 void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices);
14
15 // applies gamma correction to RGB pixels, in can be the same as out
16 void Image_GammaRemapRGB(const unsigned char *in, unsigned char *out, int pixels, const unsigned char *gammar, const unsigned char *gammag, const unsigned char *gammab);
17
18 // converts 8bit image data to RGBA, in can not be the same as out
19 void Image_Copy8bitRGBA(const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal);
20
21 void Image_StripImageExtension (const char *in, char *out, size_t size_out);
22
23 unsigned char *LoadTGA (const unsigned char *f, int filesize, int matchwidth, int matchheight);
24
25 // loads a texture, as pixel data
26 unsigned char *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight);
27
28 // loads a texture, as a texture
29 rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
30
31 // writes a RGB TGA that is already upside down (which TGA wants)
32 qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const unsigned char *data, unsigned char *buffer);
33
34 // writes a RGBA TGA
35 void Image_WriteTGARGBA (const char *filename, int width, int height, const unsigned char *data);
36
37 // resizes the image (in can not be the same as out)
38 void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int bytesperpixel, int quality);
39
40 // scales the image down by a power of 2 (in can be the same as out)
41 void Image_MipReduce(const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel);
42
43 // only used by menuplyr coloring
44 unsigned char *LoadLMP (const unsigned char *f, int filesize, int matchwidth, int matchheight, qboolean loadAs8Bit);
45
46 void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale);
47
48 #endif
49