dxFreeImage(image%)

Parameters

handle=variable that holds the image handle of a previously loaded image

Description

When you are done with an image, use this command to delete the image from memory and free up that memory for other use. Good housekeeping. Get in the habit!

Note that the variable to the Image is not reset to 0 upon using dxFreeImage, nor will any other variables pointing to the same Image. If you try to access the handle again, it will result in an error. It is good practice to set the handle to zero immediately after freeing the image, as you can then check whether an image has already been freed or not.

See also: LoadImage, SaveImage.

Example

; dxFreeImage command

; Global, as always, for graphics
Global gfxPlayer

; Enter graphics mode and start double buffering
Graphics 640,480,16
dxSetBuffer dxBackBuffer()

; Load the image-assign the handle to gfxPlayer
gfxPlayer=LoadImage("player.bmp")

; draw the image at random until ESC pressed
While Not dxKeyHit(1)
dxCls
DrawImage gfxPlayer,dxRnd(640),dxRnd(480)
dxFlip
Wend

; Erase the image from memory!
dxFreeImage gfxPlayer

Index