-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflip.cpp
61 lines (42 loc) · 1.07 KB
/
flip.cpp
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
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "includes/FilterCommon.h"
#include "includes/Flip.h"
extern "C"
{
static unsigned char* ScaledImage = NULL;
const int FilterID = 0x5D21;
const char* FilterName = "Flip (Horizontal, Vertical)";
const char* FilterDescription = "Flip image horizontally or vertically without scaling";
bool ComparisonThreshold = false;
const int FilterScaleX = 1;
const int FilterScaleY = 1;
#include "includes/Init.h"
void Apply(int argc, void** argv)
{
if (argc >= 4)
{
auto Input = ((unsigned char*)(argv[0]));
auto srcx = *((int*)(argv[1]));
auto srcy = *((int*)(argv[2]));
auto flip = *((int*)(argv[3]));
flip = flip < 0 ? 0 : flip;
flip = flip > 1 ? 1 : flip;
Init(srcx, srcy);
auto Channels = 3;
Copy(ScaledImage, Input, srcx * srcy * Channels);
switch(flip)
{
case 1:
FlipUD(ScaledImage, srcx, srcy);
break;
default:
FlipLR(ScaledImage, srcx, srcy);
break;
}
}
}
}