BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"funky square lens of distortion"
, by alias jargon
(exactly what i said)
Code
Function lens(img,radius) Local w=ImageWidth(img) Local h=ImageHeight(img) Local img2=CreateImage(w,h) Local t=0 SetBuffer ImageBuffer(img2) ClsColor 0,0,0 Cls For t=0 To w t2=circle(w/2,w/2-t) If t>w/2 Then t2=w-t2 DrawBlockRect img,t,0,t2,0,1,h Next SetBuffer BackBuffer() FreeImage img img=CopyImage(img2) SetBuffer ImageBuffer(img2) ClsColor 0,0,0 Cls For t=0 To h t2=circle(h/2,h/2-t) If t>h/2 Then t2=h-t2 DrawBlockRect img,0,t,0,t2,w,1 Next SetBuffer BackBuffer() FreeImage img Return img2 End Function Function circle(radius,x) Return ((1-(Float(x)/Float(radius))^2)^.5)*radius End Function
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations