summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-16 21:09:54 +0000
committerscuri <scuri>2010-06-16 21:09:54 +0000
commit483f59d3a55720c8c140aef863f4d34a0d90cca8 (patch)
tree914494291b1870c2b50e7c252c156c91133e9a62 /src/sim
parent72857b1207600b10bd73e9b1fee479438aae3ac9 (diff)
*** empty log message ***
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/sim_primitives.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/sim/sim_primitives.c b/src/sim/sim_primitives.c
index 4b3ebf3..29fc6af 100644
--- a/src/sim/sim_primitives.c
+++ b/src/sim/sim_primitives.c
@@ -1316,6 +1316,29 @@ void cdSimPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char
free(fy);
}
+void cdSimPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
+{
+ int height = ymax-ymin+1;
+ unsigned char* map;
+ int pal_size = 1L << canvas->bpp;
+ long colors[256];
+ (void)ih;
+
+ map = (unsigned char*)malloc(iw * height);
+ if (!map)
+ return;
+
+ if (pal_size == 2) /* probably a laser printer, use a gray image for better results */
+ cdRGB2Gray(iw, height, r+ymin*iw, g+ymin*iw, b+ymin*iw, map, colors);
+ else
+ cdRGB2Map(iw, height, r+ymin*iw, g+ymin*iw, b+ymin*iw, map, pal_size, colors);
+
+ canvas->cxPutImageRectMap(canvas->ctxcanvas, iw, height, map, colors, x, y, w, h, xmin, xmax, 0, height-1);
+
+ free(map);
+}
+
+
/************************************************************************/
#include "cd_truetype.h"