-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.h
77 lines (65 loc) · 1.86 KB
/
image.h
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
#ifndef _HEADER_
#define _HEADER_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define HEADER_LENGTH 54
#define COLOR_TABLE_LENGTH 1024
#define MIN_COLOR 0
#define MAX_COLOR 255
#define BRIGHTNESS_FACTOR 25
#define FILTER_WIDTH 5
#define FILTER_HEIGHT 5
#define MAX(a, b) (a) > (b) ? (a) : (b)
#define MIN(a, b) (a) < (b) ? (a) : (b)
typedef struct {
unsigned char header[HEADER_LENGTH];
unsigned char colorTable[COLOR_TABLE_LENGTH];
int width, height, bitDepth, size, offset, gap1Length, gap2Length;
unsigned char *data, *gap1, *gap2;
} Image;
/* helper functions */
void error(int);
Image *loadImage(char[]);
void exportImage(Image *, char[]);
/* image functions - old version */
void copy_old(FILE *, FILE *);
void negative_old(FILE *, FILE *);
void bright_old(FILE *, FILE *);
void black_white_old(FILE *, FILE *);
void blur_old(FILE *, FILE *);
void rgb2sepia_old(FILE *, FILE *);
void rgb2gray_old(FILE *, FILE *);
void resize_old(FILE *, FILE *);
void rotateRight_old(FILE *, FILE *);
void rotate180_old(FILE *, FILE *);
void rotateLeft_old(FILE *, FILE *);
void blurRGB_old(FILE *, FILE *);
/* image functions */
Image* copy(Image *, int);
Image* negative(Image *);
Image* bright(Image *);
Image* black_white(Image *);
Image* blur(Image *);
Image* sepia(Image *);
Image* gray(Image *);
Image* rotate180(Image *);
Image* rotateLeft(Image *);
Image* rotateRight(Image *);
Image* resize(Image *, int, int);
/* image arithmetic */
Image* add(Image *, Image *);
Image* sub(Image *, Image *);
Image* diff(Image *, Image *);
Image* mul(Image *, Image *);
Image* average(Image *, Image *);
Image* cross_fade(Image *, Image *, double);
Image* minimum(Image *, Image *);
Image* maximum(Image *, Image *);
Image* amplitude(Image *, Image *);
Image* and(Image *, Image *);
Image* or(Image *, Image *);
Image* xor(Image *, Image *);
#endif