From 57b73d286ad68a71547cdfbb31c772fb46c96c67 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Wed, 29 Jul 2020 00:46:16 +0200 Subject: rebuilding functions --- src/bitmap.h | 66 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 29 deletions(-) (limited to 'src/bitmap.h') diff --git a/src/bitmap.h b/src/bitmap.h index d222ffb..3b942a7 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -1,9 +1,16 @@ +/* + * src/bitmap.h + * (c) 2020 Jonas Gunz + * License: MIT +*/ + #ifndef _BITMAP_H_ #define _BITMAP_H_ #include #include #include +#include #define _HEADER_SIZE 54 //Fileheader + infoheader #define IDENTIFIER 0x424d //BM BitMap identifier @@ -26,45 +33,46 @@ #define G(x) (0x00ff00 & x) >> 8 #define B(x) (0x0000ff & x) +#define BITMAP_MONOCHROME 0x01 + struct bitmap_file_header { - uint8_t error; - - uint16_t bfType; - uint32_t bfSize; - uint32_t bfOffBits; - - uint32_t biSize; - int32_t biWidth; - int32_t biHeight; - uint16_t biBitCount; - uint32_t biCompression; - uint32_t biSizeImage; - uint32_t biClrUsed; - uint32_t biClrImportant; - - unsigned char *tables; - uint32_t tablesc; + uint8_t error; + + uint16_t bfType; + uint32_t bfSize; + uint32_t bfOffBits; + + uint32_t biSize; + int32_t biWidth; + int32_t biHeight; + uint16_t biBitCount; + uint32_t biCompression; + uint32_t biSizeImage; + uint32_t biClrUsed; + uint32_t biClrImportant; + + unsigned char *tables; + uint32_t tablesc; }; -struct bitmap_pixel_data +struct bitmap_image { - unsigned int x,y; - uint8_t **R; - uint8_t **G; - uint8_t **B; + unsigned int x,y; - uint8_t error; -}; + uint8_t **R; + uint8_t **G; + uint8_t **B; + uint8_t tags; +}; -uint32_t bitmap_flip_byte(unsigned char* _v, int _c); - -struct bitmap_pixel_data bitmap_read(char *_file); +int bitmap_read ( char *_file, struct bitmap_image *_bitmap ); -struct bitmap_file_header bitmap_read_file_header(FILE *_file); +int bitmap_copy ( struct bitmap_image *_input, struct bitmap_image *_output ); -struct bitmap_pixel_data bitmap_read_pixel_data(FILE *_file, struct bitmap_file_header _header); +int bitmap_convert_monochrome ( struct bitmap_image *_input, struct bitmap_image *_output ); +int bitmap_transform ( struct bitmap_image *_input, struct bitmap_image *_output ); #endif /* end of include guard: _BITMAP_H_ */ -- cgit v1.2.3