X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=image.c;h=192cb568d9eded768e0ab86197fb6be4b9959d57;hb=b009bbfa2e115145d2b36da89cc58196d6c11bca;hp=27fc794148762ed70fa2e4beeac839f3c76c0833;hpb=6abc2eef23f8062c5cbd880a681eb611b0b858a7;p=xonotic%2Fdarkplaces.git diff --git a/image.c b/image.c index 27fc7941..192cb568 100644 --- a/image.c +++ b/image.c @@ -7,6 +7,44 @@ int image_width; int image_height; +void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int width, int height, int flipx, int flipy, int flipdiagonal, int numincomponents, int numoutcomponents, int *inputcomponentindices) +{ + int index, c, x, y; + const qbyte *in, *inrow, *incolumn; + if (flipdiagonal) + { + for (y = 0;y < height;y++) + { + incolumn = inpixels + (flipx ? width - 1 - y : y) * numincomponents; + for (x = 0;x < width;x++) + { + in = incolumn + (flipy ? height - 1 - x : x) * width * numincomponents; + for (c = 0;c < numoutcomponents;c++) + { + index = inputcomponentindices[c]; + *outpixels++ = (index & 0x80000000) ? (index - 0x8000000) : in[index]; + } + } + } + } + else + { + for (y = 0;y < height;y++) + { + inrow = inpixels + (flipy ? height - 1 - y : y) * width * numincomponents; + for (x = 0;x < width;x++) + { + in = inrow + (flipx ? width - 1 - x : x) * numincomponents; + for (c = 0;c < numoutcomponents;c++) + { + index = inputcomponentindices[c]; + *outpixels++ = (index & 0x80000000) ? (index - 0x8000000) : in[index]; + } + } + } + } +} + void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *gammar, const qbyte *gammag, const qbyte *gammab) { while (pixels--)