From 6bb65eea7e23c9dbd683cc71f37d2491fc9cb33d Mon Sep 17 00:00:00 2001 From: Cem Date: Mon, 22 Jun 2026 19:12:09 +0200 Subject: [PATCH] bytesPerColour added --- Implementierung/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Implementierung/main.c b/Implementierung/main.c index f09332b..b71bea2 100644 --- a/Implementierung/main.c +++ b/Implementierung/main.c @@ -190,7 +190,15 @@ int main(int argc, char** argv) } float complex complexA = (starting_point_real + starting_point_imaginary*I); - unsigned char tempArr[width*height*3]; + int bytesPerColour; + if (colored) + { + bytesPerColour = 3; + } else { + bytesPerColour = 1; + } + + unsigned char tempArr[width*height*bytesPerColour]; // if not colored, rem printf("yashar\n"); tricorn(complexA,width,height,resolution,n,colored,tempArr); printf("yashar\n"); @@ -226,7 +234,7 @@ void save_bmp(const char *filename, unsigned char *img, size_t width, ssize_t he 54, 0, 0, 0 // 4 bytes that specify the offset where the image array begins }; - // Serialize the size into 4 bytes - (unsigned char) takes only bottom 4 bytes + // Serialize the size into 4 bytes - (unsigned char) takes only bottom 4 bytes 1 2 3 4 file_header[2] = (unsigned char)(file_size); file_header[3] = (unsigned char)(file_size >> 8); file_header[4] = (unsigned char)(file_size >> 16);