summaryrefslogtreecommitdiff
path: root/tests/make_bitmap/bitmap.h
blob: f2e309bd51d550c44d19bfbb4c6fbde277a26103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <stdio.h>
#include <ft2build.h>
#include "murmur3.h"            // MurmurHash3_x64_128 header file

#include FT_FREETYPE_H
#include FT_MODULE_H
#include FT_LCD_FILTER_H
#include FT_BITMAP_H

#define BITS_PER_PIXEL_MONO 1   // Constants for the Bitmap Header
#define BITS_PER_PIXEL_GRAY 8
#define BITS_PER_PIXEL_LCD 24

#define PLANES 1                // Constants for the Bitmap Header
#define COMPRESSION 0
#define X_PIXELS_PER_METER 0
#define Y_PIXELS_PER_METER 0
#define USED_COLORS 0
#define IMPORTANT_COLORS 0
//-------------------------------------------------------------------------------
#pragma pack(push,1)

typedef struct{                 // Bitmap FILE Header

    FT_UInt16 type;
    FT_UInt32 file_size;
    FT_UInt32 reserved;
    FT_UInt32 file_offset;

} BMP_FILE_HEADER;

typedef struct{                 // Bitmap INFO Header

    FT_UInt32 info_header_size;
    FT_UInt32 width;
    FT_Int    height;
    FT_UInt16 planes;
    FT_UInt16 bits_per_pixel;
    FT_UInt32 compression;
    FT_UInt32 image_size;
    FT_UInt32 y_pixels_per_meter;
    FT_UInt32 x_pixels_per_meter;
    FT_UInt32 used_colors;
    FT_UInt32 important_colors;

} BMP_INFO_HEADER;

typedef struct {                 // Bitmap Header  

    BMP_FILE_HEADER file_header;   
    BMP_INFO_HEADER info_header;

} HEADER;

//------------------------------------------------------------------------------
typedef struct {                // To store 32bit Hash
    FT_UInt32 hash[1];
}HASH_32;

typedef struct {                // To store 128bit Hash
    FT_UInt32 hash[4];
}HASH_128;

#pragma pack(pop)

//-------------------------------------------------------------------------------

HASH_32 * Generate_Hash_x86_32(FT_Bitmap * bitmap, HASH_32 * murmur);
HASH_128 * Generate_Hash_x86_128(FT_Bitmap * bitmap, HASH_128 * murmur);
HASH_128 * Generate_Hash_x64_128(FT_Bitmap * bitmap, HASH_128 * murmur);

//-------------------------------------------------------------------------------

int Get_Padding                     (FT_Bitmap * bitmap);          

int Get_Bits_Per_Pixel              ( unsigned char PIXEL_MODE );

void Write_Bitmap_Header            (FT_Bitmap * bitmap );

void Write_Bitmap_Data_MONO         (FT_Bitmap * bitmap);
void Write_Bitmap_Data_GRAY         (FT_Bitmap * bitmap);
void Write_Bitmap_Data_LCD_BGR      (FT_Bitmap * bitmap);
void Write_Bitmap_Data_LCD_RGB      (FT_Bitmap * bitmap);
void Write_Bitmap_Data_LCD_V_RGB    (FT_Bitmap * bitmap);
void Write_Bitmap_Data_LCD_V_BGR    (FT_Bitmap * bitmap);