From 1bad658bce4895bab21b2aab65c82544871fa551 Mon Sep 17 00:00:00 2001 From: scuri Date: Fri, 4 Jun 2010 17:36:53 +0000 Subject: *** empty log message *** --- src/win32/cdwdib.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/win32/cdwdib.c') diff --git a/src/win32/cdwdib.c b/src/win32/cdwdib.c index aff3f64..25851cd 100644 --- a/src/win32/cdwdib.c +++ b/src/win32/cdwdib.c @@ -323,6 +323,44 @@ void cdwDIBEncodeRGBARect(cdwDIB* dib, const unsigned char *red, const unsigned } } +void cdwDIBEncodeRGBARectMirror(cdwDIB* dib, const unsigned char *red, const unsigned char *green, const unsigned char *blue, const unsigned char *alpha, int xi, int yi, int wi, int hi) +{ + int x,y, resto1, resto2, offset, line_size; + BYTE* bits; + + line_size = cdwDIBLineSize(dib->w, 32); + + bits = dib->bits + line_size*(dib->h-1); + resto1 = line_size - dib->w * 4; + resto2 = wi - dib->w; + + offset = wi * yi + xi; + + red = red + offset; + green = green + offset; + blue = blue + offset; + alpha = alpha + offset; + + for (y = 0; y < dib->h; y++) + { + for (x = 0; x < dib->w; x++) + { + *bits++ = CD_ALPHAPRE(*blue, *alpha); blue++; + *bits++ = CD_ALPHAPRE(*green, *alpha); green++; + *bits++ = CD_ALPHAPRE(*red, *alpha); red++; + *bits++ = *alpha++; + } + + bits += resto1; + bits -= 2*line_size; + + red += resto2; + green += resto2; + blue += resto2; + alpha += resto2; + } +} + void cdwDIBEncodeAlphaRect(cdwDIB* dib, const unsigned char *alpha, int xi, int yi, int wi, int hi) { int x,y, resto1, resto2, offset; -- cgit v1.2.3