All pastes #257527 Raw Edit

Daurnimator

public lua v1 · immutable
#257527 ·published 2006-11-25 13:25 UTC
rendered paste body
function drawGradient(image,x,y,height,width,colour1,colour2,turn)	colours1 = colour1:colors()	colours2 = colour2:colors()	wr = colours2.r-colours1.r	wg = colours2.g-colours1.g	wb = colours2.b-colours1.b	wa = colours2.a-colours1.a	if turn then		for i=1,height do			r = wr/height*i+colours1.r			g = wg/height*i+colours1.g			b = wb/height*i+colours1.b			a = wa/height*i+colours1.a			image:drawLine(x,y+i,x+width,y+i,Color.new(r,g,b,a))					end	else 		for i=1,width do			local r,g,b			r = wr/width*i+colours1.r			g = wg/width*i+colours1.g			b = wb/width*i+colours1.b			a = wa/width*i+colours1.a			image:drawLine(x+i,y,x+i,y+height,Color.new(r,g,b,a))		end	end	return imageendwhile true do	controls = Controls.read() 	if controls:start() then break end	screen:drawLine(0,0,480,272,Color.new(255,0,0))			screen = drawGradient(screen,10,10,100,100,Color.new(0,0,0),Color.new(255,255,255))	screen = drawGradient(screen,90,10,100,100,Color.new(255,0,0,100),Color.new(0,255,255,255),true)	screen.waitVblankStart()	screen.flip()end