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:29] – [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 124: Line 127:
 f = fopen("bitmap.bmp", "rb"); f = fopen("bitmap.bmp", "rb");
 if (f == NULL){ if (f == NULL){
- return -1; +   return -1;
 } }
  
 bmp = (bmpdata_t *) malloc(sizeof(bmpdata_t)); bmp = (bmpdata_t *) malloc(sizeof(bmpdata_t));
 bmp->pixels = NULL; bmp->pixels = NULL;
-status = bmp_ReadImage(f, bmp, 1, 0);+status = bmp_ReadImageHeader(f, bmp);
 if (status != 0){ if (status != 0){
- fclose(f); +   fclose(f); 
- return -1;+   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); fclose(f);
 </code> </code>
 +
 +----
 +
 +[[blog:x68_launcher_2|<< Back (#2: Filesystem tools, data scraping)]] | [[blog:x68_launcher_4|(#4: Graphics hardware functions) Next >>]]
 +
 +
  • blog/x68_launcher_3.1599474594.txt.gz
  • Last modified: 2020/09/07 11:29
  • by john