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);