bytesPerColour added

This commit is contained in:
Cem
2026-06-22 19:12:09 +02:00
parent a8b491d04c
commit 6bb65eea7e
+10 -2
View File
@@ -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);