Sync On:Sync Rate 60:Autocam Off
 
`Set effect area
Global ax=100
Global ay=100
Global al as Float
 
Position Mouse Screen Width()/2,Screen Height()/2
 
 
Get Image 1,0,0,ax,ay,1
Make Memblock From Image 1,1
Make Memblock From Image 2,1
Make Image From Memblock 2,2
Null = Make Vector2(1)
Set Vector2 1,ax/2,ay/2
al=Squared Length Vector2(1)
 
 
Make Object Cube 1,2
Position Object 1,-3,0,10
Make Object Sphere 2,2
Position Object 2,3,0,8
 
Do
   Center Text Screen Width()/2.0,100,"HELLO WORLD"
   Update_Mouse_Area()
   Sprite 2,MouseX()-ax/2,MouseY()-ay/2,2
   Sync
Loop
 
 
Function Update_Mouse_Area()
   p1 as Dword
   p2 as Dword
   c as Dword
   x=MouseX():y=MouseY()
   if x<(ax/2+1) or x>Screen Width()-(ax/2+1) Then Exitfunction
   If y<(ay/2+1) or y>Screen Width()-(ay/2+1) Then ExitFunction
   Get Image 1,MouseX()-(ax/2),MouseY()-(ay/2),MouseX()+(ax/2),MouseY()+(ay/2),1
   Make Memblock From Image 1,1
   For y1=0 to Memblock_Height(1)
      For x1=0 To Memblock_Width(1)
         Set Vector2 1,ax/2-x1,ay/2-y1
         l#=Squared Length Vector2(1)/al
         x2=x1*l#
         y2=y1*l#
         p=Get_Pixel_Pos(x2,y2,1)
         if p<Get Memblock Size(1) and p>0
            c=Memblock DWord(1,p)
         Endif
         p2=Get_Pixel_Pos(x1,y1,2)
         if p2<Get Memblock Size(2) and p2>0
            Write Memblock DWord 2,p2,c
         Endif
      Next x1
   Next y1
   Make Image From Memblock 2,2
Endfunction
 
 
 
 
 
 
 
 
 
Function Memblock_Width(MemblockID)
   If Memblock Exist(MemblockID)=0 then Exitfunction 0
   If Get Memblock Size(MemblockID)<12 then exitfunction 0
   w=Memblock Dword(MemblockID,0)
Endfunction w
 
Function Memblock_Height(MemblockID)
   If Memblock Exist(MemblockID)=0 then Exitfunction 0
   If Get Memblock Size(MemblockID)<12 then exitfunction 0
   h=Memblock Dword(MemblockID,4)
Endfunction h
 
Function Memblock_Depth(MemblockID)
   If Memblock Exist(MemblockID)=0 then Exitfunction 0
   If Get Memblock Size(MemblockID)<12 then exitfunction 0
   d=Memblock Dword(MemblockID,8)
Endfunction d
 
Function Get_Pixel_Pos(x,y,MemblockID)
   p as dword
   p=0
   if Memblock Exist(MemblockID)=0 Then Exitfunction p
   w=Memblock_Width(MemblockID)
   h=Memblock_Height(MemblockID)
   d=Memblock_Depth(MemblockID)
   p=y*(w*(d/8))+x*(d/8)
   max as dword
   max = h*w*(d/8)
   if p>Get Memblock Size(MemblockID)-1
      p=Get Memblock Size(MemblockID)-1
   endif
   p=p+12
   if p<12 then p=12
Endfunction p