summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Graphics.cpp21
-rw-r--r--src/graphics/Graphics.h1
2 files changed, 22 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;
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h
index 2cbdd87..580f2c0 100644
--- a/src/graphics/Graphics.h
+++ b/src/graphics/Graphics.h
@@ -247,6 +247,7 @@ public:
void draw_image(pixel *img, int x, int y, int w, int h, int a);
void draw_image(const VideoBuffer & vidBuf, int w, int h, int a);
void draw_image(VideoBuffer * vidBuf, int w, int h, int a);
+ void draw_rgba_image(unsigned char *data, int x, int y, float alpha);
Graphics();
~Graphics();