All pastes #257544 Raw Edit

Daurnimator

public lua v1 · immutable
#257544 ·published 2006-11-25 13:50 UTC
rendered paste body
mimage = Image.createEmpty(480,272)function drawGradient(origimage,x,y,width,height,colour1,colour2,turn)	image = Image.createEmpty(width,height)	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=0,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(0,i,width,i,Color.new(r,g,b,a))					end	else 		for i=0,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(i,0,i,height,Color.new(r,g,b,a))		end	end	origimage:blit(x,y,image)	return origimageendwhile true do	controls = Controls.read() 	if controls:start() then break end	mimage:drawLine(0,0,480,272,Color.new(255,0,0))			mimage  = drawGradient(mimage ,10,10,100,100,Color.new(0,0,0),Color.new(255,255,255))	mimage = drawGradient(mimage ,90,10,100,100,Color.new(255,0,0,100),Color.new(0,255,255,255),true)	screen:blit(0,0,mimage,true)	screen.waitVblankStart()	screen.flip()end