Deleting .bmp image

Blitz3D Forums/Blitz3D Beginners Area/Deleting .bmp image

pfaber11(Posted 2016) [#1]
Hello could someone please tell me how to delete a .bmp image
from the screen. many thanks.


RustyKristi(Posted 2016) [#2]
http://www.blitzbasic.com/bpdocs/command.php?name=FreeImage&ref=goto


pfaber11(Posted 2016) [#3]
thankyou


RustyKristi(Posted 2016) [#4]
no problem ;-)


pfaber11(Posted 2016) [#5]
using the freeimage command it deletes it from memory but not from the screen . any ideas.


RustyKristi(Posted 2016) [#6]
One method so images appear on screen is if you call DrawImage with it.. so write a conditional statement if you want to get rid of it, say like if you have an intro screen or hud


RustyKristi(Posted 2016) [#7]
I just provided an example on the FreeImage Command manual section where you have posted a comment.

I assume this is your first time coding. Programming takes practice and lots of interest, and with that you develop your own way or unique style along with the dos and don'ts and language syntax. Trying it first hand on your own gains you a lot of experience, it's like playing a video game, failing and you know what to do next time.


pfaber11(Posted 2016) [#8]
ok rusty i'll see what I can come up with. thanks for your input.


RemiD(Posted 2016) [#9]
clscolor(000,000,000)
cls()

this will color the current buffer in black (and thus clear the image which was drawn)


_PJ_(Posted 2016) [#10]
Ideally you would not use "FreeImage" unless you were completely finished with the image and were not intending to draw it again during the program runtime (or significant portion thereof) in order to reclaim the memory that image used.

The 'removal of an image from the screen' would typically not be something necessary since conventional practice involves drawing the REQUIRED images to a buffer each 'frame'.

For example:

Graphics 800,600
;Create an image for the example
Local RedImage=CreateImage(400,600)
;Make the image red
SetBuffer ImageBuffer(RedImage)
ClsColor 255,0,0
Cls

;Create another image for the example
Local BlueImage=CreateImage(400,600)
;Make this image blue
SetBuffer ImageBuffer(BlueImage)
ClsColor 0,0,255
Cls

; Reset the cls (clear screen) color back to black.
ClsColor 0,0,0

;Set the drawing buffer to the back buffer. This is hidden from view currently
SetBuffer BackBuffer()

;Make this variable to store the state of which image to show.
Local TOGGLE=False



;INITIATE A MAIN LOOP - WILL EXIT IF ESCAPE IS PRESSED DOWN
While Not (KeyDown (1 ))
	;Start the loop by clearing the screen ready for new drawing fo rthis frame
	Cls
	
	;Check if the spacebar has been pressed
	If KeyHit(57)
		;Yes it has, so let's change the TOGGLE value.
		TOGGLE=Not TOGGLE
	End If
		
	;Now, depending on the value of TOGGLE, we can choose to display the RED image or the BLUE one.
	;There's no need to 'hide' one from view or remove it from screen, since if we don't need to see it, we just don't draw it.
	
	If (TOGGLE=False) Then DrawImage RedImage,0,0
	If (TOGGLE=True) Then DrawImage BlueImage,400,0
	
	;Swap the backbuffer to the front- this means that all the drawing we did to the back buffer during this 'frame' of the loop, will now be displayed on the visible screen.
	Flip
	
Wend