Page 1 of 1

How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 1:53 pm
by xperience2003
yet another fx, picture rotating and zooming in realtime

Image

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 =)

Re: How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 1:57 pm
by PB
I ran both your exes and got this error:

Image

No thanks.

Re: How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 1:59 pm
by eesau
PB wrote:I ran both your exes and got this error:
Did you try them on an Amiga?

Re: How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 2:16 pm
by PB
:lol: Damn PureBasic and its cross-platform code. I thought it was Windows code. I didn't notice it was posted in the Amiga section either.

Re: How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 2:17 pm
by eesau
PB wrote::lol: Damn PureBasic and its cross-platform code. I thought it was Windows code. I didn't notice it was posted in the Amiga section either. In my defense, I haven't seen an Amiga post here for years. :P
:)

Me neither, but I think it's great seeing people still coding for the Amiga!

Re: How to RotoZoom (C2P & Drawing)

Posted: Thu Sep 17, 2009 2:48 pm
by xperience2003
hehe


..and here the win32 conversion
http://www.digitalarts-egypt.com/amiga/rotozoomwin.rar

Re: How to RotoZoom (C2P & Drawing)

Posted: Fri Sep 18, 2009 10:46 pm
by xperience2003
please visit a smal introtest for pure aga - amigas
a smart logo + realtime rotozoomer (8x8 pixelblocks..shame on me^^)
but ultrafast..i hope
it uses 256colors aga screen 320x256 and the chunky engine

Image

24kb AMIGA exe

Re: How to RotoZoom (C2P & Drawing)

Posted: Fri Aug 27, 2010 11:12 pm
by stefff285
hi all

hello dear xp

as you agree me to touch to your code as a noob
i do change and put my gfx in to see what's up with

but i have problems with

pleaz help me dear members or others
because his code is goood

so the code with a palette prob

Code: Select all

;**********************************************
;********** rotozoomer drawing cmds ***********
;**********************************************


#Width  = 320
#Height = 256

InitBitMap(1)
InitPalette(0)
initScreen(0)
*TagList = InitTagList(100)

programpriority(10)

AllocateBitMap(1,#Width,#Height,4)
AllocateBitMap(0,#Width,#Height,4)

ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP )
AddTag(#SA_BitMap, BitMapID())
OpenScreen(0,#Width,#Height,4,*TagList)
 
CreatePalette(0,16)

For i=0 To 15 Step 1
  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) 
cb.w=1
    
Repeat
   w=w+1 :If w>360:w=0:EndIf
   sini = PeekL(?sintable+(w*4)) 
   cosi = PeekL(?costable+(w*4))
   z.l=800
    
   VWait()
   ShowBitMap(cb,ScreenID(),0,0)
   
   cb.w=1-cb.w
   UseBitMap(cb)
   drawingoutput(bitmaprastport())
   Cls(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.w=(x*sini+y*cosi)/z
      
      If v<0:v-v-v:EndIf
      While v>128 ; Mod-befehl fake fuer amiga
        v-128
      Wend 
   
      colo=PeekW(?color+((u*129)+v)*2)
     
      If colo>1
        FrontColour(colo)     
        Plot(x,y) ;:Plot(x+1,y)
        ;BoxFill(x,y,5,5)
      EndIf
   
     Next
   Next
   ;
    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



; IDE Options = PureBasic 4.xx amiga os
; CursorPosition = 97
; Folding = -
; MainProcessor=1
; Optimizations=1
; CommentedSource=0
; CreateIcon=0
; NoCliOutput=0
; Executable=purebasic:/chunky/rotozoom/ChunkyRotoZoom.exe
; Debugger=0
; EnableASM=0

and of course i come back with an archive of it in zip

regards to all

yog as steff


edit 1: here is the zip

http://yoursteff.lautre.net/PBrotozoom.zip