< Previous | Contents | Next >
Process Sample
The Sample function iterates through each output pixel and gets a source pixel based on the Sine math function shifting the position. The output image is called avg
print ("Sample")
for y=0,img.Height-1 do for x=0,img.Width-1 do
xt = x - ( Amp * math.sin((y * XF) + OffS)) yt = y - ( Amp * math.sin((x * YF) + OffS)) if xt < 0 then xt =0 end
if xt > img.Width-1 then xt =img.Width-1 end if yt < 0 then yt =0 end
if yt > img.Height-1 then yt =img.Height-1 end img:SamplePixelB(xt,yt, sp)
dp.R = sp.R dp.G = sp.G dp.B = sp.B dp.A = sp.A
avg:SetPixel(x,y, dp)
end
end
