Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Create/edit image file commands?

Author
Message
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 16th May 2011 13:23 Edited at: 16th May 2011 13:29
Hey everybody,

I'm working on implementing terrain tools in the scene editor for my project.

I'm using the 'Blitz Terrain' code library for this and it uses heigtmaps, texturemaps, etc. Which basically are graphics. Now I need a way so when I press 'new terrain' button, those image files (though blank) needs to be created for further editing. In other words, I seek commands to create (and edit), instead of just load, image files.

Perhaps I'm looking with my nose, but I could not find the right commands. Can anyone help me out?

Thanks!


Edit:
I feel a bit silly now... basic bitmap commands will do, but I'm still not sure how to save them properly. I need a way to convert the bitmap to a file somehow and save it with the file commands, right? Lol, just guessing here. Help?



Regards Sph!nx
http://www.mental-image.net
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 16th May 2011 13:35
Use get image to grab the image (Even if it is just a blank bitmap), and the use save image to save the file to disk.

Hope that helps

Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 16th May 2011 13:53
Ohw yes... so obvious as well... *runs away in shame*


*Looking back and shouts: "Thank you, =PRoF=!!"*

Regards Sph!nx
http://www.mental-image.net
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 16th May 2011 15:24
@sph!nx

If we load a bitmap ,we can get an image from it as width and heith as the bitmap is. For example we load an bitmap of 640*480 pixels....we can get a portion of image of this bitmap an delete bitmap.

load bitmap "my_bitmap",1
get image 1,0,0,100,100,1
delete bitmap 1
save image "mh_image.bmp",1

With this piece of code we open an bitmap and save our image to a file. Our image will be 100*100 pixels. I hope it can help.

cheers.

I'm not a grumpy grandpa
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 17th May 2011 14:03
yeah, I figured it out. Thanks!

Regards Sph!nx
http://www.mental-image.net

Login to post a reply

Server time is: 2026-07-10 19:48:35
Your offset time is: 2026-07-10 19:48:35