-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagnify.cpp
More file actions
50 lines (38 loc) · 918 Bytes
/
magnify.cpp
File metadata and controls
50 lines (38 loc) · 918 Bytes
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
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "includes/FilterCommon.h"
extern "C"
{
static unsigned char* ScaledImage = NULL;
const int FilterID = 0x5D0F;
const char* FilterName = "Magnify";
const char* FilterDescription = "nX Pixel duplication";
bool ComparisonThreshold = false;
int FilterScaleX = 2;
int FilterScaleY = 2;
#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 scale = *((int*)(argv[3]));
scale = scale < 1 ? 1 : scale;
FilterScaleX = scale;
FilterScaleY = scale;
Init(srcx, srcy);
for (auto y = 0; y < srcy; y++)
{
for (auto x = 0; x < srcx; x++)
{
WriteMagnify(Input, ScaledImage, srcx, srcy, x, y);
}
}
}
}
}