filename - string designating full path and filename to image.
flags - optional image flags. |
Loads an image and returns its handle. Supported file formats include: BMP, PNG and JPG. (You can also access GIFs through OpenMovie )
The optional flags parameter can be one of: 1 : managed (image is frequently drawn but seldom modified - this is the default) 2 : dynamic (image is frequently drawn and modified) 4 : scratch (image is seldom drawn or modified) Managed images are the default. Dynamic images are the fastest, but can be 'lost' when the display mode changes. This means the contents of the image will be scrambled, and you will need to restore the image content. If you are frequently redrawing the image contents, this isn't really a problem. If not, you should use managed images! Scratch images are slow all round but consume no videomemory. These are good for things like title pages and 'temporary work' images. Note that canvas buffers and back buffers should be considered 'dynamic'. See also: CreateImage, SaveImage, DrawImage, Graphics. |
; LoadImage and DrawImage example
; Declare a variable to hold the graphic file handle Global gfxPlayer ; Set a graphics mode Graphics 640,480,16 ; Set drawing operations for double buffering SetBuffer BackBuffer() ; Load the image and assign its file handle to the variable ; - This assumes you have a graphic called player.bmp in the ; same folder as this source code gfxPlayer=LoadImage("player.bmp") ; Let's do a loop where the graphic is drawn wherever the ; mouse is pointing. ESC will exit. While Not KeyHit(1) Cls ; clear the screen DrawImage gfxPlayer,MouseX(),MouseY() ; Draw the image! Flip ; flip the image into view and clear the back buffer Wend |