Graphics destructor

Post Reply
User avatar
NightRadio
Site Admin
Posts: 3029
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Graphics destructor

Post by NightRadio » Wed Mar 26, 2008 2:56 pm

Replace "pic2.jpg" to some real picture.

Code: Select all

xsize = 320
ysize = 240
hx = xsize / 2
hy = ysize / 2
resize_pixi( 0, xsize, ysize )

img = load_pixi( "pic2.jpg" )

//Error types:
err_xb = 8
err_yb = 8
err_x = ( xsize / err_xb )
err_y = ( ysize / err_yb )
err = new_array( err_x * err_y )

start_timer( 0 )
start_timer( 1 )

//Reinit errors:
a = 0 while( a < err_x * err_y ) { err[ a ] = rand a + 1 }

start:

t = get_timer( 0 )
t2 = get_timer( 1 ) / 64

transp( 256 )
pixi( img, 0, 0, 1, 0 )
transp( t )

//Make errors:
scr = 0
ep = 0
y = -hy while( y < hy ) {
	x = -hx while( x < hx ) {
//*** ONE ERROR ***
e = err[ ep ] & 7
p = ( y + hy ) * xsize + ( x + hx )
if e = 1 {
	fbox( x, y, err_xb, err_yb, scr[ p + t2 ] )
}
if e = 2 {
	effector( scr[ p + t2 ], 255, 0, x, y, err_xb, err_yb, 1 )
}
if e = 3 {
	effector( scr[ p + t2 ], 255, 0, x, y, err_xb, err_yb, 2 )	
}
if e = 4 {
	yy = 0 while( yy < err_yb ) {
		xx = 0 while( xx < err_xb ) {
			scr[ p ] = scr[ p + t2 ]
			p + 1
			xx + 1
		}
		p + xsize - err_xb
		yy + 1
	}
}
if e = 5 {
	yy = 0 while( yy < err_yb ) {
		xx = 0 while( xx < err_xb ) {
			scr[ p ] = scr[ p - t2 ]
			p + 1
			xx + 1
		}
		p + xsize - err_xb
		yy + 1
	}
}
if e = 6 {
	yy = 0 while( yy < err_yb ) {
		xx = 0 while( xx < err_xb ) {
			scr[ p ] = scr[ p + t2 ]
			p + 1
			xx + 1
		}
		p + xsize - err_xb
		yy + 1
	}
}
if e = 7 {
	if ( t2 / ep ) & 1 { fbox( x, y, err_xb, err_yb, get_dot( x, y + t2 ) ) }
}
//*** ********* ***
		ep + 1
		x + err_xb
	}
	y + err_yb
}

frame( 0 )

go start

Post Reply