From d9604e398bacb02e6000825243b875e5cfc007e4 Mon Sep 17 00:00:00 2001 From: kartofen Date: Wed, 10 Aug 2022 19:04:15 +0300 Subject: works with colors --- src/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 353efe1..8461707 100644 --- a/src/main.c +++ b/src/main.c @@ -12,8 +12,8 @@ size_t TILES; size_t TILE_WIDTH; size_t TILE_HEIGHT; -size_t SWIDTH = 10; -size_t SHEIGHT = 10; +size_t SWIDTH = 30; +size_t SHEIGHT = 30; int get_least_entropy_index() { @@ -112,7 +112,7 @@ int main(void) size_t img_wdt = TILE_WIDTH * SWIDTH; size_t img_hgt = TILE_HEIGHT * SHEIGHT; - small_t *image = malloc(img_wdt * img_hgt * sizeof(small_t)); + small_t *image = malloc(img_wdt * img_hgt * 3); memset(image, 0, img_wdt * img_hgt); for(size_t i = 0; i < SHEIGHT; i++) @@ -124,7 +124,9 @@ int main(void) for(size_t y = 0; y < TILE_HEIGHT; y++) for(size_t x = 0; x < TILE_WIDTH; x++) - image[(y+(i*TILE_HEIGHT)) * img_wdt + (x+(j*TILE_WIDTH))] = get_tile_pixel(t, x, y); + for(int k = 0; k < 3; k++) + image[((y+(i*TILE_HEIGHT))*img_wdt+(x+(j*TILE_WIDTH)))*3 + k] = + get_tile_pixel(t, x, y, k); } } -- cgit v1.2.3