P3206 Reshetov Semen Pavlovich
8 unresolved threads
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
8 uint8_t row_padding = (4 - (width * sizeof(struct pixel)) % 4) % 4; 9 return row_padding; 10 } 11 12 uint64_t get_row_width(uint64_t width) 13 { 14 uint64_t row_width = sizeof(struct pixel) * width + get_row_padding(width); // compute row_width with paddings 15 return row_width; 16 } 17 18 struct bmp_header create_bmp_header(uint64_t image_width, uint64_t image_height) 19 { 20 uint64_t imageSize = (image_width * sizeof(struct pixel) + get_row_padding(image_width)) * image_height; 21 printf("filesize - %ld\n", sizeof(struct bmp_header) + imageSize); 22 return (struct bmp_header){ 23 .bfType = 0x4d42, // 0x4d42 | 0x4349 | 0x5450 35 .biYPelsPerMeter = 2834, // vertical resolution 36 .biClrUsed = 0, // color table 37 .biClrImportant = 0}; // important color table, usually 0 38 } 39 40 enum read_status from_bmp(FILE *in, struct image *img) 41 { 42 struct bmp_header bmp_header_obj = {0}; 43 uint64_t res = fread(&bmp_header_obj, 1, sizeof(bmp_header_obj), in); 44 45 // check header is valid 46 if (res != sizeof(bmp_header_obj)) 47 return READ_INVALID_HEADER; 48 49 // check signature is valid 50 if (bmp_header_obj.bfType != 0x4D42 && - Resolved by Semen Reshetov
- Resolved by Semen Reshetov
- Resolved by Semen Reshetov
17 { 18 rotated_image_data[jindex * image_height + image_height - index - 1] = source->data[index * image_width + jindex]; 19 } 20 } 21 22 free(source->data); 23 source->data = rotated_image_data; 24 source->width = image_height; 25 source->height = image_width; 26 } 27 28 void rotate(struct image *source, const int32_t rotation_angle) 29 { 30 int count = ((360 - rotation_angle) % 360) / 90; 31 32 while (count) - Resolved by Semen Reshetov
- Resolved by Semen Reshetov
added 1 commit
- f55638bb - fix: add free if errored while interacting with file
added 1 commit
- e3673f2b - fix: add constant markers to main parameters
added 1 commit
- 5c7628f0 - fix: add enum 'unable_to_allocate_memory_while_(reading/writing)'
added 1 commit
- 0cbd79dc - refactor: delete unused function & change interface rotate.h - remove rotate_90