fileiopp

File IO ++ or fileiopp serves as a utility that interprets files in ways that I deem useful
Log | Files | Refs | README | LICENSE

bmpfileiopp.h (1630B)


      1 /*
      2   Bitmap File IO ++ header file
      3   bmpfileiopp.h
      4   M. Yamanaka
      5   email: myamanaka@live.com
      6   website: http://www.csmyamanaka.com
      7   license: MIT (See included "LICENSE" file for details)
      8 */
      9 
     10 #pragma once
     11 
     12 #include "varbyterw.h"
     13 #include <stdio.h>
     14 #include <stdlib.h>
     15 
     16 /*
     17   Bitmap Information Struct
     18   This struct contains information that is required to interpret bitmap files assuming no compression.
     19   The attributes from left to right are:
     20     h   ... height
     21     w   ... width
     22     c   ... number of channels (e.g. 1 for grayscale, 3 for RGB)
     23     fn  ... file name
     24 */
     25 typedef struct BMPIS{int h, w, c; const char* fn;} BMPIS;
     26 
     27 /*
     28   The functions below were written using wikipedia as a reference for the bitmap file structure:
     29   <https://en.wikipedia.org/wiki/BMP_file_format>
     30   Please see the implementation file "bmpfileiopp.c" for more details
     31 */
     32 
     33 /*
     34   Read Bitmap
     35   The details such as width, height, number of channels and the image data are extracted
     36   and stored into objects referenced by the arguments to this function.
     37   The arguments from left to right are:
     38     BMPIS*  ... Bitmap information struct pointer
     39     char**    ... the address of a char (effectively byte) array will accept the image data of the bitmap
     40 */
     41 int readBMP(BMPIS*, char**);
     42 
     43 /*
     44   Write Bitmap
     45   A bitmap file is created using details provided by the objects referenced by the arguments to this function.
     46   The arguments from left to right are:
     47     BMPIS*  ... Bitmap information struct pointer with all components (h, w, c, fn) defined
     48     char**    ... the image data that will be written onto the bitmap file
     49 */
     50 int writeBMP(BMPIS, char*);
     51 
     52 

Generated using stagit (https://codemadness.org/stagit.html)