blog:x68_launcher_3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:x68_launcher_3 [2020/09/07 11:17] – [bmp.c / bmp.h] johnblog:x68_launcher_3 [2020/09/07 11:51] (current) john
Line 2: Line 2:
  
 ==== bmp.c / bmp.h ==== ==== bmp.c / bmp.h ====
 +
 +   * https://github.com/megatron-uk/x68klauncher/blob/master/src/bmp.c
 +   * https://github.com/megatron-uk/x68klauncher/blob/master/src/bmp.h
  
 The header includes these common files: The header includes these common files:
Line 116: Line 119:
    * Check BMP is correct pixel depth and size    * Check BMP is correct pixel depth and size
    * Read pixel data    * Read pixel data
 +
 +
 +<code "C">
 +FILE *f;
 +int status;
 +
 +f = fopen("bitmap.bmp", "rb");
 +if (f == NULL){
 +   return -1;
 +}
 +
 +bmp = (bmpdata_t *) malloc(sizeof(bmpdata_t));
 +bmp->pixels = NULL;
 +status = bmp_ReadImageHeader(f, bmp);
 +if (status != 0){
 +   fclose(f);
 +   return -1;
 +}
 +
 +if (bmp->width > 200){
 +  printf("Error, image is more than 200 pixels wide!\n");
 +} else (
 +  printf("Loading pixel data\n");
 +  status = bmp_ReadImageData(f, bmp);
 +)
 +
 +fclose(f);
 +</code>
 +
 +----
 +
 +[[blog:x68_launcher_2|<< Back (#2: Filesystem tools, data scraping)]] | [[blog:x68_launcher_4|(#4: Graphics hardware functions) Next >>]]
 +
 +
  • blog/x68_launcher_3.1599473857.txt.gz
  • Last modified: 2020/09/07 11:17
  • by john