-- gradient blend in lua -- -- and a quite strange blend,. but this was what I -- ended up coding here x1=0.25*width y1=0.25*height x2=0.75*width y2=0.75*height function dist(x1,y1,x2,y2) local dist= math.sqrt( (x2-x1)^2+(y2-y1)^2 ) return dist end function blend_radial(x1,y1,x2,y2) local length=dist(x1,y1,x2,y2) local x,y print(x1,y1,x2,y2) for y = 0, height-1 do for x = 0, width-1 do local v=dist(x,y,x2,y2)/length set_value(x,y, v) end progress(y/height) end end function blend_strange(x1,y1,x2,y2) local length=dist(x1,y1,x2,y2) local x,y for y = 0, height-1 do for x = 0, width-1 do local tostart=dist(x,y,x1,y1) local toend=dist(x,y,x2,y2) local sum=tostart+toend local v=tostart/sum set_value(x,y, v) end progress(y/height) end end -- pippin didn't bother sitting down with pen paper -- and think about the right math for this,.. thus ended up -- without a real linear blend blend_strange(x1,y1,x2,y2)