aboutsummaryrefslogtreecommitdiff
path: root/pixelsort.h
blob: 4e6dcd028c2b4fef6ff9e61ca41193aaf133ea72 (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
#ifndef PXLSORT_H
#define PXLSORT_H

#include <FreeImage.h>
#include <stdbool.h>

#define BPP 3
#define ANGLE_HORI 0
#define ANGLE_VERT 90

typedef struct context {
    // Image variables
    unsigned width;
    unsigned height;

    unsigned angle;

    // Threshold variables
    int upper;
    int lower;
    char *dirs;

    // Functions
    bool (*check_color)(struct context *ctx, BYTE *line);
    BYTE *(*index_color)(struct context *ctx, BYTE *line, unsigned index);
} context_t;

// Interval functions
bool checkThreshold(struct context *ctx, BYTE *color);

// Nextcolor functions
BYTE *indexcolor_horizontal(struct context *ctx, BYTE *line, unsigned index);
BYTE *indexcolor_vertical(struct context *ctx, BYTE *line, unsigned index);

int pixelsort(context_t *ctx, FIBITMAP *img);

#endif