gliches++
This commit is contained in:
		
							parent
							
								
									a587a66af8
								
							
						
					
					
						commit
						a450ac4291
					
				
							
								
								
									
										17
									
								
								Fonderie/essai.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								Fonderie/essai.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,17 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| OUTF='/tmp/out_a*.png' | ||||
| 
 | ||||
| rm $OUTF | ||||
| 
 | ||||
| make t && ./t | ||||
| 
 | ||||
| 
 | ||||
| A_PART=$(ls -1  $OUTF) | ||||
| Z_PART=$(ls -r1 $OUTF) | ||||
| 
 | ||||
| convert -delay 10 ${A_PART} ${Z_PART} foo.gif | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @ -113,11 +113,26 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo) | ||||
| return -1; | ||||
| } | ||||
| /*   --------------------------------------------------------------   */ | ||||
| /*
 | ||||
|  *   used by vertical_singlitch() | ||||
|  */ | ||||
| int x_delta(float dy, float phy) | ||||
| { | ||||
| float	param, fv; | ||||
| param = dy + phy; | ||||
| fv = 9.999*sin(param) + 6.666*sin(param*3) + 3.333*sin(param*5); | ||||
| return (int)fv; | ||||
| } | ||||
| /*   --------------------------------------------------------------   */ | ||||
| /*
 | ||||
|  *     please explain arguments | ||||
|  */ | ||||
| int vertical_singlitch(FloatImg *picz, int xpos, float fval,  | ||||
| 						float omega, float phi) | ||||
| { | ||||
| int		y, x, w, h; | ||||
| double		dy; | ||||
| float		dy; | ||||
| float		fv; | ||||
| 
 | ||||
| #if DEBUG_LEVEL | ||||
| fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz, | ||||
| @ -125,21 +140,23 @@ fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz, | ||||
| #endif | ||||
| 
 | ||||
| h = picz->height;		w = picz->width; | ||||
| #define BB 10 | ||||
| #define BB 4 | ||||
| for (y=BB; y<h-BB; y++) { | ||||
| 
 | ||||
| 	dy = (double)y * omega; | ||||
| 	dy = (float)y * omega;		/* normalize vertical position */ | ||||
| 
 | ||||
| 	x = xpos + (int)(10.9*sin(dy+phi));	/* add sinus deviation */ | ||||
| 	x = xpos + x_delta(dy, phi);	/* add sinus deviation */ | ||||
| 
 | ||||
| 	/* compute bounding box */ | ||||
| 	if ( (x>BB) && (x<w-BB) ) { | ||||
| 		/* an make the glitch */ | ||||
| 		fimg_plot_rgb(picz, x, y, fval, fval, fval); | ||||
| 		fv = fval / 3.0; | ||||
| 		if (rand() & 8) | ||||
| 			fimg_plot_rgb(picz, x-1, y, 0.0, 0.0, 0.0); | ||||
| 			fimg_plot_rgb(picz, x-1, y, fv, fv, fv); | ||||
| 		if (rand() & 8) | ||||
| 			fimg_plot_rgb(picz, x+1, y, 0.0, 0.0, 0.0); | ||||
| 		// XXX else
 | ||||
| 			fimg_plot_rgb(picz, x+1, y, fv, fv, fv); | ||||
| 		} | ||||
| 	} | ||||
| return 0; | ||||
|  | ||||
							
								
								
									
										19
									
								
								Fonderie/t.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								Fonderie/t.c
									
									
									
									
									
								
							| @ -8,6 +8,7 @@ | ||||
| 
 | ||||
| #include  "../floatimg.h" | ||||
| #include  "glitches.h" | ||||
| #include  "sfx.h" | ||||
| 
 | ||||
| /* ----------------------------------------------------------- */ | ||||
| 
 | ||||
| @ -15,13 +16,10 @@ int		verbosity; | ||||
| 
 | ||||
| #define		PNG	"out.png" | ||||
| #define		W	512 | ||||
| #define		H	512 | ||||
| #define		LMAX	233.333 | ||||
| #define		H	256 | ||||
| #define		LMAX	249.9999 | ||||
| #define		TIMER	1 | ||||
| 
 | ||||
| 
 | ||||
| int trinarize(FloatImg *pimg, int notused);	// in sfx.c
 | ||||
| 
 | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| int		foo, iter, xloc, bloub; | ||||
| @ -40,16 +38,16 @@ if (foo) { | ||||
| 	exit(1); | ||||
| 	} | ||||
| 
 | ||||
| fimg_printhead(&image); | ||||
| // fimg_printhead(&image);
 | ||||
| 
 | ||||
| srand(getpid()); | ||||
| debut = fimg_timer_set(TIMER); | ||||
| 
 | ||||
| for (iter=0; iter<16; iter++) { | ||||
| fimg_hdeg_a(&image, LMAX); | ||||
| 
 | ||||
| 	fimg_vdeg_a(&image, LMAX); | ||||
| for (iter=0; iter<32; iter++) { | ||||
| 
 | ||||
| 	for (bloub=0; bloub<16; bloub++) { | ||||
| 	for (bloub=0; bloub<6; bloub++) { | ||||
| 		xloc = rand() % W; | ||||
| 		omega = (float)(0.1 + drand48()*0.6) * 0.4; | ||||
| 		foo = vertical_singlitch(&image, xloc, LMAX, | ||||
| @ -64,6 +62,7 @@ for (iter=0; iter<16; iter++) { | ||||
| 		exit(1); | ||||
| 		} | ||||
| 
 | ||||
| #if 0 | ||||
| 	foo = trinarize(&image, 0);		/*   XXX   */ | ||||
| 
 | ||||
| 	sprintf(buff, "/tmp/out_b%03d.png", iter); | ||||
| @ -72,7 +71,7 @@ for (iter=0; iter<16; iter++) { | ||||
| 		fprintf(stderr, "err %d saving to '%s'\n", foo, buff); | ||||
| 		exit(1); | ||||
| 		} | ||||
| 
 | ||||
| #endif | ||||
| 	} | ||||
| 
 | ||||
| fin = fimg_timer_set(TIMER); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user