aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-08-10 19:04:15 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-08-10 19:04:15 +0300
commitd9604e398bacb02e6000825243b875e5cfc007e4 (patch)
tree4afba74929bc410fd245b09e1af1a68cf49981fd /src/main.c
parent5625d69c29e03816822b68e994a248c59fd0831e (diff)
works with colors
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 6 insertions, 4 deletions
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);
}
}