What am I doing wrong with _FreeImage?
#1
I have written a small test using _loadimage and _FreeImage, and all goes well except when I try to clear the images (as I believe is necessary after using them).
I get an Illegal function call message at that point. Why is it so???
Code: (Select All)
Screen _NewImage(1500, 800, 32)

GetGridSize:
Locate 15, 66
Print "Choose a grid size, 1 to 4 (for 12, 20, 30 or 42 tiles)"
Play move$
Getsize:
_KeyClear: k = 0
While k < 1
    _Limit 30
    k = _KeyHit
Wend
Select Case k
    Case Is = 49
        numtiles = 12 '                                                                      numtiles is number of tiles for that size grid
        numcols = 3 '                                                                        numcols is number of columns in the grid
    Case Is = 50
        numtiles = 20
        numcols = 5
    Case Is = 51
        numtiles = 30
        numcols = 5
    Case Is = 52
        numtiles = 42
        numcols = 7
    Case Else
        GoTo Getsize
End Select

DisplayTiles: '
numrows = numtiles / numcols '                                                                set number of rows needed for the numtiles and numcols
Dim tiles(numtiles) As Long
For a = 1 To numtiles
    tiles(a) = _LoadImage("RecPics/test.jpg", 32) '                                          set tiles array with numpics copies of test.jpg
Next
For a = 1 To numtiles / 2
    _PutImage (60 * a, 60), tiles(a) '                                                      display first half of tiles  array
Next
For a = numtiles / 2 + 1 To numtiles
    _PutImage (60 * (a - numtiles / 2), 120), tiles(a) '                                    display second half of tiles array
Next
Sleep 2

For a = 1 To numtiles
    _FreeImage (a) '                                                                            free all of the images from memory
Next
Print "I get an error message here: Illegal function call line 45 (the _FreeImage line)"
Sleep
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Reply


Messages In This Thread
What am I doing wrong with _FreeImage? - by PhilOfPerth - 02-24-2023, 12:48 AM



Users browsing this thread: 5 Guest(s)