Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blog:x68_launcher_3 [2020/09/07 11:15] – [bmp.c / bmp.h] john | blog:x68_launcher_3 [2020/09/07 11:51] (current) – john | ||
---|---|---|---|
Line 2: | Line 2: | ||
==== bmp.c / bmp.h ==== | ==== bmp.c / bmp.h ==== | ||
+ | |||
+ | * https:// | ||
+ | * https:// | ||
The header includes these common files: | The header includes these common files: | ||
Line 108: | Line 111: | ||
</ | </ | ||
- | The bitmap library has a single function, __bmp_ReadImage()__, | + | The bitmap library has a single function, __bmp_ReadImage()__, |
+ | |||
+ | The reason the function is called in two passes is to ensure that when the header data is retrieved the image does not exceeded any specific size: | ||
+ | |||
+ | * Open file | ||
+ | * Read BMP header | ||
+ | * Check BMP is correct pixel depth and size | ||
+ | * Read pixel data | ||
+ | |||
+ | |||
+ | <code " | ||
+ | FILE *f; | ||
+ | int status; | ||
+ | |||
+ | f = fopen(" | ||
+ | if (f == NULL){ | ||
+ | | ||
+ | } | ||
+ | |||
+ | bmp = (bmpdata_t *) malloc(sizeof(bmpdata_t)); | ||
+ | bmp-> | ||
+ | status = bmp_ReadImageHeader(f, | ||
+ | if (status != 0){ | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (bmp-> | ||
+ | printf(" | ||
+ | } else ( | ||
+ | printf(" | ||
+ | status = bmp_ReadImageData(f, | ||
+ | ) | ||
+ | |||
+ | fclose(f); | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | [[blog: | ||
+ |