It is currently Mon Sep 23, 2019 9:12 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 1:53 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
yet another fx, picture rotating and zooming in realtime

Image

Code:
;**********************************************
;********** 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 =)

_________________
Kultstudio


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 1:57 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
I ran both your exes and got this error:

Image

No thanks.

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 1:59 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 27, 2007 12:38 pm
Posts: 589
Location: Finland
PB wrote:
I ran both your exes and got this error:

Did you try them on an Amiga?


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 2:16 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
: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.

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 2:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 27, 2007 12:38 pm
Posts: 589
Location: Finland
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Thu Sep 17, 2009 2:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
hehe


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

_________________
Kultstudio


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Fri Sep 18, 2009 10:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
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

_________________
Kultstudio


Top
 Profile  
Reply with quote  
 Post subject: Re: How to RotoZoom (C2P & Drawing)
PostPosted: Fri Aug 27, 2010 11:12 pm 
Offline
User
User
User avatar

Joined: Mon Nov 09, 2009 3:51 pm
Posts: 36
Location: france (21)
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:
;**********************************************
;********** 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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye