Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64PE v4.0 is now live!!
#21
I am guessing from the image that you want to get the max of 3 numbers.

Code: (Select All)
maxOfThree = _IIF(a > b, _IIF(a > c, a, c), _IIF(b > c, b, c))
Reply
#22
Steve!! Your speed test for graphics quit working with qn64pe v4.0.0!

First, the error message in compilelog.txt:
------------------------------------
internal\c\c_compiler\bin\c++.exe -O2 -std=gnu++17 -fno-strict-aliasing -Wno-conversion-null -DGLEW_STATIC -DFREEGLUT_STATIC -Iinternal\c\libqb/include -Iinternal\c/parts/core/freeglut/include -Iinternal\c/parts/core/glew/include -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal\c/qbx.cpp -c -o internal\c/qbx.o
In file included from internal\c/qbx.cpp:1743:
internal\c/../temp/main.txt:255:90: error: arithmetic on a pointer to void
255 | memmove(_SUB_SAVE32_STRING3_TEMP->chr,(void*)*(ptrszint*)(((char*)_SUB_SAVE32_UDT_M)+(0))+(((*_SUB_SAVE32_LONG_W**_SUB_SAVE32_LONG_Y)+*_SUB_SAVE32_LONG_X)* 4 ),3);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1 error generated.
mingw32-make: *** [Makefile:407: internal\c/qbx.o] Error 1
-----------------------------------------------------

Seems to me that this mingw32-make has to be modofied for the new compiler, yes?

Then your code:

Code: (Select All)
Screen _NewImage(1280, 720, 32)
Cls , _RGB32(255, 255, 0)

For i = 1 To 20
    Line (Rnd * 1280, Rnd * 720)-(Rnd * 1280, Rnd * 720), _RGB32(Rnd * 256, Rnd * 256, Rnd * 256), BF
Next


t# = Timer
Save32 0, 0, 1279, 719, 0, "temp.bmp"
t1# = Timer
ThirtyTwoBit 0, 0, 1279, 719, 0, "temp2.bmp"
t2# = Timer
Print Using "###.### seconds with Save32"; t1# - t#
Print Using "###.### seconds with ThirtyTwoBit"; t2# - t1#
'KILL "temp.bmp"
'KILL "temp2.bmp"


Sub Save32 (x1%, y1%, x2%, y2%, image&, Filename$)
    'Super special STEVE-Approved BMP Export routine for use with 32-bit color images.


    Type BMPFormat ' Description                          Bytes    QB64 Function
        ID As String * 2 ' File ID("BM" text or 19778 AS Integer) 2      CVI("BM")
        Size As Long ' Total Size of the file                4      LOF
        Blank As Long ' Reserved                              4
        Offset As Long ' Start offset of image pixel data      4      (add one for GET)
        Hsize As Long ' Info header size (always 40)          4
        PWidth As Long ' Image width                            4      _WIDTH(handle&)
        PDepth As Long ' Image height (doubled in icons)        4      _HEIGHT(handle&)
        Planes As Integer ' Number of planes (normally 1)          2
        BPP As Integer ' Bits per pixel(palette 1, 4, 8, 24)    2      _PIXELSIZE(handle&)
        Compression As Long ' Compression type(normally 0)          4
        ImageBytes As Long ' (Width + padder) * Height              4
        Xres As Long ' Width in PELS per metre(normally 0)    4
        Yres As Long ' Depth in PELS per metre(normally 0)    4
        NumColors As Long ' Number of Colors(normally 0)          4      2 ^ BPP
        SigColors As Long ' Significant Colors(normally 0)        4
    End Type '                Total Header bytes =  54

    Dim BMP As BMPFormat
    Dim x As Long, y As Long
    Dim temp As String * 3
    Dim m As _MEM, n As _MEM
    Dim o As _Offset
    m = _MemImage(image&)
    Dim Colors8%(255)

    If x1% > x2% Then Swap x1%, x2%
    If y1% > y2% Then Swap y1%, y2%
    _Source image&
    pixelbytes& = 4
    OffsetBITS& = 54 'no palette in 24/32 bit
    BPP% = 24
    NumColors& = 0 '24/32 bit say zero
    BMP.PWidth = (x2% - x1%) + 1
    BMP.PDepth = (y2% - y1%) + 1

    ImageSize& = BMP.PWidth * BMP.PDepth

    BMP.ID = "BM"
    BMP.Size = ImageSize& * 3 + 54
    BMP.Blank = 0
    BMP.Offset = 54
    BMP.Hsize = 40
    BMP.Planes = 1
    BMP.BPP = 24
    BMP.Compression = 0
    BMP.ImageBytes = ImageSize&
    BMP.Xres = 3780
    BMP.Yres = 3780
    BMP.NumColors = 0
    BMP.SigColors = 0

    Compression& = 0
    WidthPELS& = 3780
    DepthPELS& = 3780
    SigColors& = 0
    f = FreeFile
    n = _MemNew(BMP.Size)
    _MemPut n, n.OFFSET, BMP
    o = n.OFFSET + 54

    $Checking:Off
    y = y2% + 1
    w& = _Width(image&)
    Do
        y = y - 1: x = x1% - 1
        Do
            x = x + 1
            _MemGet m, m.OFFSET + (w& * y + x) * 4, temp
            _MemPut n, o, temp
            o = o + 3
        Loop Until x = x2%
    Loop Until y = y1%
    $Checking:On
    _MemFree m
    Open Filename$ For Binary As #f
    t$ = Space$(BMP.Size)
    _MemGet n, n.OFFSET, t$
    Put #f, , t$
    _MemFree n
    Close #f
End Sub


Sub ThirtyTwoBit (x1%, y1%, x2%, y2%, image&, Filename$)
    Dim Colors8%(255)
    If x1% > x2% Then Swap x1%, x2%
    If y1% > y2% Then Swap y1%, y2%
    _Source image&
    pixelbytes& = _PixelSize(image&)
    If pixelbytes& = 0 Then Beep: Exit Sub 'no text screens

    FileType$ = "BM"
    QB64$ = "QB64" 'free advertiising in reserved bytes
    If pixelbytes& = 1 Then OffsetBITS& = 1078 Else OffsetBITS& = 54 'no palette in 24/32 bit
    InfoHEADER& = 40
    PictureWidth& = (x2% - x1%) + 1
    PictureDepth& = (y2% - y1%) + 1
    NumPLANES% = 1
    If pixelbytes& = 1 Then BPP% = 8 Else BPP% = 24
    Compression& = 0
    WidthPELS& = 3780
    DepthPELS& = 3780

    If pixelbytes& = 1 Then 'byte padder prevents image skewing
        NumColors& = 256 'set 256 colors even if they are not used by the screen mode
        If (PictureWidth& Mod 4) Then ZeroPad$ = Space$(4 - (PictureWidth& Mod 4))
    Else '24/32 bit images use 3 bytes for RGB pixel values
        NumColors& = 0 '24/32 bit say zero
        If ((PictureWidth& * 3) Mod 4) Then ZeroPad$ = Space$((4 - ((PictureWidth& * 3) Mod 4)))
    End If

    ImageSize& = (PictureWidth& + Len(ZeroPad$)) * PictureDepth&
    FileSize& = ImageSize& + OffsetBITS&
    f = FreeFile
    Open Filename$ For Binary As #f

    Put #f, , FileType$
    Put #f, , FileSize&
    Put #f, , QB64$
    Put #f, , OffsetBITS&
    Put #f, , InfoHEADER&
    Put #f, , PictureWidth&
    Put #f, , PictureDepth&
    Put #f, , NumPLANES%
    Put #f, , BPP%
    Put #f, , Compression&
    Put #f, , ImageSize&
    Put #f, , WidthPELS&
    Put #f, , DepthPELS&
    Put #f, , NumColors&
    Put #f, , SigColors& '51 offset

    If pixelbytes& = 1 Then '4 or 8 BPP use 256 color Palette
        u$ = Chr$(0)
        For c& = 0 To 255 'PUT as BGR order colors
            cv& = _PaletteColor(c&, image&)
            Colr$ = Chr$(_Blue32(cv&))
            Put #f, , Colr$
            Colr$ = Chr$(_Green32(cv&))
            Put #f, , Colr$
            Colr$ = Chr$(_Red32(cv&))
            Put #f, , Colr$
            Put #f, , u$ 'Unused byte
        Next
    End If

    For y% = y2% To y1% Step -1 'place bottom up
        For x% = x1% To x2%
            c& = Point(x%, y%)
            If pixelbytes& = 1 Then
                a$ = Chr$(c&)
                Colors8%(c&) = 1
            Else: a$ = Left$(MKL$(c&), 3)
            End If
            Put #f, , a$
        Next
        Put #f, , ZeroPad$
    Next

    For n = 0 To 255
        If Colors8%(n) = 1 Then SigColors& = SigColors& + 1
    Next n
    Put #f, 51, SigColors&
    Close #f
End Sub
Reply
#23
(12-17-2024, 10:04 PM)bert22306 Wrote: Steve!! Your speed test for graphics quit working with qn64pe v4.0.0!

First, the error message in compilelog.txt:
------------------------------------
internal\c\c_compiler\bin\c++.exe -O2 -std=gnu++17 -fno-strict-aliasing -Wno-conversion-null -DGLEW_STATIC -DFREEGLUT_STATIC -Iinternal\c\libqb/include -Iinternal\c/parts/core/freeglut/include -Iinternal\c/parts/core/glew/include -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal\c/qbx.cpp -c -o internal\c/qbx.o
In file included from internal\c/qbx.cpp:1743:
internal\c/../temp/main.txt:255:90: error: arithmetic on a pointer to void
  255 | memmove(_SUB_SAVE32_STRING3_TEMP->chr,(void*)*(ptrszint*)(((char*)_SUB_SAVE32_UDT_M)+(0))+(((*_SUB_SAVE32_LONG_W**_SUB_SAVE32_LONG_Y)+*_SUB_SAVE32_LONG_X)* 4 ),3);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1 error generated.
mingw32-make: *** [Makefile:407: internal\c/qbx.o] Error 1
-----------------------------------------------------

Seems to me that this mingw32-make has to be modofied for the new compiler, yes?

Then your code:

Code: (Select All)
Screen _NewImage(1280, 720, 32)
Cls , _RGB32(255, 255, 0)

For i = 1 To 20
    Line (Rnd * 1280, Rnd * 720)-(Rnd * 1280, Rnd * 720), _RGB32(Rnd * 256, Rnd * 256, Rnd * 256), BF
Next


t# = Timer
Save32 0, 0, 1279, 719, 0, "temp.bmp"
t1# = Timer
ThirtyTwoBit 0, 0, 1279, 719, 0, "temp2.bmp"
t2# = Timer
Print Using "###.### seconds with Save32"; t1# - t#
Print Using "###.### seconds with ThirtyTwoBit"; t2# - t1#
'KILL "temp.bmp"
'KILL "temp2.bmp"


Sub Save32 (x1%, y1%, x2%, y2%, image&, Filename$)
    'Super special STEVE-Approved BMP Export routine for use with 32-bit color images.


    Type BMPFormat ' Description                          Bytes    QB64 Function
        ID As String * 2 ' File ID("BM" text or 19778 AS Integer) 2      CVI("BM")
        Size As Long ' Total Size of the file                4      LOF
        Blank As Long ' Reserved                              4
        Offset As Long ' Start offset of image pixel data      4      (add one for GET)
        Hsize As Long ' Info header size (always 40)          4
        PWidth As Long ' Image width                            4      _WIDTH(handle&)
        PDepth As Long ' Image height (doubled in icons)        4      _HEIGHT(handle&)
        Planes As Integer ' Number of planes (normally 1)          2
        BPP As Integer ' Bits per pixel(palette 1, 4, 8, 24)    2      _PIXELSIZE(handle&)
        Compression As Long ' Compression type(normally 0)          4
        ImageBytes As Long ' (Width + padder) * Height              4
        Xres As Long ' Width in PELS per metre(normally 0)    4
        Yres As Long ' Depth in PELS per metre(normally 0)    4
        NumColors As Long ' Number of Colors(normally 0)          4      2 ^ BPP
        SigColors As Long ' Significant Colors(normally 0)        4
    End Type '                Total Header bytes =  54

    Dim BMP As BMPFormat
    Dim x As Long, y As Long
    Dim temp As String * 3
    Dim m As _MEM, n As _MEM
    Dim o As _Offset
    m = _MemImage(image&)
    Dim Colors8%(255)

    If x1% > x2% Then Swap x1%, x2%
    If y1% > y2% Then Swap y1%, y2%
    _Source image&
    pixelbytes& = 4
    OffsetBITS& = 54 'no palette in 24/32 bit
    BPP% = 24
    NumColors& = 0 '24/32 bit say zero
    BMP.PWidth = (x2% - x1%) + 1
    BMP.PDepth = (y2% - y1%) + 1

    ImageSize& = BMP.PWidth * BMP.PDepth

    BMP.ID = "BM"
    BMP.Size = ImageSize& * 3 + 54
    BMP.Blank = 0
    BMP.Offset = 54
    BMP.Hsize = 40
    BMP.Planes = 1
    BMP.BPP = 24
    BMP.Compression = 0
    BMP.ImageBytes = ImageSize&
    BMP.Xres = 3780
    BMP.Yres = 3780
    BMP.NumColors = 0
    BMP.SigColors = 0

    Compression& = 0
    WidthPELS& = 3780
    DepthPELS& = 3780
    SigColors& = 0
    f = FreeFile
    n = _MemNew(BMP.Size)
    _MemPut n, n.OFFSET, BMP
    o = n.OFFSET + 54

    $Checking:Off
    y = y2% + 1
    w& = _Width(image&)
    Do
        y = y - 1: x = x1% - 1
        Do
            x = x + 1
            _MemGet m, m.OFFSET + (w& * y + x) * 4, temp
            _MemPut n, o, temp
            o = o + 3
        Loop Until x = x2%
    Loop Until y = y1%
    $Checking:On
    _MemFree m
    Open Filename$ For Binary As #f
    t$ = Space$(BMP.Size)
    _MemGet n, n.OFFSET, t$
    Put #f, , t$
    _MemFree n
    Close #f
End Sub


Sub ThirtyTwoBit (x1%, y1%, x2%, y2%, image&, Filename$)
    Dim Colors8%(255)
    If x1% > x2% Then Swap x1%, x2%
    If y1% > y2% Then Swap y1%, y2%
    _Source image&
    pixelbytes& = _PixelSize(image&)
    If pixelbytes& = 0 Then Beep: Exit Sub 'no text screens

    FileType$ = "BM"
    QB64$ = "QB64" 'free advertiising in reserved bytes
    If pixelbytes& = 1 Then OffsetBITS& = 1078 Else OffsetBITS& = 54 'no palette in 24/32 bit
    InfoHEADER& = 40
    PictureWidth& = (x2% - x1%) + 1
    PictureDepth& = (y2% - y1%) + 1
    NumPLANES% = 1
    If pixelbytes& = 1 Then BPP% = 8 Else BPP% = 24
    Compression& = 0
    WidthPELS& = 3780
    DepthPELS& = 3780

    If pixelbytes& = 1 Then 'byte padder prevents image skewing
        NumColors& = 256 'set 256 colors even if they are not used by the screen mode
        If (PictureWidth& Mod 4) Then ZeroPad$ = Space$(4 - (PictureWidth& Mod 4))
    Else '24/32 bit images use 3 bytes for RGB pixel values
        NumColors& = 0 '24/32 bit say zero
        If ((PictureWidth& * 3) Mod 4) Then ZeroPad$ = Space$((4 - ((PictureWidth& * 3) Mod 4)))
    End If

    ImageSize& = (PictureWidth& + Len(ZeroPad$)) * PictureDepth&
    FileSize& = ImageSize& + OffsetBITS&
    f = FreeFile
    Open Filename$ For Binary As #f

    Put #f, , FileType$
    Put #f, , FileSize&
    Put #f, , QB64$
    Put #f, , OffsetBITS&
    Put #f, , InfoHEADER&
    Put #f, , PictureWidth&
    Put #f, , PictureDepth&
    Put #f, , NumPLANES%
    Put #f, , BPP%
    Put #f, , Compression&
    Put #f, , ImageSize&
    Put #f, , WidthPELS&
    Put #f, , DepthPELS&
    Put #f, , NumColors&
    Put #f, , SigColors& '51 offset

    If pixelbytes& = 1 Then '4 or 8 BPP use 256 color Palette
        u$ = Chr$(0)
        For c& = 0 To 255 'PUT as BGR order colors
            cv& = _PaletteColor(c&, image&)
            Colr$ = Chr$(_Blue32(cv&))
            Put #f, , Colr$
            Colr$ = Chr$(_Green32(cv&))
            Put #f, , Colr$
            Colr$ = Chr$(_Red32(cv&))
            Put #f, , Colr$
            Put #f, , u$ 'Unused byte
        Next
    End If

    For y% = y2% To y1% Step -1 'place bottom up
        For x% = x1% To x2%
            c& = Point(x%, y%)
            If pixelbytes& = 1 Then
                a$ = Chr$(c&)
                Colors8%(c&) = 1
            Else: a$ = Left$(MKL$(c&), 3)
            End If
            Put #f, , a$
        Next
        Put #f, , ZeroPad$
    Next

    For n = 0 To 255
        If Colors8%(n) = 1 Then SigColors& = SigColors& + 1
    Next n
    Put #f, 51, SigColors&
    Close #f
End Sub

Yep.  You found a glitch that we overlooked when swapping out to the new compiler.  (The issue is that _memput has two different behaviors for when $Checking is on or off...  we just apparently overlooked the $Checking:Off output here and didn't update to the proper changes that we need to.)

Two quick fixes for this:

1) Turn $CHECKING:OFF... well, off.   Just remark out that line and recompile and it should work without any issues.

2) That that middle argument and encase it in parenthesis, like so on line 92:

Code: (Select All)
            _MemGet m, (m.OFFSET + (w& * y + x) * 4), temp

Both *fixes* will allow you to temporarily bypass the glitch, and we'll fix the problem and push it into the next release so it won't be an issue in the future.

Thanks for finding and pointing this out to us! We're only human, and when things get separated and broke into different segments and such like this has, it's easy to just overlook a simple change and then miss it when testing for it. Good news is the dev team is now on it and should have it patched up ASAP and fixed before long.
Reply
#24
Thanks, dev guys! And, technically it was your program that found the glitch, Steve.
Reply
#25
I just downloaded and extracted v4.0

I got this message after extraction:
   

Is this going to be trouble? haven't tested anything yet, but looks like troubles ahead.


--------------------------------------------------------------------------------------------------

Update: everything looks to be OK.

I love that all the settings from previous version can be loaded into the new!

Thankyou Thankyou Thankyou for that!

Just one point missed, I think you have to reset the limit of Storage for Recent Files BEFORE you use the old version configuration. I only got 20 recent files copied over to the new version but seeing all the time saved not configuring everything else, you are forgiven Big Grin
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#26
Have you downloaded the latest version of 7z?  Older versions aren't up to date with the latest zip routines and are glitching out.   Grab the new version and try again, and report back.
Reply
#27
(12-26-2024, 03:00 PM)SMcNeill Wrote: Have you downloaded the latest version of 7z?  Older versions aren't up to date with the latest zip routines and are glitching out.   Grab the new version and try again, and report back.

Do I need it? I've tested some files, it seems to be working OK.

But probably good idea to get latest update... on it now.

-----------------------------------------------------------------------------------------

Update: OK the extraction with updated 7z went without a hitch.

BUT I see I can't reset the Limit on Recent Files Storage BEFORE I reconfigure the New Version using the last Version so I loose the complete set of recent files. (Better than all of the top 20 but still...)

PS last version I was using was before Recent Files Storage Limit became an option. So if it can pick that up on Newer versions we are Gold!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#28
Quote:@bplus - I just downloaded and extracted v4.0 -- I got this message after extraction:
My God, Walther!  Rolleyes

https://qb64phoenix.com/forum/showthread...5#pid30385
Reply
#29
Yeah I noticed the German looks very similar.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#30
again thank you for the present near the end of the year.  happy new year!

if galleon really returned, he would have to be surprised with how much qb64 has expanded or bloated depending on your point of view.

i wish i could reproduce this to be able to show you something about it, but i discovered an annoying thing done by qb64pe 4.0.  with the ide.  i'm using debian linux, tried this with mate "bookworm" base, and with kde with the "oldstable".  when the user does agree to select a separate qb64pe installation to pick up the settings, it could set the screen size wrong.  so i feel thrown back to 3.4 or earlier.  for example, if my installation of 3.13 (because i never downloaded 3.14) opened first with the big window, after migrating settings to 4.0, i expect the ide of 4.0 to give me the same big window.  sadly i was forced to ignore the offer to transfer settings so i could keep getting the big window.

if the ide of 4.0 gives me the small window, i have to erase entirely the configuration folder it created, and also the older qb64pe installation.  then try again to run "qb64pe" 4.0 executable without arguments, say no to the offer to migrate settings.  then i have a big window like before.

also after i reject the offer and change some things in the options menu, the ide still marks the empty document as modified.  i thought that was fixed earlier.  i'm sorry for reading wrong in this forum sometimes.

one question.  is the dialog box supposed to stick up near the top?  to change the cursor size, window size and font from the options menu.

the ide also strips spaces at the end of a line it processed which is a hinderance for some situations creating ascii pictures but... that is a feature.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QB64PE v4.1 is now live SMcNeill 12 3,754 03-07-2025, 05:15 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)