blob: 280dfb2c2cadf4e190b460c6b67f4d98bab1b6b1 (
plain) (
blame)
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
78
79
80
81
82
83
84
|
#include "puzzle_common.h"
#include "puzzle_p.h"
#include "puzzle.h"
#include "globals.h"
int puzzle_set_max_width(PuzzleContext * const context,
const unsigned int width)
{
if (width <= 0U) {
return -1;
}
context->puzzle_max_width = width;
return 0;
}
int puzzle_set_max_height(PuzzleContext * const context,
const unsigned int height)
{
if (height <= 0U) {
return -1;
}
context->puzzle_max_height = height;
return 0;
}
int puzzle_set_lambdas(PuzzleContext * const context,
const unsigned int lambdas)
{
if (lambdas <= 0U) {
return -1;
}
context->puzzle_lambdas = lambdas;
return 0;
}
int puzzle_set_p_ratio(PuzzleContext * const context, const double p_ratio)
{
if (p_ratio < 1.0) {
return -1;
}
context->puzzle_p_ratio = p_ratio;
return 0;
}
int puzzle_set_noise_cutoff(PuzzleContext * const context,
const double noise_cutoff)
{
context->puzzle_noise_cutoff = noise_cutoff;
return 0;
}
int puzzle_set_contrast_barrier_for_cropping(PuzzleContext * const context,
const double barrier)
{
if (barrier <= 0.0) {
return -1;
}
context->puzzle_contrast_barrier_for_cropping = barrier;
return 0;
}
int puzzle_set_max_cropping_ratio(PuzzleContext * const context,
const double ratio)
{
if (ratio <= 0.0) {
return -1;
}
context->puzzle_max_cropping_ratio = ratio;
return 0;
}
int puzzle_set_autocrop(PuzzleContext * const context, const int enable)
{
context->puzzle_enable_autocrop = (enable != 0);
return 0;
}
|