-void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel);
-
-// only used by menuplyr coloring
-qbyte *LoadLMPAs8Bit (qbyte *f, int matchwidth, int matchheight);
-
-void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale);
-
-typedef struct imageskin_s
-{
- qbyte *basepixels;int basepixels_width;int basepixels_height;
- qbyte *nmappixels;int nmappixels_width;int nmappixels_height;
- qbyte *glowpixels;int glowpixels_width;int glowpixels_height;
- qbyte *glosspixels;int glosspixels_width;int glosspixels_height;
- qbyte *pantspixels;int pantspixels_width;int pantspixels_height;
- qbyte *shirtpixels;int shirtpixels_width;int shirtpixels_height;
- qbyte *maskpixels;int maskpixels_width;int maskpixels_height;
-}
-imageskin_t;
-
-int image_loadskin(imageskin_t *s, char *name);
-void image_freeskin(imageskin_t *s);
+void Image_MipReduce32(const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth);
+
+void Image_HeightmapToNormalmap_BGRA(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale);
+
+// console command to fix the colors of transparent pixels (to prevent weird borders)
+void Image_FixTransparentPixels_f(cmd_state_t *cmd);
+extern cvar_t r_fixtrans_auto;
+
+#define Image_LinearFloatFromsRGBFloat(c) (((c) <= 0.04045f) ? (c) * (1.0f / 12.92f) : (float)pow(((c) + 0.055f)*(1.0f/1.055f), 2.4f))
+#define Image_sRGBFloatFromLinearFloat(c) (((c) < 0.0031308f) ? (c) * 12.92f : 1.055f * (float)pow((c), 1.0f/2.4f) - 0.055f)
+#define Image_LinearFloatFromsRGB(c) Image_LinearFloatFromsRGBFloat((c) * (1.0f / 255.0f))
+#define Image_sRGBFloatFromLinear(c) Image_sRGBFloatFromLinearFloat((c) * (1.0f / 255.0f))
+#define Image_sRGBFloatFromLinear_Lightmap(c) Image_sRGBFloatFromLinearFloat((c) * (2.0f / 255.0f)) * 0.5f
+
+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);