From 054a617a9375b835492368c3773315b09d3851ce Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 28 Jul 2010 23:03:16 +0200 Subject: Initial commit for mandelbrot. --- graymap_alleg.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 graymap_alleg.c (limited to 'graymap_alleg.c') diff --git a/graymap_alleg.c b/graymap_alleg.c new file mode 100644 index 0000000..6380436 --- /dev/null +++ b/graymap_alleg.c @@ -0,0 +1,33 @@ +#include "common_types.h" +#include "graymap_alleg.h" +#include "graymap.h" +#include +#include + +void render_graymap_alleg(BITMAP* canvas, graymap_t* gm, color_t* pal_cols, + double* pal_grays, int pal_n) +{ + int limit_w = gm->w; + int limit_h = gm->h; + if(limit_w > canvas->w) + limit_w = canvas->w; + if(limit_h > canvas->h) + limit_h = canvas->h; + + color_t col; + + int x,y,i; + uint_8 r,g,b,a; + for(y = 0, i = 0; y < limit_h; ++y) + { + for(x = 0; x < limit_w; ++x, ++i) + { + col = get_palette_color(gm->data[i], pal_cols, pal_grays, pal_n); + r = (uint_8) round(col.r * 255.0); + g = (uint_8) round(col.g * 255.0); + b = (uint_8) round(col.b * 255.0); + a = (uint_8) round(col.a * 255.0); + putpixel(canvas, x,y,makeacol(r,g,b,a)); + } + } +} -- cgit v1.2.3-54-g00ecf