3 The online interface for the differential tool
6 Copyright (C) 2022 Balthasar SzczepaĆski
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 Requires cgilib (http://www.infodrom.org/projects/cgilib/)
34 #include "online-core.h"
45 char *inpix0, char *inpix1, char *outpix,
46 uint_fast8_t ra, uint_fast8_t ga, uint_fast8_t ba,
47 uint_fast8_t rb, uint_fast8_t gb, uint_fast8_t bb
50 int main (int argc, char *argv[])
59 uint_fast8_t ra, ga, ba, rb, gb, bb;
68 make_tmp_path(in0_tmp, 256, 0, "");
69 make_tmp_path(in1_tmp, 256, 1, "");
70 make_tmp_path(out_tmp, 256, 2, ".png");
74 r = get_file(cgi,"inpixf0", in0_tmp, &in0_path);
76 r = get_file(cgi,"inpix0", in0_tmp, &in0_path);
80 r = get_file(cgi,"inpixf1", in1_tmp, &in1_path);
82 r = get_file(cgi,"inpix1", in1_tmp, &in1_path);
86 t = cgiGetValue(cgi, "ra");
88 sscanf(t,"%"SCNuFAST8, &ra);
92 t = cgiGetValue(cgi, "ga");
94 sscanf(t,"%"SCNuFAST8, &ga);
98 t = cgiGetValue(cgi, "ba");
100 sscanf(t,"%"SCNuFAST8, &ba);
104 t = cgiGetValue(cgi, "rb");
106 sscanf(t,"%"SCNuFAST8, &rb);
110 t = cgiGetValue(cgi, "gb");
112 sscanf(t,"%"SCNuFAST8, &gb);
116 t = cgiGetValue(cgi, "bb");
118 sscanf(t,"%"SCNuFAST8, &bb);
122 r = diff(in0_path, in1_path, out_tmp, ra, ga, ba, rb, gb, bb);
126 r1 = send_file(out_tmp, "image/png", 0);
130 r1 = send_data(df, df_size, "image/png", 500);
147 char *inpix0, char *inpix1, char *outpix,
148 uint_fast8_t ra, uint_fast8_t ga, uint_fast8_t ba,
149 uint_fast8_t rb, uint_fast8_t gb, uint_fast8_t bb
162 snprintf(s_ra, 4, "%"PRIuFAST8, ra);
163 snprintf(s_ga, 4, "%"PRIuFAST8, ga);
164 snprintf(s_ba, 4, "%"PRIuFAST8, ba);
165 snprintf(s_rb, 4, "%"PRIuFAST8, rb);
166 snprintf(s_gb, 4, "%"PRIuFAST8, gb);
167 snprintf(s_bb, 4, "%"PRIuFAST8, bb);
173 DIFF_PATH, DIFF_PATH,
174 inpix0, inpix1, outpix,