How to RotoZoom (C2P & Drawing)
Posted: Thu Sep 17, 2009 1:53 pm
yet another fx, picture rotating and zooming in realtime
sources for drawing and c2p, datafields and tools for image include are HERE
Have Fun =)
Code: Select all
;**********************************************
;********** rotozoomer chunky2planar **********
;**********************************************
#Width = 320
#Height = 256
InitChunky(2,1,1)
InitBitMap(2)
InitPalette(0)
initScreen(0)
*TagList = InitTagList(100)
programpriority(10)
AllocateLinearBitMap(0,#Width,#Height,8)
AllocateChunkyBuffer(0,#Width,#Height)
AllocateChunkyBuffer(1,#Width,#Height)
ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP )
AddTag(#SA_BitMap, BitMapID())
OpenScreen(0,#Width,#Height,8,*TagList)
;we create the palette from our data
CreatePalette(0,32)
For i=0 To 192 Step 6
r.w=PeekW(?pal+(i))
g.w=PeekW(?pal+(i+2))
b.w=PeekW(?pal+(i+4))
palrgb(coli,r,g,b)
coli+1
Next
DisplayPalette(0,ScreenID())
UseBitMap(0) ;chunky bitmap
cb.w=1
Repeat
w.l=w+1 :If w>359:w=1:EndIf
sini = PeekL(?sintable+(w*4))
cosi = PeekL(?costable+(w*4))
z=800
cb.w=1-cb.w
UseChunkyBuffer(cb.w)
ChunkyCls(0)
For x = 1 To 180 Step 2
For y = 1 To 180 Step 2
u=(x*cosi-y*sini)/z
If u<0:u-u-u:EndIf
While u>128 ; Mod-befehl fake fuer amiga
u-128
Wend
v=(x*sini+y*cosi)/z
If v<0:v-v-v:EndIf
While v>128 ; Mod-cmd fake for amiga
v-128
Wend
colo=PeekW(?color+((u*129)+v)*2)
If colo>0
chunkyPlot(x,y,colo);colors(u,v))
EndIf
Next
Next
ChunkyToPlanar(ChunkyBufferID(),BitMapID(),#Height)
;VWait()
mb.w=MouseButtons()
Until mb.w=2
CloseScreen(0)
End
DisableDebugger
sintable:
IncludeBinary "dat/sin500"
costable:
IncludeBinary "dat/cos1000"
color:
IncludeBinary "dat/pic.dat"
pal:
IncludeBinary "dat/pic.pal"
EnableDebugger
sources for drawing and c2p, datafields and tools for image include are HERE
Have Fun =)