]> icculus.org git repositories - divverent/darkplaces.git/blob - image.h
cubemap filters for rtlights are now supported
[divverent/darkplaces.git] / image.h
1
2 #ifndef IMAGE_H
3 #define IMAGE_H
4
5 // swizzle components (even converting number of components) and flip images
6 // (warning: input must be different than output due to non-linear read/write)
7 void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int width, int height, int flipx, int flipy, int flipdiagonal, int numincomponents, int numoutcomponents, int *inputcomponentindices);
8
9 // applies gamma correction to RGB pixels, in can be the same as out
10 void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *gammar, const qbyte *gammag, const qbyte *gammab);
11
12 // converts 8bit image data to RGBA, in can not be the same as out
13 void Image_Copy8bitRGBA(const qbyte *in, qbyte *out, int pixels, const unsigned int *pal);
14
15 // makes a RGBA mask from RGBA input, in can be the same as out
16 int image_makemask (const qbyte *in, qbyte *out, int size);
17
18 // loads a texture, as pixel data
19 qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight);
20
21 // loads a texture, as a texture
22 rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
23
24 // loads a texture's alpha mask, as pixel data
25 qbyte *loadimagepixelsmask (const char *filename, qboolean complain, int matchwidth, int matchheight);
26
27 // loads a texture's alpha mask, as a texture
28 rtexture_t *loadtextureimagemask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
29
30 // loads a texture and it's alpha mask at once (NULL if it has no translucent pixels)
31 rtexture_t *image_masktex;
32 rtexture_t *image_nmaptex;
33 rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
34 rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
35 rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
36
37 // writes a RGB TGA that is already upside down (which TGA wants)
38 qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data);
39
40 // writes a RGB TGA
41 void Image_WriteTGARGB (const char *filename, int width, int height, const qbyte *data);
42
43 // writes a RGBA TGA
44 void Image_WriteTGARGBA (const char *filename, int width, int height, const qbyte *data);
45
46 // returns true if the image has some translucent pixels
47 qboolean Image_CheckAlpha(const qbyte *data, int size, qboolean rgba);
48
49 // resizes the image (in can not be the same as out)
50 void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int bytesperpixel, int quality);
51
52 // scales the image down by a power of 2 (in can be the same as out)
53 void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel);
54
55 // only used by menuplyr coloring
56 qbyte *LoadLMPAs8Bit (qbyte *f, int matchwidth, int matchheight);
57
58 void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale);
59
60 typedef struct imageskin_s
61 {
62         qbyte *basepixels;int basepixels_width;int basepixels_height;
63         qbyte *nmappixels;int nmappixels_width;int nmappixels_height;
64         qbyte *glowpixels;int glowpixels_width;int glowpixels_height;
65         qbyte *glosspixels;int glosspixels_width;int glosspixels_height;
66         qbyte *pantspixels;int pantspixels_width;int pantspixels_height;
67         qbyte *shirtpixels;int shirtpixels_width;int shirtpixels_height;
68         qbyte *maskpixels;int maskpixels_width;int maskpixels_height;
69 }
70 imageskin_t;
71
72 int image_loadskin(imageskin_t *s, char *name);
73 void image_freeskin(imageskin_t *s);
74
75 #endif
76