From 483f59d3a55720c8c140aef863f4d34a0d90cca8 Mon Sep 17 00:00:00 2001 From: scuri Date: Wed, 16 Jun 2010 21:09:54 +0000 Subject: *** empty log message *** --- src/sim/sim_primitives.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/sim') 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" -- cgit v1.2.3