Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Bitmap Rotation

  1. #1
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56

    Bitmap Rotation

    Hi,


    This is a bitmap rotation test.
    My rotation algorithm isn't hardware and for this reason not fast enough.


    Is there anyone who knows a faster algorithm?
    Uses "ui","math"
    #INCLUDE "abc.inc"
    
    
    DWord hdc, hwnd
    hwnd = Canvas_Window("ROTATE",xMiddle(400),yMiddle(240),400,240)
    Canvas_Attach(hwnd,0,%TRUE) 
    
    
    hdc = Canvas_GetDC() 
    SetHandleDC hdc
    SetFont 18,18,%FW_BOLD,""
    
    
    Dim av(6) As Single 
    Dim aw(6) As Single 
    Long b2, x, y
    
    
    For x=1 To 6
        av(x) = Rand(6,10)
        aw(x) = av(x)
    Next
    
    
    b2 = LoadBmp "img/angel.bmp",1
    
    
    While IsWindow(hwnd) And KeyDown(27)=0 
       Canvas_Clear 0
       For x=1 To 6
           RotBitmap b2,x*64-64,y*64+60,av(x)
           RotBitmap b2,x*64-64,y*64+130,-av(x)
       Next   
      
       For x=1 To 6
           av(x) += aw(x)
           If av(x) >=360 Then av(x)= aw(x)
       Next
      
       DrawText 60,20,"BITMAP ROTATION",255+255*256+255*65536
       Canvas_Redraw
      'Sleep 10 
    Wend
    FreeGraphic
    Canvas_Window End
    
    Last edited by peter; 31-05-2015 at 00:41.

  2. #2
    Hi Peter,

    1. I'm sorry to say it but your code is again incompatible with the contents of your zip. Please fix
    b2 = LoadBmp "img/angel.bmp",1
    
    to
    b2 = LoadBmp ".\bmp\angel.bmp",1
    
    or you're likely to be waiting for an answer to your questions until the Second Coming...

    2. Your code doesn't contain any "algorithm". The algorithm is in fact hidden in the black box called "abc.dll".

    3. By my personal experience, you won't be able to rotate a picture real fast and smoothly irrespective of its size unless abc.dll implements its rotation algorithm, whatever it is, in highly optimized hand-written assembly or is at least compiled by a really intelligent static C compiler capable of optimizing C code written with such an optimization in mind. Then rotation can be made not only smooth and fast but also anti-aliased. Either way, programmatic rotation is unlikely to have FPS rates higher than perhaps a hundred frames per second for a single picture, to say nothing of rotating a dozen pictures simultaneously.

    4. You can break that barrier programmatically only if you use hardware-assisted DirectX or OpenGL implementations, which is of course beyond the scope of this topic.

    5. The only feasible way out of the situation under the circumstances is to use sprites that have detailed rotation phases pre-rendered.

    Hope that answers your question. A negative answer is also an answer of a sort.
    Last edited by mike lobanovsky; 22-11-2013 at 10:22.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  3. #3
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    Hello Mike,


    You can break that barrier programmatically only if you use hardware-assisted DirectX or OpenGL implementations


    DirectX or OpenGl, no problem, but i am a (Do it yourself) programmer.


    I'm sorry to say it but your code is again incompatible with the contents of your zip


    Next times, I will take `.rar
    To be honest, I have no problems with the content of a zip file.


    I put everything in my ThinBasic directory, and I do not know this problems, what you are telling here.

  4. #4
    Peter,


    Quote Originally Posted by peter View Post
    I'm sorry to say it but your code is again incompatible with the contents of your zip
    Next times, I will take `.rar
    To be honest, I have no problems with the content of a zip file.
    It seems you do not understand the true meaning of my remark. It is not a question of a ZIP or a RAR or an ARC or a PAK or a 7Z. I can uncompress any of them, and much more. But when I do uncompress them, I am not supposed to debug your code which you publish here in order to make it compatible with the internal structure of the archive which you also attach here your own self. The maximum you can expect of me, or any other forum member, is click your script file to see if it runs at all. If it doesn't, then it is entirely my own choice if I continue looking into it or not. In order for me to be willing to spend more of my time and continue looking into it, I must be perfectly sure you did everything you could to avoid or amend your own bugs and typos. But if all I'm seeing is just pure neglect of the subject matter of my messages here and here: http://www.thinbasic.com/community/s...0291#post90291 , then I will most probably lack interest in any further discussion.

    Quote Originally Posted by peter View Post
    I put everything in my ThinBasic directory, and I do not know this problems, what you are telling here.
    But you shouldn't expect me to be equally happy about bloating my TB directory with code and executable modules of unknown origin and questionable quality.

    Now let me tell you once again, here and now, the code you published is not going to run on your PC either, whether you put everything in your TB directory or not, until you either 1. change your "img/angel.bmp" to at least "bmp\angel.bmp"; or 2. rename the \Bmp directory in your zip to \Img. But do not expect me to do it for you. It would have been much more natural if you did it for me and everybody else before commenting on my message.

    Quote Originally Posted by peter View Post
    DirectX or OpenGl, no problem, but i am a (Do it yourself) programmer.
    Let me assure you there is a problem with either of these for a self-made programmer. So your best bet would be to consider TBGL and start learning it by the excellent examples which are plentiful both on this forum and in the distro.


    Regards,
    Last edited by mike lobanovsky; 22-11-2013 at 14:20.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  5. #5
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    Dear Mike,


    I am not willing to change something, what I have done in the last 100 years.
    If you do not like it, don't read my source code. (post)


    I am really not your enemy, who sends you heavy puzzles.
    This theme ends now here.

  6. #6
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    29
    Peter,

    Why do you name all your attachments "abc.zip?" You posted
    one yesterday with different content.

    Bill

  7. #7
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    Billbo,

    Why not ? Is the same like def.zip or xyz.zip

  8. #8
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    29
    Peter,

    The files def.zip and xyz.zip are not the same.

    Just because you have 316 posts does not make me stupid.
    The files def.zip or xyz.zip have the same extensions, but
    not the same file names. I was speaking of the "abc."

    What does a abc.zip of 16kb+ and an abc.zip of 206kb+
    have in common? Doesn't tell you crap other than the two
    have the same name and different size; and you can't
    put them in the same directory.

    Ever wonder why programs have version numbers?

    I do not appreciate what I read as an implied insult.

    Bill

  9. #9

  10. #10
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    damned,


    Is a little bit unfriendly here, I think.
    The name "abc.zip" is always identic, because its content has always the new updated "abc.dll" and "abc.inc".


    There is no need for another name.
    You unzip this "abc.zip" and put it into your directory, where you have your ThinBasic or something else.


    Do not put this "abc.zip" in your directory!
    By the way, I have heard your unfriendliness. I am not your punster!

Page 1 of 2 12 LastLast

Similar Threads

  1. Bitmap Rotation
    By peter in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 18-10-2012, 18:02
  2. World Matrix Rotation
    By Dylan in forum WCHS thinBasic gaming forum
    Replies: 8
    Last Post: 11-11-2010, 16:38
  3. Rotation problem
    By zak in forum TBGL General
    Replies: 4
    Last Post: 19-01-2009, 18:43
  4. bitmap font
    By kryton9 in forum TBGL General
    Replies: 6
    Last Post: 26-04-2007, 20:53

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •