Trekn-mixer 0.2
#9
Thumbs Up 
(12-06-2022, 01:56 AM)James D Jarvis Wrote: You could do triangle mapping for rotating the sprites. Did you track down RotoZoom ?  That works well.   
Not my subprogram and not sure if it's the best version:
Code: (Select All)
Sub RotoZoom2 (centerX As Long, centerY As Long, Image As Long, xScale As Single, yScale As Single, Rotation As Single)
    Dim px(3) As Single: Dim py(3) As Single
    W& = _Width(Image&): H& = _Height(Image&)
    px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
    px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
    sinr! = Sin(-Rotation): cosr! = Cos(-Rotation)
    For i& = 0 To 3
        x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + centerX: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + centerY
        px(i&) = x2&: py(i&) = y2&
    Next
    _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
    _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub


As for saving the screen image have you tried using the saveimage example from the wiki?  SAVEIMAGE - QB64 Phoenix Edition Wiki I use the clipboard myself because I usually have a paint app open and just paste a generated image into that.
Thank you for providing this example.

I have rewritten "SaveImage" to use "MID$" command to make it a bit faster, but I have to go look for it in my backups. I use it once in a while, and it does work on Linux. However, for your programs that create sprites, a better way is to use the "screen shot" function of the desktop. KDE Plasma has the best one, able to save to BMP as well as PNG, able to select only the area of the user program's window, and in a filename of the user's choice, rather than the entire viewport only as PNG into user home folder.

B$ = B$ + ... was very slow for 1024x768 when I first ran it on an old Toshiba laptop with WindowsXP and QB64 SDL.
Reply


Messages In This Thread
Trekn-mixer 0.2 - by James D Jarvis - 12-05-2022, 01:03 AM
RE: Trekn-mixer 0.2 - by James D Jarvis - 12-05-2022, 09:03 PM
RE: Trekn-mixer 0.2 - by bplus - 12-05-2022, 11:41 PM
RE: Trekn-mixer 0.2 - by Pete - 12-05-2022, 11:56 PM
RE: Trekn-mixer 0.2 - by mnrvovrfc - 12-06-2022, 12:26 AM
RE: Trekn-mixer 0.2 - by James D Jarvis - 12-06-2022, 01:56 AM
RE: Trekn-mixer 0.2 - by mnrvovrfc - 12-08-2022, 01:10 AM
RE: Trekn-mixer 0.2 - by mnrvovrfc - 12-09-2022, 10:13 AM
RE: Trekn-mixer 0.2 - by mnrvovrfc - 12-06-2022, 01:44 PM
RE: Trekn-mixer 0.2 - by James D Jarvis - 12-06-2022, 05:47 PM
RE: Trekn-mixer 0.2 - by CharlieJV - 12-10-2022, 03:32 AM
RE: Trekn-mixer 0.2 - by James D Jarvis - 07-20-2023, 01:28 PM
RE: Trekn-mixer 0.2 - by johnno56 - 07-20-2023, 08:37 PM
RE: Trekn-mixer 0.2 - by James D Jarvis - 07-20-2023, 10:17 PM
RE: Trekn-mixer 0.2 - by johnno56 - 07-21-2023, 02:48 AM
RE: Trekn-mixer 0.2 - by James D Jarvis - 07-21-2023, 03:53 AM



Users browsing this thread: 6 Guest(s)