Al-Qurtas-Islamic-bank-The-.../tests/bitmap.h

91 lines
2.6 KiB
C
Raw Normal View History

2017-06-28 07:30:44 +02:00
#include <stdio.h>
2017-06-28 22:29:00 +02:00
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
2017-08-26 00:45:33 +02:00
#include <string.h>
2017-06-28 22:29:00 +02:00
#include <sys/types.h>
#include <sys/stat.h>
2017-06-28 07:30:44 +02:00
#include <ft2build.h>
2017-06-28 22:29:00 +02:00
2017-08-01 08:59:43 +02:00
#include "murmur3.h" /* MurmurHash3_x64_128 header file */
2017-06-28 22:29:00 +02:00
#include <png.h>
#include <dlfcn.h>
2017-07-14 14:32:40 +02:00
#include <math.h>
2017-06-28 07:30:44 +02:00
#include FT_FREETYPE_H
#include FT_MODULE_H
#include FT_LCD_FILTER_H
#include FT_BITMAP_H
#define BITS_PER_PIXEL_RGBA 32
2017-07-14 14:32:40 +02:00
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
2017-06-28 07:30:44 +02:00
2017-08-01 08:59:43 +02:00
typedef struct { /* To store 32bit Hash */
2017-07-17 19:23:10 +02:00
FT_UInt32 hash;
2017-06-28 07:30:44 +02:00
}HASH_32;
2017-08-01 08:59:43 +02:00
typedef struct { /* To store 128bit Hash */
2017-07-17 19:23:10 +02:00
FT_UInt32 hash[4];
2017-06-28 07:30:44 +02:00
}HASH_128;
2017-08-09 08:55:00 +02:00
/* A 32-bit pixel */
2017-06-28 22:29:00 +02:00
typedef struct {
2017-06-28 23:16:31 +02:00
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
2017-06-28 22:29:00 +02:00
} PIXEL;
2017-08-09 08:55:00 +02:00
/* A picture. */
2017-06-28 22:29:00 +02:00
typedef struct {
2017-08-01 08:59:43 +02:00
PIXEL* pixels;
2017-06-28 23:16:31 +02:00
size_t width;
size_t height;
2017-06-28 22:29:00 +02:00
} IMAGE;
2017-08-09 08:55:00 +02:00
/* Render modes */
enum render_modes
{ MONO, AA, RGB, BGR, VRGB, VBGR };
2017-08-01 08:59:43 +02:00
/*-----------------------------------------------------------------*/
2017-06-28 07:30:44 +02:00
2017-08-01 08:59:43 +02:00
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);
2017-06-28 07:30:44 +02:00
2017-07-17 19:23:10 +02:00
int Compare_Hash(HASH_128* hash_b, HASH_128* hash_t);
2017-08-01 08:59:43 +02:00
/*-----------------------------------------------------------------*/
2017-08-26 12:55:05 +02:00
/* Returns the render_mode */
int Get_Render_Mode(const char* mode);
2017-08-01 08:59:43 +02:00
/* Returns a pointer to pixel */
/* at (x,y) co-ordinate */
PIXEL* Pixel_At (IMAGE * bitmap, int x, int y);
2017-08-09 08:55:00 +02:00
/*Render mode string to render_mode code */
void Make_PNG (FT_Bitmap* bitmap,IMAGE* fruit, int i,int render_mode);
2017-08-01 08:59:43 +02:00
/* Image to file */
int Generate_PNG (IMAGE *bitmap, const char *path,int render_mode);
2017-08-01 08:59:43 +02:00
/* Read PNG */
2017-07-11 20:15:50 +02:00
void Read_PNG(char *filename, IMAGE * after_effect);
2017-08-07 21:22:24 +02:00
/* Add effects using two PNG images and generate an image*/
int Add_effect(IMAGE* base, IMAGE* test, IMAGE* out, int Effect_ID);
2017-08-01 08:59:43 +02:00
/* Stitch 2 PNG files */
void Stitch(IMAGE* left, IMAGE* right, IMAGE* result);
2017-08-01 08:59:43 +02:00
/* Finding the first non-empty (non-white) column */
int First_Column(IMAGE* input);
2017-08-01 08:59:43 +02:00
/* Finding the first non-empty (non-white) row */
int First_Row(IMAGE* input);
2017-08-01 08:59:43 +02:00
/* Appening white columns with image alignment */
IMAGE* Append_Columns(IMAGE* small, IMAGE* big);
2017-08-01 08:59:43 +02:00
/* Appening white columns with image alignment */
IMAGE* Append_Rows(IMAGE* small, IMAGE* big);
/* calculating the Pixel Differences */
int Image_Diff( IMAGE* base, IMAGE* test);
2017-08-07 21:22:24 +02:00
/* Print the row in list-view webpage */
void Print_Row( FILE* fp, int index, char* name, int diff );
/* Print the table-headers in list-view webpage */
2017-08-26 12:55:05 +02:00
void Print_Head( FILE* fp );