summaryrefslogtreecommitdiff
path: root/src/win32/cdwdib.c
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-04 17:36:53 +0000
committerscuri <scuri>2010-06-04 17:36:53 +0000
commit1bad658bce4895bab21b2aab65c82544871fa551 (patch)
tree53bc33a2e2bf442faa0c716ec59a29b0ed89124b /src/win32/cdwdib.c
parentdd7a1955dbf538734dc54225eac5282e3ab35ff8 (diff)
*** empty log message ***
Diffstat (limited to 'src/win32/cdwdib.c')
-rw-r--r--src/win32/cdwdib.c38
1 files changed, 38 insertions, 0 deletions
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;