Image refusing to draw

Just starting out? Need help? Post your questions and find answers here.
Carm3D
Enthusiast
Enthusiast
Posts: 103
Joined: Mon Feb 17, 2025 10:04 am

Image refusing to draw

Post by Carm3D »

I have a draw image command that is not very.... commanderly. It refuses to draw. The box draw works fine.

Code: Select all

    Event = WaitWindowEvent()
    UsePNGImageDecoder()
    ;FlipBuffers()
    StartDrawing(WindowOutput(WindowNum))
    DrawingMode(#PB_2DDrawing_Default)
    Box(0, 0, GameX, GameY, RGB(0, 0, 0))
    

    DrawImage(BatterySequence(0), 0, 0)
    StopDrawing()
    If Event = #PB_Event_CloseWindow
        EndProgram()
    EndIf
I used IsImage and BatterySequence(0) is a valid non-zero number. I checked it's width and height and they check out perfect. I used SaveImage and the resulting image saves fine and looks beautiful. PureBasic just doesn't want to draw it. Any ideas?
User avatar
ChrisR
Addict
Addict
Posts: 1484
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Image refusing to draw

Post by ChrisR »

Probably

Code: Select all

DrawImage(ImageID(BatterySequence(0)), 0, 0)
DrawImage need an ImageID as described in the help
Carm3D
Enthusiast
Enthusiast
Posts: 103
Joined: Mon Feb 17, 2025 10:04 am

Re: Image refusing to draw

Post by Carm3D »

ChrisR wrote: Sat Mar 08, 2025 4:12 pm Probably
DrawImage need an ImageID as described in the help
Yep! That was it! Took me a long time until I figured that out. Thank you!
User avatar
jacdelad
Addict
Addict
Posts: 2029
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Image refusing to draw

Post by jacdelad »

Don't worry, absolutely everyone of us stumbled across this at least once.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Post Reply