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.

Dark GDK / how to make an image file from a memblock/in-game scene

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Dec 2009 14:02
Hello guys!

Sorry for the second post =p
anyway, how can i make a file ( e.g. image.jpg ) from a memblock or a an ingame scene? should i just make a memblock from bitmap and then dbMakeFileFromMemblock()? if so, what are dbMakeFileFromMemblock()'s parameters?
thanks in advance

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Dec 2009 17:38
I'd perform a dbMakeImageFromMemblock then do a dbSaveImage. Maybe not as direct as you'd like but when you save the image you'll know it's recognized as an image.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Dec 2009 18:10 Edited at: 29th Dec 2009 18:10
so its like: i save the screen in a bitmap, save the bitmap in a memblock, get the image from the memblock and then save the image to a jpg with dbSaveImage()?

anyway, thanks a lot.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Dec 2009 20:53
Also look at dbGetImage if that works for you. It gets an image directly from the "current" bitmap.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 30th Dec 2009 13:07
alright thanks alot.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 14th Jan 2010 14:24 Edited at: 14th Jan 2010 14:24
Hello guys
sorry for bumping, but making a new topic for hat question is not worth it

anyway, Lilith suggested dbGetImage () to get an image directly from the screen, the first parameter is the current bitmap (right?) which is 0 by default, where does the function save the image in? i mean like, if i want to make a sprite using this image, which ID should i use?

Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 14th Jan 2010 14:46
I think you need to save the image first, and then reload it wity dbLoadImage();

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 14th Jan 2010 15:43
and what is dbGetImage() for?

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 14th Jan 2010 19:41 Edited at: 14th Jan 2010 21:53
Quote: "Lilith suggested dbGetImage () to get an image directly from the screen, the first parameter is the current bitmap (right?)"


No. The first parameter is the ID of the image to which the current bitmap will be copied (in memory). The current bitmap is not a parameter because the system knows what the current bitmap is. It is the screen by default, but you can change it with dbSetCurrentBitmap.

So, saving a screenshot should be as easy as dbGetImage (give an ID number) and dbSaveImage (same ID number).

EDIT: This method works for 3D scenes, but the only time when I tried for a screen containing only 2D sprites, the sprites were not shown on the screenshot.

EDIT again: one more thing. Whenever I try to get a screenshot with dbGetImage from the screen, the image comes out distorted, it is saved to disk with a different number of pixels than the resolution of the display. I don't know a solution for this yet. But if you make a sprite from the image, then you can scale the sprite if necessary.

Login to post a reply

Server time is: 2024-11-20 07:18:10
Your offset time is: 2024-11-20 07:18:10