| 1 | /* |
| 2 | test_pat_G |
| 3 | This frei0r plugin generates geometry test pattern images |
| 4 | Version 0.1 may 2010 |
| 5 | |
| 6 | Copyright (C) 2010 Marko Cebokli http://lea.hamradio.si/~s57uuu |
| 7 | |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 2 of the License, or |
| 12 | (at your option) any later version. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with this program; if not, write to the Free Software |
| 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | |
| 23 | */ |
| 24 | |
| 25 | /*********************************************************** |
| 26 | Test patterns: Geometry |
| 27 | |
| 28 | This plugin draws a set of test patterns, which are useful for image geometry checking. |
| 29 | |
| 30 | The patterns are drawn into a temporary char array, for two reasons: |
| 31 | 1. drawing routines are color model independent, |
| 32 | 2. drawing is done only when a parameter changes. |
| 33 | |
| 34 | only the functions make_char2color_table(), quadrants() and |
| 35 | f0r_update() need to care about color models, endianness, |
| 36 | DV legality etc. |
| 37 | |
| 38 | *************************************************************/ |
| 39 | |
| 40 | //compile: gcc -Wall -c -fPIC test_pat_G.c -o test_pat_G.o |
| 41 | |
| 42 | //link: gcc -lm -shared -o test_pat_G.so test_pat_G.o |
| 43 | |
| 44 | #include <stdlib.h> |
| 45 | #include <assert.h> |
| 46 | #include <math.h> |
| 47 | |
| 48 | #include "frei0r.h"cxx . . $ `<file>/include/frei0r.h`/ |
| 49 | #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/ |
| 50 | |
| 51 | |
| 52 | //---------------------------------------------------------- |
| 53 | void draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(unsigned char *sl, int w, int h, int x, int y, int wr, int hr, unsigned char gray) |
| 54 | { |
| 55 | int i,j; |
| 56 | int zx,kx,zy,ky; |
| 57 | |
| 58 | zx=x; if (zx<0) zx=0; |
| 59 | zy=y; if (zy<0) zy=0; |
| 60 | kx=x+wr; if (kx>w) kx=w; |
| 61 | ky=y+hr; if (ky>h) ky=h; |
| 62 | for (i=zy;i<ky;i++) |
| 63 | for (j=zx;j<kx;j++) |
| 64 | sl[w*i+j]=gray; |
| 65 | |
| 66 | } |
| 67 | |
| 68 | //----------------------------------------------------------- |
| 69 | //pocasna za velike kroge..... |
| 70 | void draw_circlecxx . . $ draw_circle(6c44bd85edc114ec).(unsigned char *sl, int w, int h, float ar, int x, int y, int rn, int rz, unsigned char gray) |
| 71 | { |
| 72 | int i,j; |
| 73 | int zx,kx,zy,ky; |
| 74 | float rr,rmin,rmax; |
| 75 | |
| 76 | zx=x-rz/ar-1; if (zx<0) zx=0; |
| 77 | zy=y-rz-1; if (zy<0) zy=0; |
| 78 | kx=x+rz/ar+1; if (kx>=w) kx=w-1; |
| 79 | ky=y+rz+1; if (ky>=h) ky=h-1; |
| 80 | rmin=(float)rn; |
| 81 | rmax=(float)rz; |
| 82 | for (i=zy;i<ky;i++) |
| 83 | for (j=zx;j<kx;j++) |
| 84 | { |
| 85 | rr=sqrtf((i-y)*(i-y)+(j-x)*(j-x)*ar*ar); |
| 86 | if ((rr>=rmin)&&(rr<=rmax)) sl[w*i+j]=gray; |
| 87 | } |
| 88 | |
| 89 | } |
| 90 | |
| 91 | //----------------------------------------------------------- |
| 92 | //dir: 1=up 2=right 3=down 4=left |
| 93 | void draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(unsigned char *sl, int w, int h, int x, int y, int size, int dir, unsigned char gray) |
| 94 | { |
| 95 | int i,j,ii,jj; |
| 96 | |
| 97 | switch (dir) |
| 98 | { |
| 99 | case 1: //up |
| 100 | for (i=0;i<size;i++) |
| 101 | for (j=0;j<=i;j++) |
| 102 | { |
| 103 | ii=y+i; if (ii>=h) ii=h-1; |
| 104 | jj=x+j; if (jj>=w) jj=w-1; |
| 105 | sl[w*ii+jj]=gray; |
| 106 | jj=x-j; if (jj<0) jj=0; |
| 107 | sl[w*ii+jj]=gray; |
| 108 | } |
| 109 | break; |
| 110 | case 2: //right |
| 111 | for (i=0;i<size;i++) |
| 112 | for (j=0;j<=i;j++) |
| 113 | { |
| 114 | ii=x-i; if (ii<0) ii=0; |
| 115 | jj=y+j; if (jj>=h) jj=h-1; |
| 116 | sl[w*jj+ii]=gray; |
| 117 | jj=y-j; if (jj<0) jj=0; |
| 118 | sl[w*jj+ii]=gray; |
| 119 | } |
| 120 | break; |
| 121 | case 3: //down |
| 122 | for (i=0;i<size;i++) |
| 123 | for (j=0;j<=i;j++) |
| 124 | { |
| 125 | ii=y-i; if (ii<0) ii=0; |
| 126 | jj=x+j; if (jj>=w) jj=w-1; |
| 127 | sl[w*ii+jj]=gray; |
| 128 | jj=x-j; if (jj<0) jj=0; |
| 129 | sl[w*ii+jj]=gray; |
| 130 | } |
| 131 | break; |
| 132 | case 4: //left |
| 133 | for (i=0;i<size;i++) |
| 134 | for (j=0;j<=i;j++) |
| 135 | { |
| 136 | ii=x+i; if (ii>=w) ii=w-1; |
| 137 | jj=y+j; if (jj>=h) jj=h-1; |
| 138 | sl[w*jj+ii]=gray; |
| 139 | jj=y-j; if (jj<0) jj=0; |
| 140 | sl[w*jj+ii]=gray; |
| 141 | } |
| 142 | break; |
| 143 | default: |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | //---------------------------------------------------------- |
| 149 | //draws a checkerboard pattern |
| 150 | //size = size of squares (pixels) |
| 151 | //ar = pixel aspect ratio |
| 152 | //rim : 0=uniform 1=gray rim |
| 153 | void sah1cxx . . $ sah1(4328174497b8c3b6).(unsigned char *sl, int w, int h, int size, float ar, int rim) |
| 154 | { |
| 155 | int i,j,kx,ky,z,pv,ps,zv,zs; |
| 156 | unsigned char black,gray1,gray2,white; |
| 157 | int ox,oy; |
| 158 | |
| 159 | if (size<1) size=1; |
| 160 | kx=size; ky=size; |
| 161 | kx=kx/ar; //kao aspect!=1 (anamorph) |
| 162 | kx = MAXcxx . . $ `include/frei0r/math.h:71:9`!(kx, 1); |
| 163 | ky = MAXcxx . . $ `include/frei0r/math.h:71:9`!(ky, 1); |
| 164 | |
| 165 | black=0; |
| 166 | white=255; |
| 167 | gray1=black+(white-black)*0.3; |
| 168 | gray2=black+(white-black)*0.7; |
| 169 | |
| 170 | ox=kx*2-(w/2)%(kx*2); //centering offset |
| 171 | oy=ky*2-(h/2)%(ky*2); |
| 172 | ps=(w/2)%kx; if (ps==0) ps=kx; |
| 173 | pv=(h/2)%ky; if (pv==0) pv=ky; |
| 174 | zv=h-pv; |
| 175 | zs=w-ps; |
| 176 | |
| 177 | if (rim==0) |
| 178 | { |
| 179 | for (i=0;i<h;i++) |
| 180 | { |
| 181 | for (j=0;j<w;j++) |
| 182 | { |
| 183 | if ((((i+oy)/ky)%2)^(((j+ox)/kx)%2)) |
| 184 | sl[i*w+j]=white; |
| 185 | else |
| 186 | sl[i*w+j]=black; |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | else |
| 191 | { |
| 192 | for (i=0;i<h;i++) |
| 193 | { |
| 194 | for (j=0;j<w;j++) |
| 195 | { |
| 196 | z=0; |
| 197 | if((j<ps)||(j>=zs)||(i<pv)||(i>=zv)) z=1; |
| 198 | if ((((i+oy)/ky)%2)^(((j+ox)/kx)%2)) |
| 199 | sl[i*w+j]= (z==0) ? white : gray2; |
| 200 | else |
| 201 | sl[i*w+j]= (z==0) ? black : gray1; |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | } |
| 207 | |
| 208 | //------------------------------------------------- |
| 209 | //draws horizontal lines |
| 210 | //clr=clear background |
| 211 | void hlinescxx . . $ hlines(1f28b050b567e58).(unsigned char *sl, int w, int h, int size1, int size2, float ar, int clr) |
| 212 | { |
| 213 | int i,iz; |
| 214 | unsigned char black,white; |
| 215 | |
| 216 | black=0; |
| 217 | white=255; |
| 218 | |
| 219 | if (clr!=0) for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 220 | |
| 221 | if (size1<1) size1=1; |
| 222 | if (size2<1) size2=1; |
| 223 | iz=h/2-size1*((h/2)/size1); |
| 224 | for (i=iz;i<h;i=i+size1) //hor. lines |
| 225 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,0,i-size2/2,w,size2,white); |
| 226 | |
| 227 | } |
| 228 | |
| 229 | //------------------------------------------------- |
| 230 | //draws vertical lines |
| 231 | //clr=clear background |
| 232 | void vlinescxx . . $ vlines(1f28b050b567e58).(unsigned char *sl, int w, int h, int size1, int size2, float ar, int clr) |
| 233 | { |
| 234 | int i,iz; |
| 235 | unsigned char black,white; |
| 236 | |
| 237 | black=0; |
| 238 | white=255; |
| 239 | |
| 240 | if (clr!=0) for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 241 | |
| 242 | if (size1<1) size1=1; |
| 243 | if (size2<1) size2=1; |
| 244 | if (ar==0) ar=1.0; |
| 245 | size1=size1/ar; |
| 246 | iz=w/2-size1*((w/2)/size1); |
| 247 | for (i=iz;i<w;i=i+size1) //vert. lines |
| 248 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i-size2/2,0,size2,h,white); |
| 249 | |
| 250 | } |
| 251 | |
| 252 | //------------------------------------------------- |
| 253 | //draws a rectangular grid pattern |
| 254 | void mrezacxx . . $ mreza(642314335f42e754).(unsigned char *sl, int w, int h, int size1, int size2, float ar) |
| 255 | { |
| 256 | |
| 257 | if (ar==0) ar=1.0; |
| 258 | hlinescxx . . $ hlines(1f28b050b567e58).(sl, w, h, size1, size2, ar, 1); |
| 259 | vlinescxx . . $ vlines(1f28b050b567e58).(sl, w, h, size1/ar, size2, ar, 0); |
| 260 | |
| 261 | } |
| 262 | |
| 263 | //------------------------------------------------- |
| 264 | //draws points (small squares really) |
| 265 | void pikecxx . . $ pike(642314335f42e754).(unsigned char *sl, int w, int h, int size1, int size2, float ar) |
| 266 | { |
| 267 | int i,j,iz,jz; |
| 268 | int black,white; |
| 269 | int size1a,size2a; |
| 270 | |
| 271 | black=0; |
| 272 | white=255; |
| 273 | |
| 274 | for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 275 | |
| 276 | if (size1<1) size1=1; |
| 277 | if (size2<1) size2=1; |
| 278 | if (ar==0) ar=1.0; |
| 279 | size1a=size1/ar; size2a=size2/ar; |
| 280 | iz=h/2-size1*((h/2)/size1); |
| 281 | jz=w/2-size1a*((w/2)/size1a); |
| 282 | for (i=iz;i<h;i=i+size1) |
| 283 | for (j=jz;j<w;j=j+size1a) |
| 284 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,j-size2/2,i-size2/2,size2a,size2,white); |
| 285 | |
| 286 | } |
| 287 | |
| 288 | //----------------------------------------------------------- |
| 289 | //draws a bullseye pattern |
| 290 | void tarcacxx . . $ tarca(642314335f42e754).(unsigned char *sl, int w, int h, int size1, int size2, float ar) |
| 291 | { |
| 292 | unsigned char black,white; |
| 293 | int i; |
| 294 | |
| 295 | black=0; |
| 296 | white=255; |
| 297 | |
| 298 | for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 299 | |
| 300 | if (size1<20) size1=20; //otherwise too slooooow... |
| 301 | |
| 302 | draw_circlecxx . . $ draw_circle(6c44bd85edc114ec).(sl, w, h, ar, w/2, h/2, 0, size2/2, white); |
| 303 | for (i=size1;i<(h/2);i=i+size1) |
| 304 | draw_circlecxx . . $ draw_circle(6c44bd85edc114ec).(sl, w, h, ar, w/2, h/2, i-size2/2, i+size2/2, white); |
| 305 | } |
| 306 | |
| 307 | //--------------------------------------------------------- |
| 308 | //draws image edge markers |
| 309 | void robovicxx . . $ robovi(49a5bbab55ea8abc).(unsigned char *sl, int w, int h) |
| 310 | { |
| 311 | int i,j,l; |
| 312 | unsigned char black,white; |
| 313 | |
| 314 | black=0; |
| 315 | white=255; |
| 316 | |
| 317 | for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 318 | |
| 319 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, w/4, 0, 50, 1, white); |
| 320 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, 3*w/4, 0, 50, 1, white); |
| 321 | |
| 322 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, w-1, h/4, 50, 2, white); |
| 323 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, w-1, 3*h/4, 50, 2, white); |
| 324 | |
| 325 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, w/4, h-1, 50, 3, white); |
| 326 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, 3*w/4, h-1, 50, 3, white); |
| 327 | |
| 328 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, 0, h/4, 50, 4, white); |
| 329 | draw_wedgecxx . . $ draw_wedge(951999b042a688b5).(sl, w, h, 0, 3*h/4, 50, 4, white); |
| 330 | |
| 331 | for (i=0;i<50;i++) |
| 332 | { |
| 333 | l=(i%10)*10+10; |
| 334 | for (j=w/2-50;j<w/2-50+l;j++) |
| 335 | { |
| 336 | sl[i*w+w-j-1]=white; |
| 337 | sl[(h-i-1)*w+j]=white; |
| 338 | } |
| 339 | for (j=h/2-50;j<h/2-50+l;j++) |
| 340 | { |
| 341 | sl[j*w+i]=white; |
| 342 | sl[(h-j-1)*w+w-i-1]=white; |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | //---------------------------------------------------------- |
| 348 | //draws centered pixel rulers |
| 349 | void rulerscxx . . $ rulers(69047f1ff218fe2a).(unsigned char *sl, int w, int h, unsigned char *a) |
| 350 | { |
| 351 | int i; |
| 352 | unsigned char black,white,tr; |
| 353 | |
| 354 | black=0; |
| 355 | white=255; |
| 356 | tr=200; //how opaque are the marks |
| 357 | |
| 358 | for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 359 | for (i=0;i<(w*h);i++) a[i]=0; //transparent |
| 360 | |
| 361 | for (i=w/2; i<w; i=i+2) |
| 362 | { |
| 363 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,h/2,1,1,white); |
| 364 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w-i,h/2-1,1,1,white); |
| 365 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,h/2,1,1,tr); |
| 366 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w-i,h/2-1,1,1,tr); |
| 367 | } |
| 368 | |
| 369 | for (i=w/2+10; i<w; i=i+10) |
| 370 | { |
| 371 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,h/2,1,3,white); |
| 372 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w-i,h/2-3,1,3,white); |
| 373 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,h/2,1,3,tr); |
| 374 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w-i,h/2-3,1,3,tr); |
| 375 | } |
| 376 | |
| 377 | for (i=w/2+50; i<w; i=i+50) |
| 378 | { |
| 379 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,h/2,1,5,white); |
| 380 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w-i,h/2-5,1,5,white); |
| 381 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,h/2,1,5,tr); |
| 382 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w-i,h/2-5,1,5,tr); |
| 383 | } |
| 384 | |
| 385 | for (i=w/2+100; i<w; i=i+100) |
| 386 | { |
| 387 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,h/2,1,10,white); |
| 388 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w-i,h/2-10,1,10,white); |
| 389 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,h/2,1,10,tr); |
| 390 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w-i,h/2-10,1,10,tr); |
| 391 | } |
| 392 | |
| 393 | for (i=h/2; i<h; i=i+2) |
| 394 | { |
| 395 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2-1,i,1,1,white); |
| 396 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2,h-i,1,1,white); |
| 397 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2-1,i,1,1,tr); |
| 398 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2,h-i,1,1,tr); |
| 399 | } |
| 400 | |
| 401 | for (i=h/2+10; i<h; i=i+10) |
| 402 | { |
| 403 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2-3,i,3,1,white); |
| 404 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2,h-i,3,1,white); |
| 405 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2-3,i,3,1,tr); |
| 406 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2,h-i,3,1,tr); |
| 407 | } |
| 408 | |
| 409 | for (i=h/2+50; i<h; i=i+50) |
| 410 | { |
| 411 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2-5,i,5,1,white); |
| 412 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2,h-i,5,1,white); |
| 413 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2-5,i,5,1,tr); |
| 414 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2,h-i,5,1,tr); |
| 415 | } |
| 416 | |
| 417 | for (i=h/2+100; i<h; i=i+100) |
| 418 | { |
| 419 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2-10,i,10,1,white); |
| 420 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,w/2,h-i,10,1,white); |
| 421 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2-10,i,10,1,tr); |
| 422 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,w/2,h-i,10,1,tr); |
| 423 | } |
| 424 | |
| 425 | } |
| 426 | |
| 427 | //---------------------------------------------------------- |
| 428 | //draws a transparent measurement grid |
| 429 | //*a = alpha channel |
| 430 | void gridcxx . . $ grid(69047f1ff218fe2a).(unsigned char *sl, int w, int h, unsigned char *a) |
| 431 | { |
| 432 | int i,j; |
| 433 | unsigned char black,white,tr; |
| 434 | |
| 435 | black=0; |
| 436 | white=255; |
| 437 | tr=200; //how opaque are the marks |
| 438 | |
| 439 | for (i=0;i<(w*h);i++) sl[i]=black; //black background |
| 440 | for (i=0;i<(w*h);i++) a[i]=0; //transparent |
| 441 | |
| 442 | for (i=0;i<h;i=i+2) |
| 443 | for (j=0;j<w;j=j+10) |
| 444 | { |
| 445 | sl[i*w+j]=white; |
| 446 | a[i*w+j]=tr; |
| 447 | } |
| 448 | for (i=0;i<h;i=i+10) |
| 449 | for (j=0;j<w;j=j+2) |
| 450 | { |
| 451 | sl[i*w+j]=white; |
| 452 | a[i*w+j]=tr; |
| 453 | } |
| 454 | |
| 455 | for (i=0;i<h;i=i+50) |
| 456 | for (j=0;j<w;j=j+50) |
| 457 | { |
| 458 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,j-1,1,3,white); |
| 459 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i-1,j,3,1,white); |
| 460 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,j-1,1,3,tr); |
| 461 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i-1,j,3,1,tr); |
| 462 | } |
| 463 | |
| 464 | for (i=0;i<h;i=i+100) |
| 465 | for (j=0;j<w;j=j+100) |
| 466 | { |
| 467 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i,j-4,1,9,white); |
| 468 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i-4,j,9,1,white); |
| 469 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(sl,w,h,i-1,j-1,3,3,white); |
| 470 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i,j-4,1,9,tr); |
| 471 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i-4,j,9,1,tr); |
| 472 | draw_rectanglecxx . . $ draw_rectangle(951999b042a688b5).(a,w,h,i-1,j-1,3,3,tr); |
| 473 | } |
| 474 | |
| 475 | } |
| 476 | //---------------------------------------------------- |
| 477 | //marks the four quadrants with different colors |
| 478 | //COLOR MODEL DEPENDENT! |
| 479 | void kvadranticxx . . $ kvadranti(b1a41b594304bffa).(uint32_tcxx . . $ uint32_t# *sl, int w, int h, int neg) |
| 480 | { |
| 481 | uint32_tcxx . . $ uint32_t# c1,c2,c3,c4; |
| 482 | int i,j; |
| 483 | |
| 484 | //RGBA8888 little endian, opaque |
| 485 | if (neg==0) |
| 486 | { |
| 487 | c1=0xFF10F010; //green |
| 488 | c2=0xFF10F0F0; //yellow |
| 489 | c3=0xFFF01010; //blue |
| 490 | c4=0xFF1010F0; //red |
| 491 | } |
| 492 | else |
| 493 | { |
| 494 | c1=0xFFF010F0; //magenta |
| 495 | c2=0xFFF01010; //blue |
| 496 | c3=0xFF10F0F0; //yellow |
| 497 | c4=0xFFF0F010; //cyan |
| 498 | } |
| 499 | |
| 500 | for (i=0;i<h/2;i++) |
| 501 | { |
| 502 | for (j=0;j<w/2;j++) sl[i*w+j]=c1; |
| 503 | for (j=w/2;j<w;j++) sl[i*w+j]=c2; |
| 504 | } |
| 505 | for (i=h/2;i<h;i++) |
| 506 | { |
| 507 | for (j=0;j<w/2;j++) sl[i*w+j]=c3; |
| 508 | for (j=w/2;j<w;j++) sl[i*w+j]=c4; |
| 509 | } |
| 510 | |
| 511 | } |
| 512 | |
| 513 | //----------------------------------------------------- |
| 514 | //makes a table used for conversion of the char* |
| 515 | //intermediate image into the required color model |
| 516 | //alpha = 0 (transparent!) |
| 517 | //COLOR MODEL DEPENDENT! |
| 518 | void make_char2color_tablecxx . . $ make_char2color_table(56b2f94921e09776).(uint32_tcxx . . $ uint32_t# *c2c, int neg) |
| 519 | { |
| 520 | unsigned int i; |
| 521 | |
| 522 | if (neg==0) |
| 523 | for (i=0;i<256;i++) |
| 524 | c2c[i]=((i&0xFF)<<0)+((i&0xFF)<<8)+((i&0xFF)<<16); |
| 525 | else |
| 526 | for (i=0;i<256;i++) |
| 527 | c2c[255-i]=((i&0xFF)<<0)+((i&0xFF)<<8)+((i&0xFF)<<16); |
| 528 | |
| 529 | } |
| 530 | |
| 531 | //----------------------------------------------------- |
| 532 | //stretch [0...1] to parameter range [min...max] linear |
| 533 | float map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(double v, float min, float max) |
| 534 | { |
| 535 | return min+(max-min)*v; |
| 536 | } |
| 537 | |
| 538 | //----------------------------------------------------- |
| 539 | //collapse from parameter range [min...max] to [0...1] linear |
| 540 | double map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(float v, float min, float max) |
| 541 | { |
| 542 | return (v-min)/(max-min); |
| 543 | } |
| 544 | |
| 545 | //----------------------------------------------------- |
| 546 | //stretch [0...1] to parameter range [min...max] logarithmic |
| 547 | //min and max must be positive! |
| 548 | float map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(double v, float min, float max) |
| 549 | { |
| 550 | float sr,k; |
| 551 | |
| 552 | sr=sqrtf(min*max); |
| 553 | k=2.0*log(max/sr); |
| 554 | return sr*expf(k*(v-0.5)); |
| 555 | } |
| 556 | |
| 557 | //----------------------------------------------------- |
| 558 | //collapse from parameter range [min...max] to [0...1] logarithmic |
| 559 | //min and max must be positive! |
| 560 | double map_value_backward_logcxx . . $ map_value_backward_log(937b104db0ceee62).(float v, float min, float max) |
| 561 | { |
| 562 | float sr,k; |
| 563 | |
| 564 | sr=sqrtf(min*max); |
| 565 | k=2.0*log(max/sr); |
| 566 | return logf(v/sr)/k+0.5; |
| 567 | } |
| 568 | |
| 569 | //************************************************** |
| 570 | //obligatory frei0r stuff follows |
| 571 | |
| 572 | //------------------------------------------------ |
| 573 | //this structure holds an instance of the test_pat_G plugin |
| 574 | typedef structcxx . . $ $anonymous_type_720395cb8f412765_0# |
| 575 | { |
| 576 | unsigned int wcxx . . $ $anonymous_type_720395cb8f412765_0#w.; |
| 577 | unsigned int hcxx . . $ $anonymous_type_720395cb8f412765_0#h.; |
| 578 | |
| 579 | int typecxx . . $ $anonymous_type_720395cb8f412765_0#type.; |
| 580 | int size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1.; |
| 581 | int size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2.; |
| 582 | int asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt.; |
| 583 | float mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar.; |
| 584 | int negcxx . . $ $anonymous_type_720395cb8f412765_0#neg.; |
| 585 | |
| 586 | float parcxx . . $ $anonymous_type_720395cb8f412765_0#par.; |
| 587 | unsigned char *slcxx . . $ $anonymous_type_720395cb8f412765_0#sl.; |
| 588 | unsigned char *alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.; |
| 589 | uint32_tcxx . . $ uint32_t# *c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.; |
| 590 | |
| 591 | } tp_inst_tcxx . . $ tp_inst_t#; |
| 592 | |
| 593 | //---------------------------------------------------- |
| 594 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 595 | { |
| 596 | return 1; |
| 597 | } |
| 598 | |
| 599 | //-------------------------------------------------- |
| 600 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 601 | { /* no initialization required */ } |
| 602 | |
| 603 | //-------------------------------------------------- |
| 604 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* tp_info) |
| 605 | { |
| 606 | tp_info->namecxx . . $ f0r_plugin_info#name. = "test_pat_G"; |
| 607 | tp_info->authorcxx . . $ f0r_plugin_info#author. = "Marko Cebokli"; |
| 608 | tp_info->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_SOURCEcxx . . $ `include/frei0r.h:249:9`!; |
| 609 | // tp_info->plugin_type = F0R_PLUGIN_TYPE_FILTER; |
| 610 | tp_info->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 611 | tp_info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 612 | tp_info->major_versioncxx . . $ f0r_plugin_info#major_version. = 0; |
| 613 | tp_info->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 2; |
| 614 | tp_info->num_paramscxx . . $ f0r_plugin_info#num_params. = 6; |
| 615 | tp_info->explanationcxx . . $ f0r_plugin_info#explanation. = "Generates geometry test pattern images"; |
| 616 | } |
| 617 | |
| 618 | //-------------------------------------------------- |
| 619 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index) |
| 620 | { |
| 621 | switch (param_index) |
| 622 | { |
| 623 | case 0: |
| 624 | info->namecxx . . $ f0r_param_info#name. = "Type"; |
| 625 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 626 | info->explanationcxx . . $ f0r_param_info#explanation. = "Type of test pattern"; break; |
| 627 | case 1: |
| 628 | info->namecxx . . $ f0r_param_info#name. = "Size 1"; |
| 629 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 630 | info->explanationcxx . . $ f0r_param_info#explanation. = "Size of major features"; break; |
| 631 | case 2: |
| 632 | info->namecxx . . $ f0r_param_info#name. = "Size 2"; |
| 633 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 634 | info->explanationcxx . . $ f0r_param_info#explanation. = "Size of minor features"; break; |
| 635 | case 3: |
| 636 | info->namecxx . . $ f0r_param_info#name. = "Negative"; |
| 637 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!; |
| 638 | info->explanationcxx . . $ f0r_param_info#explanation. = "Polarity of image"; break; |
| 639 | case 4: |
| 640 | info->namecxx . . $ f0r_param_info#name. ="Aspect type"; |
| 641 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 642 | info->explanationcxx . . $ f0r_param_info#explanation. = "Pixel aspect ratio presets"; |
| 643 | break; |
| 644 | case 5: |
| 645 | info->namecxx . . $ f0r_param_info#name. = "Manual Aspect"; |
| 646 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 647 | info->explanationcxx . . $ f0r_param_info#explanation. = "Manual pixel aspect ratio"; |
| 648 | break; |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | //-------------------------------------------------- |
| 653 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 654 | { |
| 655 | tp_inst_tcxx . . $ tp_inst_t#* inst = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst)); |
| 656 | inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w. = width; |
| 657 | inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h. = height; |
| 658 | |
| 659 | inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type.=0; |
| 660 | inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1.=72; |
| 661 | inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2.=4; |
| 662 | inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt.=0; |
| 663 | inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar.=1.0; |
| 664 | inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg.=0; |
| 665 | |
| 666 | inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.0; |
| 667 | inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl.=(unsigned char*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(width*height,1); |
| 668 | inst->alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.=(unsigned char*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(width*height,1); |
| 669 | inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.=(uint32_tcxx . . $ uint32_t# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(256,sizeof(uint32_tcxx . . $ uint32_t#)); |
| 670 | |
| 671 | make_char2color_tablecxx . . $ make_char2color_table(56b2f94921e09776).(inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.,inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg.); |
| 672 | sah1cxx . . $ sah1(4328174497b8c3b6).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par., 0); |
| 673 | |
| 674 | return (f0r_instance_tcxx . . $ f0r_instance_t#)inst; |
| 675 | } |
| 676 | |
| 677 | //-------------------------------------------------- |
| 678 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 679 | { |
| 680 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 681 | |
| 682 | freecxx . . $ free(5d22bdacc48458e8).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl.); |
| 683 | freecxx . . $ free(5d22bdacc48458e8).(inst->alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.); |
| 684 | freecxx . . $ free(5d22bdacc48458e8).(inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.); |
| 685 | freecxx . . $ free(5d22bdacc48458e8).(inst); |
| 686 | } |
| 687 | |
| 688 | //-------------------------------------------------- |
| 689 | void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 690 | { |
| 691 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 692 | |
| 693 | f0r_param_doublecxx . . $ f0r_param_double#* p = (f0r_param_doublecxx . . $ f0r_param_double#*) param; |
| 694 | |
| 695 | int chg,tmpi; |
| 696 | float tmpf; |
| 697 | |
| 698 | chg=0; |
| 699 | switch (param_index) |
| 700 | { |
| 701 | case 0: //type |
| 702 | tmpf=*((double*)p); |
| 703 | if (tmpf>=1.0) |
| 704 | tmpi=(int)tmpf; |
| 705 | else |
| 706 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(tmpf, 0.0, 12.9999); |
| 707 | if ((tmpi<0)||(tmpi>12.0)) break; |
| 708 | if (inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type. != tmpi) chg=1; |
| 709 | inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type. = tmpi; |
| 710 | break; |
| 711 | case 1: //size 1 |
| 712 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 256.0); |
| 713 | if (inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1. != tmpi) chg=1; |
| 714 | inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1. = tmpi; |
| 715 | break; |
| 716 | case 2: //size 2 |
| 717 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 64.0); |
| 718 | if (inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2. != tmpi) chg=1; |
| 719 | inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2. = tmpi; |
| 720 | break; |
| 721 | case 3: //negative |
| 722 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 1.0); |
| 723 | if (inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg. != tmpi) chg=1; |
| 724 | inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg. = tmpi; |
| 725 | make_char2color_tablecxx . . $ make_char2color_table(56b2f94921e09776).(inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.,inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg.); |
| 726 | break; |
| 727 | case 4: //aspect type |
| 728 | tmpf=*((double*)p); |
| 729 | if (tmpf>=1.0) |
| 730 | tmpi=(int)tmpf; |
| 731 | else |
| 732 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 6.9999); |
| 733 | if ((tmpi<0)||(tmpi>6.0)) break; |
| 734 | if (inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt. != tmpi) chg=1; |
| 735 | inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt. = tmpi; |
| 736 | switch (inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt.) //pixel aspect ratio |
| 737 | { |
| 738 | case 0: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.000;break; //square pixels |
| 739 | case 1: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.067;break; //PAL DV |
| 740 | case 2: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.455;break; //PAL wide |
| 741 | case 3: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=0.889;break; //NTSC DV |
| 742 | case 4: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.212;break; //NTSC wide |
| 743 | case 5: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=1.333;break; //HDV |
| 744 | case 6: inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar.;break; //manual |
| 745 | } |
| 746 | break; |
| 747 | case 5: //manual aspect |
| 748 | tmpf = map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(*((double*)p), 0.5, 2.0); |
| 749 | if (inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar. !=tmpf) chg=1; |
| 750 | inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar. = tmpf; |
| 751 | if (inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt.==4) inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.=inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar.; |
| 752 | break; |
| 753 | } |
| 754 | |
| 755 | if (chg==0) return; |
| 756 | |
| 757 | switch (inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type.) |
| 758 | { |
| 759 | case 0: //checkerboard |
| 760 | sah1cxx . . $ sah1(4328174497b8c3b6).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par., 0); |
| 761 | break; |
| 762 | case 1: //checkerboard with border |
| 763 | sah1cxx . . $ sah1(4328174497b8c3b6).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par., 1); |
| 764 | break; |
| 765 | case 2: //horizontal lines |
| 766 | hlinescxx . . $ hlines(1f28b050b567e58).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par., 1); |
| 767 | break; |
| 768 | case 3: //vertical lines |
| 769 | vlinescxx . . $ vlines(1f28b050b567e58).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par., 1); |
| 770 | break; |
| 771 | case 4: //grid |
| 772 | mrezacxx . . $ mreza(642314335f42e754).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.); |
| 773 | break; |
| 774 | case 5: //points |
| 775 | pikecxx . . $ pike(642314335f42e754).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2., inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.); |
| 776 | break; |
| 777 | case 6: //bullseye |
| 778 | tarcacxx . . $ tarca(642314335f42e754).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2.+1, inst->parcxx . . $ $anonymous_type_720395cb8f412765_0#par.); |
| 779 | break; |
| 780 | case 7: //edge marks |
| 781 | robovicxx . . $ robovi(49a5bbab55ea8abc).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h.); |
| 782 | break; |
| 783 | case 8: //color quadrants are drawn in update() |
| 784 | break; |
| 785 | case 9: //pixel rulers |
| 786 | case 11: |
| 787 | rulerscxx . . $ rulers(69047f1ff218fe2a).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.); |
| 788 | break; |
| 789 | case 10: //measurement grid |
| 790 | case 12: |
| 791 | gridcxx . . $ grid(69047f1ff218fe2a).(inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl., inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w., inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h., inst->alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.); |
| 792 | break; |
| 793 | default: |
| 794 | break; |
| 795 | } |
| 796 | |
| 797 | } |
| 798 | |
| 799 | //------------------------------------------------- |
| 800 | 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) |
| 801 | { |
| 802 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 803 | |
| 804 | f0r_param_doublecxx . . $ f0r_param_double#* p = (f0r_param_doublecxx . . $ f0r_param_double#*) param; |
| 805 | |
| 806 | switch (param_index) |
| 807 | { |
| 808 | case 0: //type |
| 809 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type., 0.0, 12.9999); |
| 810 | break; |
| 811 | case 1: //size 1 |
| 812 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->size1cxx . . $ $anonymous_type_720395cb8f412765_0#size1., 0.0, 256.0); |
| 813 | break; |
| 814 | case 2: //size 2 |
| 815 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->size2cxx . . $ $anonymous_type_720395cb8f412765_0#size2., 0.0, 64.0); |
| 816 | break; |
| 817 | case 3: //negative |
| 818 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg., 0.0, 1.0); |
| 819 | break; |
| 820 | case 4: //aspect type |
| 821 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->asptcxx . . $ $anonymous_type_720395cb8f412765_0#aspt., 0.0, 6.9999); |
| 822 | break; |
| 823 | case 5: //manual aspect |
| 824 | *p = map_value_backward_logcxx . . $ map_value_backward_log(937b104db0ceee62).(inst->mparcxx . . $ $anonymous_type_720395cb8f412765_0#mpar., 0.5, 2.0); |
| 825 | break; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | //--------------------------------------------------- |
| 830 | //COLOR MODEL DEPENDENT |
| 831 | 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) |
| 832 | { |
| 833 | int i; |
| 834 | |
| 835 | assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance); |
| 836 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 837 | |
| 838 | switch (inst->typecxx . . $ $anonymous_type_720395cb8f412765_0#type.) |
| 839 | { |
| 840 | case 0: |
| 841 | case 1: |
| 842 | case 2: |
| 843 | case 3: |
| 844 | case 4: |
| 845 | case 5: |
| 846 | case 6: |
| 847 | case 7: |
| 848 | case 9: |
| 849 | case 10: |
| 850 | for (i=0;i<(inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h.*inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w.);i++) |
| 851 | outframe[i]=0xFF000000|inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.[inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl.[i]]; |
| 852 | break; |
| 853 | case 8: |
| 854 | kvadranticxx . . $ kvadranti(b1a41b594304bffa).(outframe,inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w.,inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h.,inst->negcxx . . $ $anonymous_type_720395cb8f412765_0#neg.); |
| 855 | break; |
| 856 | case 11: |
| 857 | case 12: |
| 858 | for (i=0;i<(inst->hcxx . . $ $anonymous_type_720395cb8f412765_0#h.*inst->wcxx . . $ $anonymous_type_720395cb8f412765_0#w.);i++) |
| 859 | outframe[i]=((uint32_tcxx . . $ uint32_t#)inst->alphacxx . . $ $anonymous_type_720395cb8f412765_0#alpha.[i])<<24|inst->c2ccxx . . $ $anonymous_type_720395cb8f412765_0#c2c.[inst->slcxx . . $ $anonymous_type_720395cb8f412765_0#sl.[i]]; |
| 860 | break; |
| 861 | default: |
| 862 | break; |
| 863 | } |
| 864 | |
| 865 | } |