| 1 | /*c0rners.c |
| 2 | four corners geometry engine |
| 3 | |
| 4 | |
| 5 | * Copyright (C) 2010 Marko Cebokli http://lea.hamradio.si/~s57uuu |
| 6 | * This file is a Frei0r plugin. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 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 General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 21 | */ |
| 22 | |
| 23 | //compile: gcc -Wall -std=c99 -c -fPIC c0rners.c -o c0rners.o |
| 24 | //link: gcc -shared -lm -o c0rners.so c0rners.o |
| 25 | |
| 26 | #include <stdlib.h> |
| 27 | #include <stdio.h> |
| 28 | #include <frei0r.h>cxx . . $ `<file>/include/frei0r.h`/ |
| 29 | #include <string.h> |
| 30 | #include <math.h> |
| 31 | #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/ |
| 32 | #include "interp.h"cxx . . $ `<file>/src/filter/c0rners/interp.h`/ |
| 33 | |
| 34 | //---------------------------------------- |
| 35 | //structure for Frei0r instance |
| 36 | typedef structcxx . . $ $anonymous_type_14dd04af2be9454a_0# |
| 37 | { |
| 38 | int hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.; |
| 39 | int wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.; |
| 40 | float x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.; |
| 41 | float y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.; |
| 42 | float x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.; |
| 43 | float y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.; |
| 44 | float x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.; |
| 45 | float y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.; |
| 46 | float x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.; |
| 47 | float y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.; |
| 48 | int stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON.; |
| 49 | float stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx.; |
| 50 | float stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy.; |
| 51 | int intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp.; |
| 52 | int transbcxx . . $ $anonymous_type_14dd04af2be9454a_0#transb.; |
| 53 | float feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath.; |
| 54 | int opcxx . . $ $anonymous_type_14dd04af2be9454a_0#op.; |
| 55 | |
| 56 | interppcxx . . $ interpp# interpcxx . . $ $anonymous_type_14dd04af2be9454a_0#interp.; |
| 57 | float *mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map.; |
| 58 | unsigned char *amapcxx . . $ $anonymous_type_14dd04af2be9454a_0#amap.; |
| 59 | int mapIsDirtycxx . . $ $anonymous_type_14dd04af2be9454a_0#mapIsDirty.; |
| 60 | } instcxx . . $ inst#; |
| 61 | |
| 62 | |
| 63 | //2D point |
| 64 | typedef structcxx . . $ $anonymous_type_14dd04af2be9454a_1# //tocka v ravnini |
| 65 | { |
| 66 | float xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; |
| 67 | float ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; |
| 68 | } tocka2cxx . . $ tocka2#; |
| 69 | |
| 70 | //2D line |
| 71 | typedef structcxx . . $ $anonymous_type_14dd04af2be9454a_2# //premica v ravnini |
| 72 | { |
| 73 | float acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.; |
| 74 | float bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.; |
| 75 | float ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.; |
| 76 | float sacxx . . $ $anonymous_type_14dd04af2be9454a_2#sa.; //se normalna oblika |
| 77 | float cacxx . . $ $anonymous_type_14dd04af2be9454a_2#ca.; |
| 78 | float pcxx . . $ $anonymous_type_14dd04af2be9454a_2#p.; |
| 79 | } premica2cxx . . $ premica2#; |
| 80 | |
| 81 | // line through two points in the plane (2D) |
| 82 | // calculate a, b, c for the equation of the line: ax + by + c = 0 |
| 83 | // ps se sin a, cos a and p for normal form |
| 84 | // return: (return value) |
| 85 | // - 10 if it is not possible to determine p. coincident points |
| 86 | // 0 general p. general case |
| 87 | // + 1 vertical p. x v * a vertical |
| 88 | // + 2 horizontal p. y v * b horizontal |
| 89 | // a line through two points |
| 90 | int premica2dcxx . . $ premica2d(de49498eb3140a4e).(tocka2cxx . . $ tocka2# t1, tocka2cxx . . $ tocka2# t2, premica2cxx . . $ premica2# *p) |
| 91 | { |
| 92 | float dx,dy,m; |
| 93 | |
| 94 | dx=t2.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-t1.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; |
| 95 | dy=t2.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-t1.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; |
| 96 | if (dx==0.0) //navpicna |
| 97 | { |
| 98 | if (dy==0.0) return -10; |
| 99 | p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.=1.0; |
| 100 | p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.=0.0; |
| 101 | p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.=-t1.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; |
| 102 | m=1.0/p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.; if (p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.>=0) m=-m; |
| 103 | p->sacxx . . $ $anonymous_type_14dd04af2be9454a_2#sa.=m; |
| 104 | p->cacxx . . $ $anonymous_type_14dd04af2be9454a_2#ca.=0.0; |
| 105 | p->pcxx . . $ $anonymous_type_14dd04af2be9454a_2#p.=m*p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.; |
| 106 | return 1; |
| 107 | } |
| 108 | |
| 109 | if (dy==0.0) //vodoravna |
| 110 | { |
| 111 | if (dx==0.0) return -10; |
| 112 | p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.=0.0; |
| 113 | p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.=1.0; |
| 114 | p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.=-t1.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; |
| 115 | m=1.0/p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.; if (p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.>=0) m=-m; |
| 116 | p->sacxx . . $ $anonymous_type_14dd04af2be9454a_2#sa.=0.0; |
| 117 | p->cacxx . . $ $anonymous_type_14dd04af2be9454a_2#ca.=m; |
| 118 | p->pcxx . . $ $anonymous_type_14dd04af2be9454a_2#p.=m*p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.; |
| 119 | return 2; |
| 120 | } |
| 121 | |
| 122 | //posevna |
| 123 | p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.=1.0/dx; |
| 124 | p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.=-1.0/dy; |
| 125 | p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.=t1.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y./dy-t1.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x./dx; |
| 126 | m=1.0/sqrtf(p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.*p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.+p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.*p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.); if (p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.>=0) m=-m; |
| 127 | p->sacxx . . $ $anonymous_type_14dd04af2be9454a_2#sa.=m*p->acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.; |
| 128 | p->cacxx . . $ $anonymous_type_14dd04af2be9454a_2#ca.=m*p->bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.; |
| 129 | p->pcxx . . $ $anonymous_type_14dd04af2be9454a_2#p.=m*p->ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.; |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | // ------------------------------------------------ ----- |
| 134 | // point distance from line (for alpha feather) |
| 135 | // distance between a point and a line |
| 136 | // needed only for alpha feathering |
| 137 | float razd_t_pcxx . . $ razd_t_p(1d271ff39dc38e7a).(tocka2cxx . . $ tocka2# t, premica2cxx . . $ premica2# p) |
| 138 | { |
| 139 | float r; |
| 140 | |
| 141 | r = t.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.*p.cacxx . . $ $anonymous_type_14dd04af2be9454a_2#ca. + t.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.*p.sacxx . . $ $anonymous_type_14dd04af2be9454a_2#sa. + p.pcxx . . $ $anonymous_type_14dd04af2be9454a_2#p.; |
| 142 | |
| 143 | return r; |
| 144 | } |
| 145 | |
| 146 | // ------------------------------------------------ ----- |
| 147 | // intersection of two lines in a plane (2D) |
| 148 | // return: |
| 149 | // 0 if everything is OK |
| 150 | // - 1 if the lines are parallel |
| 151 | // intersection of two lines |
| 152 | int presecisce2cxx . . $ presecisce2(1746810dfd927d03).(premica2cxx . . $ premica2# p1, premica2cxx . . $ premica2# p2, tocka2cxx . . $ tocka2# *t) |
| 153 | { |
| 154 | float d1,d2,d3; |
| 155 | |
| 156 | d1=p1.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.*p2.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.-p2.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.*p1.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.; |
| 157 | if (d1==0.0) //vzporedni |
| 158 | { |
| 159 | return -1; |
| 160 | } |
| 161 | d2=p1.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.*p2.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.-p2.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.*p1.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.; |
| 162 | d3=p1.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.*p2.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.-p2.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.*p1.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.; |
| 163 | t->xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=d2/d1; |
| 164 | t->ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=d3/d1; |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | // ------------------------------------------------ --------------- |
| 169 | // generate mapping for a general quadrangle |
| 170 | // wi, hi = input image size |
| 171 | // wo, ho = output image size |
| 172 | // vog [] = the four corners |
| 173 | // str: 0 = no stretch 1 = do stretch |
| 174 | // strx, stry: stretch values ​​[0 ... 1] 0.5 = no stretch |
| 175 | void cetverokotnik4cxx . . $ cetverokotnik4(2c03077b87888ad9).(int wi, int hi, int wo, int ho, tocka2cxx . . $ tocka2# vog[], int str, float strx, float stry, float *map) |
| 176 | { |
| 177 | double a,b,c,d,e,f,g,h,a2,b2,c2,u,v,aa,bb,de,sde,v1,v2,u1,u2; |
| 178 | tocka2cxx . . $ tocka2# T; |
| 179 | int x,y; |
| 180 | float kx,ky,k1,k2; |
| 181 | |
| 182 | de=0.0;v1=1000.0;v2=1000.0; //da compiler ne jamra |
| 183 | |
| 184 | kx=4.0*2.0*fabsl(strx-0.5)+0.00005; |
| 185 | k1=1.0-1.0/(kx+1.0); |
| 186 | ky=4.0*2.0*fabsl(stry-0.5)+0.00005; |
| 187 | k2=1.0-1.0/(ky+1.0); |
| 188 | |
| 189 | for (y=0;y<ho;y++) |
| 190 | { |
| 191 | for (x=0;x<wo;x++) |
| 192 | { |
| 193 | T.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(float)x+0.5;T.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(float)y+0.5; |
| 194 | |
| 195 | //enacba za Xt, prva moznost |
| 196 | a=vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-T.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; b=vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; |
| 197 | c=vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.; |
| 198 | d=vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-(vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.); |
| 199 | //enacba za Xt, druga moznost |
| 200 | // a=vog[0].x-T.x; b=vog[1].x-vog[0].x; |
| 201 | // c=vog[2].x-vog[0].x; |
| 202 | // d=vog[3].x-vog[2].x-(vog[1].x-vog[0].x); |
| 203 | |
| 204 | //enacba za Yt, prva moznost |
| 205 | e=vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-T.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; f=vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; |
| 206 | g=vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.; |
| 207 | h=vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-(vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.); |
| 208 | //enacba za Yt, druga moznost |
| 209 | // e=vog[0].y-T.y; f=vog[1].y-vog[0].y; |
| 210 | // g=vog[2].y-vog[0].y; |
| 211 | // h=vog[3].y-vog[2].y-(vog[1].y-vog[0].y); |
| 212 | |
| 213 | //resitev za v in u |
| 214 | a2=g*d-h*c; b2=e*d-f*c-h*a+g*b; c2=e*b-f*a; |
| 215 | //linearni priblizek uporabim, ce je napaka < 1/10 piksla |
| 216 | // if (fabsl(a2*c2*c2/(b2*b2*b2))< 0.1/wi) |
| 217 | //dodaten pogoj za a2, da ni spranje v konkavnih |
| 218 | if ((fabsl(a2*c2*c2/(b2*b2*b2))< 0.1/wi) && (fabsl(a2)<1.0)) |
| 219 | { |
| 220 | v1 = (b2!=0.0) ? -c2/b2 : 1000.0; |
| 221 | v2=1000.0; |
| 222 | } |
| 223 | else |
| 224 | { |
| 225 | de=b2*b2-4.0*a2*c2; |
| 226 | if (de>=0.0) |
| 227 | { |
| 228 | sde=sqrtcxx . . $ sqrt(447c67c6676f75c3).(de); |
| 229 | v1=(-b2+sde)/2.0/a2; |
| 230 | v2=(-b2-sde)/2.0/a2; |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | v1=1001.0; //krneki zunaj |
| 235 | v2=1001.0; //krneki zunaj |
| 236 | } |
| 237 | } |
| 238 | aa=b+d*v1; bb=f+h*v1; |
| 239 | if (fabscxx . . $ fabs(447c67c6676f75c3).(aa)>fabscxx . . $ fabs(447c67c6676f75c3).(bb)) |
| 240 | u1 = (aa!=0.0) ? -(a+c*v1)/aa : 1000.0; |
| 241 | else |
| 242 | u1 = (bb!=0.0) ? -(e+g*v1)/bb : 1000.0; |
| 243 | aa=b+d*v2; bb=f+h*v2; |
| 244 | if (fabscxx . . $ fabs(447c67c6676f75c3).(aa)>fabscxx . . $ fabs(447c67c6676f75c3).(bb)) |
| 245 | u2 = (aa!=0.0) ? -(a+c*v2)/aa : 1000.0; |
| 246 | else |
| 247 | u2 = (bb!=0.0) ? -(e+g*v2)/bb : 1000.0; |
| 248 | |
| 249 | if ((u1>0.0)&&(u1<1.0)&&(v1>0.0)&&(v1<1.0)) |
| 250 | { |
| 251 | u=u1; |
| 252 | v=v1; |
| 253 | } |
| 254 | else |
| 255 | { |
| 256 | if ((u2>0.0)&&(u2<1.0)&&(v2>0.0)&&(v2<1.0)) |
| 257 | { |
| 258 | u=u2; |
| 259 | v=v2; |
| 260 | } |
| 261 | else |
| 262 | { |
| 263 | u=1002.0; |
| 264 | v=1002.0; |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | //if requested, apply stretching |
| 269 | if (str!=0) |
| 270 | { |
| 271 | if (strx>0.5) |
| 272 | u=(1.0-1.0/(kx*u+1.0))/k1; |
| 273 | else |
| 274 | u=1.0-(1.0-1.0/(kx*(1.0-u)+1.0))/k1; |
| 275 | if (stry>0.5) |
| 276 | v=(1.0-1.0/(ky*v+1.0))/k2; |
| 277 | else |
| 278 | v=1.0-(1.0-1.0/(ky*(1.0-v)+1.0))/k2; |
| 279 | } |
| 280 | |
| 281 | //zdaj samo se vpise izracunana (u,v) v map[] |
| 282 | if ((u>=0.0)&&(u<=1.0)&&(v>=0.0)&&(v<=1.0)) |
| 283 | { //ce smo znotraj orig slike |
| 284 | map[2*(y*wo+x)]=u*(wi-1); |
| 285 | map[2*(y*wo+x)+1]=v*(hi-1); |
| 286 | } |
| 287 | else |
| 288 | { |
| 289 | map[2*(y*wo+x)]=-1; |
| 290 | map[2*(y*wo+x)+1]=-1; |
| 291 | } |
| 292 | |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | } |
| 297 | |
| 298 | //--------------------------------------------------------------- |
| 299 | //generate mapping for a triangle |
| 300 | void trikotnik1cxx . . $ trikotnik1(e5753fc0599e2978).(int wi, int hi, int wo, int ho, tocka2cxx . . $ tocka2# vog[], tocka2cxx . . $ tocka2# R, tocka2cxx . . $ tocka2# S, premica2cxx . . $ premica2# p12, premica2cxx . . $ premica2# p23, premica2cxx . . $ premica2# p34, premica2cxx . . $ premica2# p41, int t12, int t23, int str, float strx, float stry, float *map) |
| 301 | { |
| 302 | int x,y; |
| 303 | tocka2cxx . . $ tocka2# T,A,B; |
| 304 | premica2cxx . . $ premica2# p5,p6; |
| 305 | float u,v; |
| 306 | float kx,ky,k1,k2; |
| 307 | |
| 308 | kx=4.0*2.0*fabsl(strx-0.5)+0.00005; |
| 309 | k1=1.0-1.0/(kx+1.0); |
| 310 | ky=4.0*2.0*fabsl(stry-0.5)+0.00005; |
| 311 | k2=1.0-1.0/(ky+1.0); |
| 312 | |
| 313 | for (y=0;y<ho;y++) |
| 314 | { |
| 315 | for (x=0;x<wo;x++) |
| 316 | { |
| 317 | T.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(float)x+0.5;T.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(float)y+0.5; |
| 318 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(T,R,&p5); |
| 319 | presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p5,p12,&A); |
| 320 | if (t12!=-10) //razlicno od cetverokotnika |
| 321 | { //tocka je med preseciscem in r |
| 322 | if (fabsf(p12.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p12.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 323 | u=(A.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)/(vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.); |
| 324 | else |
| 325 | u=(A.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)/(vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.); |
| 326 | } |
| 327 | else |
| 328 | { |
| 329 | presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p5,p34,&A); |
| 330 | if (fabsf(p34.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p34.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 331 | u=(A.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)/(vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.); |
| 332 | else |
| 333 | u=(A.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)/(vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.); |
| 334 | } |
| 335 | |
| 336 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(T,S,&p6); |
| 337 | presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p6,p23,&B); |
| 338 | if (t23!=-10) //razlicno od cetverokotnika |
| 339 | { |
| 340 | if (fabsf(p23.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p23.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 341 | v=(B.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)/(vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.); |
| 342 | else |
| 343 | v=(B.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)/(vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.); |
| 344 | } |
| 345 | else |
| 346 | { |
| 347 | presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p6,p41,&B); |
| 348 | if (fabsf(p41.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p41.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 349 | v=(B.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)/(vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.); |
| 350 | else |
| 351 | v=(B.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)/(vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.); |
| 352 | } |
| 353 | |
| 354 | //if requested, apply stretching |
| 355 | if (str!=0) |
| 356 | { |
| 357 | if (strx>0.5) |
| 358 | u=(1.0-1.0/(kx*u+1.0))/k1; |
| 359 | else |
| 360 | u=1.0-(1.0-1.0/(kx*(1.0-u)+1.0))/k1; |
| 361 | if (stry>0.5) |
| 362 | v=(1.0-1.0/(ky*v+1.0))/k2; |
| 363 | else |
| 364 | v=1.0-(1.0-1.0/(ky*(1.0-v)+1.0))/k2; |
| 365 | } |
| 366 | |
| 367 | //zdaj samo se vpise izracunana (u,v) v map[] |
| 368 | if ((u>=0.0)&&(u<=1.0)&&(v>=0.0)&&(v<=1.0)) |
| 369 | { //ce smo znotraj orig slike |
| 370 | map[2*(y*wo+x)]=u*(wi-1); |
| 371 | map[2*(y*wo+x)+1]=v*(hi-1); |
| 372 | } |
| 373 | else |
| 374 | { |
| 375 | map[2*(y*wo+x)]=-1; |
| 376 | map[2*(y*wo+x)+1]=-1; |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | //------------------------------------------------------- |
| 383 | //generates a map of alpha values for transparent background |
| 384 | //with feathered (soft) border |
| 385 | //feath = soft border width 0..max in pixels |
| 386 | //amap = generated alpha map |
| 387 | //map = map generated by geom4c_b() |
| 388 | //nots[] = flags for inner sides |
| 389 | //for now it does not feather caustics on concaves an crossed sides |
| 390 | void make_alphamapcxx . . $ make_alphamap(1affc3f68917ec2f).(unsigned char *amap, tocka2cxx . . $ tocka2# vog[], int wo, int ho, float *map, float feath, int nots[]) |
| 391 | { |
| 392 | float r12, r23, r34, r41, rmin; |
| 393 | tocka2cxx . . $ tocka2# t; |
| 394 | int i,j; |
| 395 | premica2cxx . . $ premica2# p12,p23,p34,p41; |
| 396 | |
| 397 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[0],vog[1],&p12); // 1-2 |
| 398 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[2],vog[3],&p34); // 3-4 |
| 399 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[3],vog[0],&p41); // 4-1 |
| 400 | premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[1],vog[2],&p23); // 2-3 |
| 401 | |
| 402 | for (i=0;i<ho;i++) |
| 403 | for (j=0;j<wo;j++) |
| 404 | { |
| 405 | t.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(float)i+0.5; t.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(float)j+0.5; |
| 406 | r12=fabsf(razd_t_pcxx . . $ razd_t_p(1d271ff39dc38e7a).(t,p12)); |
| 407 | r23=fabsf(razd_t_pcxx . . $ razd_t_p(1d271ff39dc38e7a).(t,p23)); |
| 408 | r34=fabsf(razd_t_pcxx . . $ razd_t_p(1d271ff39dc38e7a).(t,p34)); |
| 409 | r41=fabsf(razd_t_pcxx . . $ razd_t_p(1d271ff39dc38e7a).(t,p41)); |
| 410 | rmin=1.0E22; |
| 411 | if ((r12<rmin) && (nots[0]!=1)) rmin=r12; |
| 412 | if ((r23<rmin) && (nots[1]!=1)) rmin=r23; |
| 413 | if ((r34<rmin) && (nots[2]!=1)) rmin=r34; |
| 414 | if ((r41<rmin) && (nots[3]!=1)) rmin=r41; |
| 415 | if ((map[2*(i*wo+j)]>=0.0)&&(map[2*(i*wo+j)+1]>=0.0)) |
| 416 | { //inside |
| 417 | if (rmin<=feath) //border area |
| 418 | amap[i*wo+j]=255*(rmin/feath); |
| 419 | else |
| 420 | amap[i*wo+j]=255; |
| 421 | } |
| 422 | else //outside |
| 423 | amap[i*wo+j]=0; |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | //------------------------------------------------------- |
| 428 | void apply_alphamapcxx . . $ apply_alphamap(12fa38fb4058c2d).(uint32_tcxx . . $ uint32_t#* frame, int w, int h, unsigned char *amap, int operation) |
| 429 | { |
| 430 | int i, length; |
| 431 | uint32_tcxx . . $ uint32_t# t; |
| 432 | length = w * h; |
| 433 | |
| 434 | switch (operation) |
| 435 | { |
| 436 | case 0: //write on clear |
| 437 | for (i=0;i<length;i++) |
| 438 | { |
| 439 | t=((uint32_tcxx . . $ uint32_t#)amap[i])<<24; |
| 440 | frame[i] = (frame[i]&0x00FFFFFF) | t; |
| 441 | } |
| 442 | break; |
| 443 | case 1: //max |
| 444 | for (i=0;i<length;i++) |
| 445 | { |
| 446 | t=((uint32_tcxx . . $ uint32_t#)amap[i])<<24; |
| 447 | frame[i] = (frame[i]&0x00FFFFFF) | MAXcxx . . $ `include/frei0r/math.h:71:9`!(frame[i]&0xFF000000, t); |
| 448 | } |
| 449 | break; |
| 450 | case 2: //min |
| 451 | for (i=0;i<length;i++) |
| 452 | { |
| 453 | t=((uint32_tcxx . . $ uint32_t#)amap[i])<<24; |
| 454 | frame[i] = (frame[i]&0x00FFFFFF) | MINcxx . . $ `include/frei0r/math.h:67:9`!(frame[i]&0xFF000000, t); |
| 455 | } |
| 456 | break; |
| 457 | case 3: //add |
| 458 | for (i=0;i<length;i++) |
| 459 | { |
| 460 | t=((uint32_tcxx . . $ uint32_t#)amap[i])<<24; |
| 461 | t=((frame[i]&0xFF000000)>>1)+(t>>1); |
| 462 | t = (t>0x7F800000) ? 0xFF000000 : t<<1; |
| 463 | frame[i] = (frame[i]&0x00FFFFFF) | t; |
| 464 | } |
| 465 | break; |
| 466 | case 4: //subtract |
| 467 | for (i=0;i<length;i++) |
| 468 | { |
| 469 | t=((uint32_tcxx . . $ uint32_t#)amap[i])<<24; |
| 470 | t= ((frame[i]&0xFF000000)>t) ? (frame[i]&0xFF000000)-t : 0; |
| 471 | frame[i] = (frame[i]&0x00FFFFFF) | t; |
| 472 | } |
| 473 | break; |
| 474 | default: |
| 475 | break; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | // ------------------------------------------------ --------------- |
| 480 | // function for byte fields (char) |
| 481 | // generate map from the four corners |
| 482 | // first checks for different types of degenerate geometrty ... |
| 483 | // wi, hi input image size |
| 484 | // wo, ho output image size |
| 485 | // vog [] the four corners |
| 486 | // nots [] "inner" sides (for alpha feathering) |
| 487 | int geom4c_bcxx . . $ geom4c_b(7362e206d34f00cb).(int wi, int hi, int wo, int ho, tocka2cxx . . $ tocka2# vog[], int str, float strx, float stry, float *map, int nots[]) |
| 488 | { |
| 489 | premica2cxx . . $ premica2# p12,p23,p34,p41; |
| 490 | tocka2cxx . . $ tocka2# R,S; |
| 491 | int r41,r23,s12,s34; //tocki R in S |
| 492 | int p1,p2; //paralelnost stranic |
| 493 | int t12,t23,t34,t41; //sovpadanje tock |
| 494 | int tip; //1=degen trik 2=paral 3=splosni 4=twist 5=konkavni |
| 495 | int i; |
| 496 | |
| 497 | for (i=0;i<4;i++) //convert indexes to positions (pixel) |
| 498 | { |
| 499 | vog[i].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=vog[i].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.+0.5; |
| 500 | vog[i].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=vog[i].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.+0.5; |
| 501 | } |
| 502 | |
| 503 | tip=3; |
| 504 | |
| 505 | t12=premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[0],vog[1],&p12); // 1-2 |
| 506 | t34=premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[2],vog[3],&p34); // 3-4 |
| 507 | t41=premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[3],vog[0],&p41); // 4-1 |
| 508 | t23=premica2dcxx . . $ premica2d(de49498eb3140a4e).(vog[1],vog[2],&p23); // 2-3 |
| 509 | |
| 510 | //preveri degeneracijo v crto ali piko |
| 511 | //check for degeneration into a line or point |
| 512 | if ((t12+t34+t41+t23)<-19) |
| 513 | { //vec kot dve sovpadata |
| 514 | //daj tu fill with background?? |
| 515 | return 0; |
| 516 | } |
| 517 | if (((vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.==vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)&&(vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.==vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)) || ((vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.==vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)&&(vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.==vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.))) |
| 518 | { //sovpadata dve diagonalni tocki |
| 519 | //daj tu fill with background?? |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | p1=presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p12,p34,&S); //tocka S |
| 524 | p2=presecisce2cxx . . $ presecisce2(1746810dfd927d03).(p41,p23,&R); //tocka R |
| 525 | |
| 526 | //preveri degeneracijo v trikotnik (sovpadanje nediagonalnih tock) |
| 527 | //check for degeneration into triangle (coincident non-diagonal c.) |
| 528 | if (t12==-10) {R=vog[0];p12=p34;p1=-1;tip=1;} |
| 529 | if (t34==-10) {R=vog[2];p34=p12;p1=-1;tip=1;} |
| 530 | if (t41==-10) {S=vog[0];p41=p23;p2=-1;tip=1;} |
| 531 | if (t23==-10) {S=vog[2];p23=p41;p2=-1;tip=1;} |
| 532 | |
| 533 | //preveri vzporednost |
| 534 | //check parallelity |
| 535 | if (p1==-1) //vzporedni 1-2 in 3-4 |
| 536 | { |
| 537 | if (fabsf(p12.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p12.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 538 | {S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=1.0E9;S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=-(p12.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.*S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.+p12.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.)/p12.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.;} |
| 539 | else |
| 540 | {S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=1.0E9;S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=-(p12.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.*S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.+p12.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.)/p12.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.;} |
| 541 | } |
| 542 | if (p2==-1) //vzporedni 2-3 in 4-1 |
| 543 | { |
| 544 | if (fabsf(p41.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p41.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 545 | {R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=1.0E9;R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=-(p41.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.*R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.+p41.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.)/p41.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.;} |
| 546 | else |
| 547 | {R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=1.0E9;R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=-(p41.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.*R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.+p41.ccxx . . $ $anonymous_type_14dd04af2be9454a_2#c.)/p41.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.;} |
| 548 | } |
| 549 | |
| 550 | //pogleda, ce je priblizno paralelogram |
| 551 | //check if approximately parallelogram |
| 552 | if (((fabsf(R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)>1000000.0)||(fabsf(R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)>1000000.0)) && |
| 553 | ((fabsf(S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)>1000000.0)||(fabsf(S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)>1000000.0))) |
| 554 | tip=2; |
| 555 | |
| 556 | //preveri, ce je prekrizan ali konkaven (R ali S med ogljici) |
| 557 | //check for concave or crossed sides |
| 558 | r41=0;r23=0;s12=0;s34=0; |
| 559 | |
| 560 | if (fabsf(p41.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p41.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 561 | {if (((R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)*(R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.))<0.0) r41=1;}//R na 4-1 |
| 562 | else |
| 563 | {if (((R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)*(R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.))<0.0) r41=1;}//R na 4-1 |
| 564 | |
| 565 | if (fabsf(p23.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p23.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 566 | {if (((R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)*(R.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.))<0.0) r23=1;}//R na 2-3 |
| 567 | else |
| 568 | {if (((R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)*(R.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.))<0.0) r23=1;}//R na 2-3 |
| 569 | |
| 570 | if (fabsf(p12.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p12.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 571 | {if (((S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)*(S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.))<0.0) s12=1;}//S na 1-2 |
| 572 | else |
| 573 | {if (((S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)*(S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.))<0.0) s12=1;}//S na 1-2 |
| 574 | |
| 575 | if (fabsf(p34.acxx . . $ $anonymous_type_14dd04af2be9454a_2#a.)>fabsf(p34.bcxx . . $ $anonymous_type_14dd04af2be9454a_2#b.)) //bolj pokonci |
| 576 | {if (((S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.)*(S.ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.-vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.))<0.0) s34=1;}//S na 3-4 |
| 577 | else |
| 578 | {if (((S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.)*(S.xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.-vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.))<0.0) s34=1;}//S na 3-4 |
| 579 | |
| 580 | if (((r41+r23+s12+s34)>0)&&(tip==3)) |
| 581 | { |
| 582 | if ((r41*r23+s12*s34)==0) //konkaven |
| 583 | tip=5; |
| 584 | else //prekrizan |
| 585 | tip=4; |
| 586 | } |
| 587 | |
| 588 | //prepare nots[] flags |
| 589 | nots[0]=nots[1]=nots[2]=nots[3]=0; |
| 590 | if (tip==4) |
| 591 | { |
| 592 | nots[0] = (s12==0) ? 0 : 1; |
| 593 | nots[1] = (r23==0) ? 0 : 1; |
| 594 | nots[2] = (s34==0) ? 0 : 1; |
| 595 | nots[3] = (r41==0) ? 0 : 1; |
| 596 | } |
| 597 | if (tip==5) |
| 598 | { |
| 599 | nots[2] = (s12==0) ? 0 : 1; |
| 600 | nots[3] = (r23==0) ? 0 : 1; |
| 601 | nots[0] = (s34==0) ? 0 : 1; |
| 602 | nots[1] = (r41==0) ? 0 : 1; |
| 603 | } |
| 604 | |
| 605 | //OK, zdaj gremo risat... |
| 606 | switch (tip) |
| 607 | { |
| 608 | case 0: //should never come to here... |
| 609 | break; |
| 610 | case 1: //triangle |
| 611 | trikotnik1cxx . . $ trikotnik1(e5753fc0599e2978).(wi, hi, wo, ho, vog, R, S, p12, p23, p34, p41, t12, t23, str, strx, stry, map); |
| 612 | break; |
| 613 | case 2: //paralelogram |
| 614 | //a faster algorithm could be used here... |
| 615 | case 3: //general quadrangle |
| 616 | case 4: //crossed sides |
| 617 | case 5: //concave quadrangle |
| 618 | cetverokotnik4cxx . . $ cetverokotnik4(2c03077b87888ad9).(wi, hi, wo, ho, vog, str, strx, stry, map); |
| 619 | break; |
| 620 | } |
| 621 | |
| 622 | return 0; |
| 623 | } |
| 624 | |
| 625 | //------------------------------------------------------- |
| 626 | interppcxx . . $ interpp# set_intpcxx . . $ set_intp(cfc3088e1c520ab5).(instcxx . . $ inst# p) |
| 627 | { |
| 628 | switch (p.intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp.) //katero interpolacijo bo uporabil |
| 629 | { |
| 630 | // case -1:return interpNNpr_b; //nearest neighbor+print |
| 631 | case 0: return interpNN_b32cxx . . $ interpNN_b32(bb2946d2180fb79f).; //nearest neighbor |
| 632 | case 1: return interpBL_b32cxx . . $ interpBL_b32(bb2946d2180fb79f).; //bilinear |
| 633 | case 2: return interpBC_b32cxx . . $ interpBC_b32(bb2946d2180fb79f).; //bicubic smooth |
| 634 | case 3: return interpBC2_b32cxx . . $ interpBC2_b32(bb2946d2180fb79f).; //bicibic sharp |
| 635 | case 4: return interpSP4_b32cxx . . $ interpSP4_b32(bb2946d2180fb79f).; //spline 4x4 |
| 636 | case 5: return interpSP6_b32cxx . . $ interpSP6_b32(bb2946d2180fb79f).; //spline 6x6 |
| 637 | case 6: return interpSC16_b32cxx . . $ interpSC16_b32(bb2946d2180fb79f).; //lanczos 8x8 |
| 638 | default: return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | //----------------------------------------------------- |
| 643 | //stretch [0...1] to parameter range [min...max] linear |
| 644 | float map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(double v, float min, float max) |
| 645 | { |
| 646 | return min+(max-min)*v; |
| 647 | } |
| 648 | |
| 649 | //----------------------------------------------------- |
| 650 | //collapse from parameter range [min...max] to [0...1] linear |
| 651 | double map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(float v, float min, float max) |
| 652 | { |
| 653 | return (v-min)/(max-min); |
| 654 | } |
| 655 | |
| 656 | |
| 657 | //*********************************************** |
| 658 | // OBVEZNE FREI0R FUNKCIJE |
| 659 | |
| 660 | //----------------------------------------------- |
| 661 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 662 | { |
| 663 | return 1; |
| 664 | } |
| 665 | |
| 666 | //------------------------------------------------ |
| 667 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 668 | { |
| 669 | } |
| 670 | |
| 671 | //----------------------------------------------- |
| 672 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* info) |
| 673 | { |
| 674 | |
| 675 | info->namecxx . . $ f0r_plugin_info#name.="c0rners"; |
| 676 | info->authorcxx . . $ f0r_plugin_info#author.="Marko Cebokli"; |
| 677 | info->plugin_typecxx . . $ f0r_plugin_info#plugin_type.=F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!; |
| 678 | info->color_modelcxx . . $ f0r_plugin_info#color_model.=F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 679 | info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version.=FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 680 | info->major_versioncxx . . $ f0r_plugin_info#major_version.=0; |
| 681 | info->minor_versioncxx . . $ f0r_plugin_info#minor_version.=2; |
| 682 | info->num_paramscxx . . $ f0r_plugin_info#num_params.=15; |
| 683 | info->explanationcxx . . $ f0r_plugin_info#explanation.="Four corners geometry engine"; |
| 684 | } |
| 685 | |
| 686 | //-------------------------------------------------- |
| 687 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index) |
| 688 | { |
| 689 | |
| 690 | switch(param_index) |
| 691 | { |
| 692 | case 0: |
| 693 | info->namecxx . . $ f0r_param_info#name. = "Corner 1 X"; |
| 694 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 695 | info->explanationcxx . . $ f0r_param_info#explanation. = "X coordinate of corner 1"; |
| 696 | break; |
| 697 | case 1: |
| 698 | info->namecxx . . $ f0r_param_info#name. = "Corner 1 Y"; |
| 699 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 700 | info->explanationcxx . . $ f0r_param_info#explanation. = "Y coordinate of corner 1"; |
| 701 | break; |
| 702 | case 2: |
| 703 | info->namecxx . . $ f0r_param_info#name. = "Corner 2 X"; |
| 704 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 705 | info->explanationcxx . . $ f0r_param_info#explanation. = "X coordinate of corner 2"; |
| 706 | break; |
| 707 | case 3: |
| 708 | info->namecxx . . $ f0r_param_info#name. = "Corner 2 Y"; |
| 709 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 710 | info->explanationcxx . . $ f0r_param_info#explanation. = "Y coordinate of corner 2"; |
| 711 | break; |
| 712 | case 4: |
| 713 | info->namecxx . . $ f0r_param_info#name. = "Corner 3 X"; |
| 714 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 715 | info->explanationcxx . . $ f0r_param_info#explanation. = "X coordinate of corner 3"; |
| 716 | break; |
| 717 | case 5: |
| 718 | info->namecxx . . $ f0r_param_info#name. = "Corner 3 Y"; |
| 719 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 720 | info->explanationcxx . . $ f0r_param_info#explanation. = "Y coordinate of corner 3"; |
| 721 | break; |
| 722 | case 6: |
| 723 | info->namecxx . . $ f0r_param_info#name. = "Corner 4 X"; |
| 724 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 725 | info->explanationcxx . . $ f0r_param_info#explanation. = "X coordinate of corner 4"; |
| 726 | break; |
| 727 | case 7: |
| 728 | info->namecxx . . $ f0r_param_info#name. = "Corner 4 Y"; |
| 729 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 730 | info->explanationcxx . . $ f0r_param_info#explanation. = "Y coordinate of corner 4"; |
| 731 | break; |
| 732 | case 8: |
| 733 | info->namecxx . . $ f0r_param_info#name. = "Enable Stretch"; |
| 734 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!; |
| 735 | info->explanationcxx . . $ f0r_param_info#explanation. = "Enable stretching"; |
| 736 | break; |
| 737 | case 9: |
| 738 | info->namecxx . . $ f0r_param_info#name. = "Stretch X"; |
| 739 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 740 | info->explanationcxx . . $ f0r_param_info#explanation. = "Amount of stretching in X direction"; |
| 741 | break; |
| 742 | case 10: |
| 743 | info->namecxx . . $ f0r_param_info#name. = "Stretch Y"; |
| 744 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 745 | info->explanationcxx . . $ f0r_param_info#explanation. = "Amount of stretching in Y direction"; |
| 746 | break; |
| 747 | case 11: |
| 748 | info->namecxx . . $ f0r_param_info#name. = "Interpolator"; |
| 749 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 750 | info->explanationcxx . . $ f0r_param_info#explanation. = "Quality of interpolation"; |
| 751 | break; |
| 752 | case 12: |
| 753 | info->namecxx . . $ f0r_param_info#name. = "Transparent Background"; |
| 754 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!; |
| 755 | info->explanationcxx . . $ f0r_param_info#explanation. = "Makes background transparent"; |
| 756 | break; |
| 757 | case 13: |
| 758 | info->namecxx . . $ f0r_param_info#name. = "Feather Alpha"; |
| 759 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 760 | info->explanationcxx . . $ f0r_param_info#explanation. = "Makes smooth transition into transparent"; |
| 761 | break; |
| 762 | case 14: |
| 763 | info->namecxx . . $ f0r_param_info#name. = "Alpha operation"; |
| 764 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 765 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | //---------------------------------------------- |
| 770 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 771 | { |
| 772 | instcxx . . $ inst# *in; |
| 773 | |
| 774 | in=(instcxx . . $ inst#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(instcxx . . $ inst#)); |
| 775 | in->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.=width; |
| 776 | in->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.=height; |
| 777 | in->x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.=0.333333; |
| 778 | in->y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.=0.333333; |
| 779 | in->x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.=0.666666; |
| 780 | in->y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.=0.333333; |
| 781 | in->x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.=0.666666; |
| 782 | in->y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.=0.666666; |
| 783 | in->x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.=0.333333; |
| 784 | in->y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.=0.666666; |
| 785 | in->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON.=0; |
| 786 | in->stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx.=0.5; |
| 787 | in->stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy.=0.5; |
| 788 | in->intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp.=1; |
| 789 | in->transbcxx . . $ $anonymous_type_14dd04af2be9454a_0#transb.=0; |
| 790 | in->feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath.=1.0; |
| 791 | in->opcxx . . $ $anonymous_type_14dd04af2be9454a_0#op.=0; |
| 792 | |
| 793 | in->mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map.=(float*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(float)*(in->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.*in->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.*2+2)); |
| 794 | in->amapcxx . . $ $anonymous_type_14dd04af2be9454a_0#amap.=(unsigned char*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(char)*(in->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.*in->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.*2+2)); |
| 795 | in->interpcxx . . $ $anonymous_type_14dd04af2be9454a_0#interp.=set_intpcxx . . $ set_intp(cfc3088e1c520ab5).(*in); |
| 796 | in->mapIsDirtycxx . . $ $anonymous_type_14dd04af2be9454a_0#mapIsDirty.=1; |
| 797 | |
| 798 | return (f0r_instance_tcxx . . $ f0r_instance_t#)in; |
| 799 | } |
| 800 | |
| 801 | //--------------------------------------------------- |
| 802 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 803 | { |
| 804 | instcxx . . $ inst# *p; |
| 805 | |
| 806 | p=(instcxx . . $ inst#*)instance; |
| 807 | |
| 808 | freecxx . . $ free(5d22bdacc48458e8).(p->mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map.); |
| 809 | freecxx . . $ free(5d22bdacc48458e8).(p->amapcxx . . $ $anonymous_type_14dd04af2be9454a_0#amap.); |
| 810 | freecxx . . $ free(5d22bdacc48458e8).(instance); |
| 811 | } |
| 812 | |
| 813 | //----------------------------------------------------- |
| 814 | void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# parm, int param_index) |
| 815 | { |
| 816 | instcxx . . $ inst# *p; |
| 817 | double tmpf; |
| 818 | int chg; |
| 819 | |
| 820 | p=(instcxx . . $ inst#*)instance; |
| 821 | |
| 822 | chg=0; |
| 823 | switch(param_index) |
| 824 | { |
| 825 | case 0: //X coordinate of corner 1 |
| 826 | tmpf=*(double*)parm; |
| 827 | if (tmpf!=p->x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.) chg=1; |
| 828 | p->x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.=tmpf; |
| 829 | break; |
| 830 | case 1: //Y coordinate of corner 1 |
| 831 | tmpf=*(double*)parm; |
| 832 | if (tmpf!=p->y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.) chg=1; |
| 833 | p->y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.=tmpf; |
| 834 | break; |
| 835 | case 2: //X coordinate of corner 2 |
| 836 | tmpf=*(double*)parm; |
| 837 | if (tmpf!=p->x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.) chg=1; |
| 838 | p->x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.=tmpf; |
| 839 | break; |
| 840 | case 3: //Y coordinate of corner 2 |
| 841 | tmpf=*(double*)parm; |
| 842 | if (tmpf!=p->y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.) chg=1; |
| 843 | p->y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.=tmpf; |
| 844 | break; |
| 845 | case 4: //X coordinate of corner 3 |
| 846 | tmpf=*(double*)parm; |
| 847 | if (tmpf!=p->x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.) chg=1; |
| 848 | p->x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.=tmpf; |
| 849 | break; |
| 850 | case 5: //Y coordinate of corner 3 |
| 851 | tmpf=*(double*)parm; |
| 852 | if (tmpf!=p->y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.) chg=1; |
| 853 | p->y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.=tmpf; |
| 854 | break; |
| 855 | case 6: //X coordinate of corner 4 |
| 856 | tmpf=*(double*)parm; |
| 857 | if (tmpf!=p->x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.) chg=1; |
| 858 | p->x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.=tmpf; |
| 859 | break; |
| 860 | case 7: //Y coordinate of corner 4 |
| 861 | tmpf=*(double*)parm; |
| 862 | if (tmpf!=p->y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.) chg=1; |
| 863 | p->y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.=tmpf; |
| 864 | break; |
| 865 | case 8: //Enable stretching |
| 866 | tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 1.0);//BOOL!! |
| 867 | if (p->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON. != tmpf) chg=1; |
| 868 | p->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON. = tmpf; |
| 869 | break; |
| 870 | case 9: //Stretch X |
| 871 | tmpf=*(double*)parm; |
| 872 | if (tmpf!=p->stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx.) chg=1; |
| 873 | p->stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx.=tmpf; |
| 874 | break; |
| 875 | case 10: //Stretch Y |
| 876 | tmpf=*(double*)parm; |
| 877 | if (tmpf!=p->stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy.) chg=1; |
| 878 | p->stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy.=tmpf; |
| 879 | break; |
| 880 | case 11: //Interpolation |
| 881 | tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 6.999); |
| 882 | if (p->intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp. != tmpf) chg=1; |
| 883 | p->intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp.=tmpf; |
| 884 | break; |
| 885 | case 12: //Transparent Background |
| 886 | tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 1.0);//BOOL!! |
| 887 | // if (p->transb != tmpf) chg=1; |
| 888 | p->transbcxx . . $ $anonymous_type_14dd04af2be9454a_0#transb. = tmpf; |
| 889 | break; |
| 890 | case 13: //Feather Alpha |
| 891 | tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 100.0); |
| 892 | if (tmpf!=p->feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath.) chg=1; |
| 893 | p->feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath.=tmpf; |
| 894 | break; |
| 895 | case 14: //Alpha operation |
| 896 | p->opcxx . . $ $anonymous_type_14dd04af2be9454a_0#op.=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 4.9999); |
| 897 | break; |
| 898 | } |
| 899 | |
| 900 | if (chg!=0) |
| 901 | { |
| 902 | p->interpcxx . . $ $anonymous_type_14dd04af2be9454a_0#interp.=set_intpcxx . . $ set_intp(cfc3088e1c520ab5).(*p); |
| 903 | p->mapIsDirtycxx . . $ $anonymous_type_14dd04af2be9454a_0#mapIsDirty. = 1; |
| 904 | } |
| 905 | |
| 906 | } |
| 907 | |
| 908 | //-------------------------------------------------- |
| 909 | void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 910 | { |
| 911 | instcxx . . $ inst# *p; |
| 912 | double tmpf; |
| 913 | |
| 914 | p=(instcxx . . $ inst#*)instance; |
| 915 | |
| 916 | switch(param_index) |
| 917 | { |
| 918 | case 0: //X coordinate of corner 1 |
| 919 | tmpf=(float)p->x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.; |
| 920 | *((double*)param)=tmpf; |
| 921 | break; |
| 922 | case 1: //Y coordinate of corner 1 |
| 923 | tmpf=(float)p->y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.; |
| 924 | *((double*)param)=tmpf; |
| 925 | break; |
| 926 | case 2: //X coordinate of corner 2 |
| 927 | tmpf=(float)p->x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.; |
| 928 | *((double*)param)=tmpf; |
| 929 | break; |
| 930 | case 3: //Y coordinate of corner 2 |
| 931 | tmpf=(float)p->y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.; |
| 932 | *((double*)param)=tmpf; |
| 933 | break; |
| 934 | case 4: //X coordinate of corner 3 |
| 935 | tmpf=(float)p->x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.; |
| 936 | *((double*)param)=tmpf; |
| 937 | break; |
| 938 | case 5: //Y coordinate of corner 3 |
| 939 | tmpf=(float)p->y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.; |
| 940 | *((double*)param)=tmpf; |
| 941 | break; |
| 942 | case 6: //X coordinate of corner 4 |
| 943 | tmpf=(float)p->x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.; |
| 944 | *((double*)param)=tmpf; |
| 945 | break; |
| 946 | case 7: //Y coordinate of corner 4 |
| 947 | tmpf=(float)p->y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.; |
| 948 | *((double*)param)=tmpf; |
| 949 | break; |
| 950 | case 8: //Enable stretching |
| 951 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON., 0.0, 1.0); //BOOL!! |
| 952 | break; |
| 953 | case 9: //Stretch X |
| 954 | tmpf=(float)p->stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx.; |
| 955 | *((double*)param)=tmpf; |
| 956 | break; |
| 957 | case 10: //Stretch Y |
| 958 | tmpf=(float)p->stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy.; |
| 959 | *((double*)param)=tmpf; |
| 960 | break; |
| 961 | case 11: //Interpolation |
| 962 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->intpcxx . . $ $anonymous_type_14dd04af2be9454a_0#intp., 0.0, 6.0); //!!!!!! 6.999 ???? tudi v defish!!!! |
| 963 | break; |
| 964 | case 12: //Transparent Background |
| 965 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->transbcxx . . $ $anonymous_type_14dd04af2be9454a_0#transb., 0.0, 1.0); //BOOL!! |
| 966 | break; |
| 967 | case 13: //Feather Alpha |
| 968 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath., 0.0, 100.0); |
| 969 | break; |
| 970 | case 14: //Alpha operation |
| 971 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->opcxx . . $ $anonymous_type_14dd04af2be9454a_0#op., 0.0, 4.9999); |
| 972 | break; |
| 973 | } |
| 974 | } |
| 975 | |
| 976 | #define EPSILONcxx . . $ `src/filter/c0rners/c0rners.c:976:9`! 1e-5f |
| 977 | #define EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(x, y) (fabsf((x) - (y)) < EPSILONcxx . . $ `src/filter/c0rners/c0rners.c:976:9`!) |
| 978 | |
| 979 | //------------------------------------------------- |
| 980 | void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time, const uint32_tcxx . . $ uint32_t#* inframe, uint32_tcxx . . $ uint32_t#* outframe) |
| 981 | { |
| 982 | instcxx . . $ inst# *p; |
| 983 | int bkgr; |
| 984 | |
| 985 | p=(instcxx . . $ inst#*)instance; |
| 986 | |
| 987 | if (EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->x1, 0.333333f) && |
| 988 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->y1, 0.333333f) && |
| 989 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->x2, 0.666666f) && |
| 990 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->y2, 0.333333f) && |
| 991 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->x3, 0.666666f) && |
| 992 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->y3, 0.666666f) && |
| 993 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->x4, 0.333333f) && |
| 994 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->y4, 0.666666f) && |
| 995 | (!p->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON. || ( |
| 996 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->stretchx, 0.5f) && |
| 997 | EQUIVALENT_FLOATScxx . . $ `src/filter/c0rners/c0rners.c:977:9`!(p->stretchy, 0.5f)))) |
| 998 | { |
| 999 | memcpycxx . . $ memcpy(cc817cb175f282d).(outframe, inframe, p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w. * p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h. * 4); |
| 1000 | return; |
| 1001 | } |
| 1002 | |
| 1003 | if (p->mapIsDirtycxx . . $ $anonymous_type_14dd04af2be9454a_0#mapIsDirty.) { |
| 1004 | tocka2cxx . . $ tocka2# vog[4]; |
| 1005 | int nots[4]; |
| 1006 | vog[0].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(p->x1cxx . . $ $anonymous_type_14dd04af2be9454a_0#x1.*3-1)*p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.; |
| 1007 | vog[0].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(p->y1cxx . . $ $anonymous_type_14dd04af2be9454a_0#y1.*3-1)*p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.; |
| 1008 | vog[1].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(p->x2cxx . . $ $anonymous_type_14dd04af2be9454a_0#x2.*3-1)*p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.; |
| 1009 | vog[1].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(p->y2cxx . . $ $anonymous_type_14dd04af2be9454a_0#y2.*3-1)*p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.; |
| 1010 | vog[2].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(p->x3cxx . . $ $anonymous_type_14dd04af2be9454a_0#x3.*3-1)*p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.; |
| 1011 | vog[2].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(p->y3cxx . . $ $anonymous_type_14dd04af2be9454a_0#y3.*3-1)*p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.; |
| 1012 | vog[3].xcxx . . $ $anonymous_type_14dd04af2be9454a_1#x.=(p->x4cxx . . $ $anonymous_type_14dd04af2be9454a_0#x4.*3-1)*p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w.; |
| 1013 | vog[3].ycxx . . $ $anonymous_type_14dd04af2be9454a_1#y.=(p->y4cxx . . $ $anonymous_type_14dd04af2be9454a_0#y4.*3-1)*p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h.; |
| 1014 | geom4c_bcxx . . $ geom4c_b(7362e206d34f00cb).(p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., vog, p->stretchONcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchON., p->stretchxcxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchx., p->stretchycxx . . $ $anonymous_type_14dd04af2be9454a_0#stretchy., p->mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map., nots); |
| 1015 | make_alphamapcxx . . $ make_alphamap(1affc3f68917ec2f).(p->amapcxx . . $ $anonymous_type_14dd04af2be9454a_0#amap., vog, p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., p->mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map., p->feathcxx . . $ $anonymous_type_14dd04af2be9454a_0#feath., nots); |
| 1016 | p->mapIsDirtycxx . . $ $anonymous_type_14dd04af2be9454a_0#mapIsDirty. = 0; |
| 1017 | } |
| 1018 | |
| 1019 | //if (p->transb==0) bkgr=0xFF000000; else bkgr=0; |
| 1020 | bkgr=0xFF000000; |
| 1021 | |
| 1022 | remap32cxx . . $ remap32(c5b0480a77d4b7b2).(p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., (unsigned char*) inframe, (unsigned char *) outframe, p->mapcxx . . $ $anonymous_type_14dd04af2be9454a_0#map., bkgr, p->interpcxx . . $ $anonymous_type_14dd04af2be9454a_0#interp.); |
| 1023 | |
| 1024 | if (p->transbcxx . . $ $anonymous_type_14dd04af2be9454a_0#transb.!=0) |
| 1025 | apply_alphamapcxx . . $ apply_alphamap(12fa38fb4058c2d).(outframe, p->wcxx . . $ $anonymous_type_14dd04af2be9454a_0#w., p->hcxx . . $ $anonymous_type_14dd04af2be9454a_0#h., p->amapcxx . . $ $anonymous_type_14dd04af2be9454a_0#amap., p->opcxx . . $ $anonymous_type_14dd04af2be9454a_0#op.); |
| 1026 | |
| 1027 | } |