summaryrefslogtreecommitdiff
path: root/src/graphics/Graphics.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-07-16 18:48:50 (GMT)
committer jacob1 <jfu614@gmail.com>2013-07-16 18:48:50 (GMT)
commit19e182ae425bb08d8d267c2e5d49fcddb4965c77 (patch)
tree47df4b5bdca3c67cc7076efbe1a3b2d2aaf53454 /src/graphics/Graphics.cpp
parent6f29926b962538a63f9548a3331b7a52b617b46f (diff)
downloadpowder-19e182ae425bb08d8d267c2e5d49fcddb4965c77.zip
powder-19e182ae425bb08d8d267c2e5d49fcddb4965c77.tar.gz
add back rgba images in the local/server save uploads
Diffstat (limited to 'src/graphics/Graphics.cpp')
-rw-r--r--src/graphics/Graphics.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index cc18f25..d4e2956 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -1116,6 +1116,27 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve
}
}
+void Graphics::draw_rgba_image(unsigned char *data, int x, int y, float alpha)
+{
+ unsigned char w, h;
+ int i, j;
+ unsigned char r, g, b, a;
+ if (!data) return;
+ w = *(data++)&0xFF;
+ h = *(data++)&0xFF;
+ for (j=0; j<h; j++)
+ {
+ for (i=0; i<w; i++)
+ {
+ r = *(data++)&0xFF;
+ g = *(data++)&0xFF;
+ b = *(data++)&0xFF;
+ a = *(data++)&0xFF;
+ addpixel(x+i, y+j, r, g, b, (int)(a*alpha));
+ }
+ }
+}
+
pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_size)
{
unsigned char *tmp;