freetype/tests/bitmap.h

91 lines
2.6 KiB
C
Raw Normal View History

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