Lens and similar effects, color quantification
@eZine
Published in
AbeDemoschool
· 1 year ago
... ns.c Calculates the tfm array. viewtga.c Used to show the background image. lens.asm Routines for steps 1, 2 and 3 in the algorithm above. Abedemo5.c #includes mklens.c and viewtga.c. Compile everything with: bcc -1 abedemo5.c lens.asm If you change the tfm array, the entire effect changes. Here are some cool transformations (D is both width and height): Invert area (flip in both x- and y-directions): for(i=0;i < D;i++) { for(j=0;j < D;j++) tfm[i*D+j] = i*D + D-1 - j; } Flip area in y-direction : int MAG=2; //magnificationfactor for(i=0;i < D;i++) { for(j=0;j < D;j++) tfm[i*D+j] = (i/MAG)*D + (j/MAG); } All these transforma ...