Just a question

Blitz3D Forums/Blitz3D Beginners Area/Just a question

Agamer(Posted 2003) [#1]
Ok I am writing a calander program and it's coming along great!

So a few questions I have got to ask! (O and I'm using blitz 3d)

1.IS there a way to take a complete screen shot the screen and save it to disk or is there a way to add another image to a image like umm this but using commands!

loadimage ("thing")
;next bit not acturly code
draw image to image: draw image (other thing) to (thing)
saveimage(thing)


prefobly the secind one but both are ok!

2.
I know this is really simple but how can I make a image's background transparent so I can see through it

Ok I think thats it!

Thx for the help in advance!


Rob Farley(Posted 2003) [#2]
Leigh Bowers screenshot function, just add the line
savescreenshot()
after the flip, you'll probably want to put it on the end of a
if keyhit(xx) then savescreenshot()
Function SaveScreenshot()
iFileNumber = 0
Repeat
iFileNumber = iFileNumber + 1
sFileName$ = "screenshot" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp"
Until Not(FileType(sFileName))
SaveBuffer FrontBuffer(), sFileName
End Function
This is really good as it automatically increments the file number so you can save as many as you want without needing to change the code.

If you use drawimage the background colour is tranparant, this defaults to black (0,0,0) you can set this yourself using maskimage image,r,g,b. A popular background colour is magenta so you'd create your image in a paint program with the background magenta, then in blitz you'd do
myimage=loadimage("myimage.bmp")
maskimage myimage,255,0,255 ;magenta
You have to use drawimage and NOT drawblock for this to work though.


Agamer(Posted 2003) [#3]
K so save scren shot is done by some one else do you know were I can get it and even better is there a way I can do it without a dll but if not nm!


Perturbatio(Posted 2003) [#4]
I would try the code archives for the save screenshot function


Agamer(Posted 2003) [#5]
yeh I looked but could not find!


Agamer(Posted 2003) [#6]
Two more things if any one else knows wee that save screen shot thing is and also does any know the rgb value for white?


Perturbatio(Posted 2003) [#7]
white rgb is 255,255,255
RGB Colour Chart: http://www.htmlcenter.com/tutorials/tutorials.cfm/89/General/

(Intended for web based stuff, but the RGB values are obviously the same).

Screenshot code: http://www.blitzbasic.com/codearcs/codearcs.php?code=128

(in the code archives under graphics).


Agamer(Posted 2003) [#8]
ok this is how far i got but the mask image thing only mask the wrong bit i programed to be masked seems to be black well here's the code

AppTitle"calander maker"
Graphics 800,600

cal=LoadImage("calander1.bmp")

;save screen shot
Function SaveScreenshot()

    iFileNumber% = 0
    Repeat
        iFileNumber = iFileNumber + 1
        sFileName$ = "output/Screenshot" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp"
    Until Not(FileType(sFileName))
    
    SaveBuffer FrontBuffer(), sFileName

End Function
;end of save screen shot

Print"welcome to the calander maker!"
Print
Print"Please now put you calander"
Print"image into the Input folder"
Print"It must be 800*600 pixels wide"
Print
	;input of image name!
	Print"Please type in the file name"
	Print"remember it must be a .bmp"
	image$=Input()
	pic=LoadImage("input/" + image$ + ".bmp")
	
	Cls
	
	DrawBlock pic,0,0
	DrawImage cal,498,296
	MaskImage cal,255,225,255 ;white
	
	savescreenshot()
Locate 0,0
Print
Print"Thankyou the calander is now"
Print"waiting For you in the output folder!"
Delay 500
Print"I would like to thank Leigh Bowers for help with the code!"
Print"Please press any key to end this program"
WaitKey
End



Agamer(Posted 2003) [#9]
can white be masked as i don't think it can?


Agamer(Posted 2003) [#10]
just updated it a bit addedsome choice I know is this what a work log is for? wow could be my first work log!


dangerdave(Posted 2003) [#11]
Hi Agamer,

Your maskimage should be done before you use the draw command.


Agamer(Posted 2003) [#12]
o ok I shall do that now

thx for the help I am going to make some some sostom calnders soon!