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 / Screenshot Function Not Working

Author
Message
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 25th Apr 2012 02:55
I have a screenshot function that's suppose to take a picture of the upper half of my screen and then save it as a .bmp file. However, instead, it just saves a solid blue rectangle and then deletes the background sprites.



before:


after:


screenshot.bmp:
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 25th Apr 2012 04:02
If you're pasting the staff images to the screen then have you dbSetCurrentBitmap() first? It looks like it's grabbed an image of a blank bitmap and not the screen.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 25th Apr 2012 08:16
do I have to make it all a bitmap? The staff and the notes are sprites. Is there a way to do it without changing them all to bitmaps?
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2012 02:43
Someone might have a better idea for sprites but I think that if you pasted them onto the bitmap then the screen grab should work then. I only know sprites from the old days as blitter objects which were drawn as an overlay.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 26th Apr 2012 07:57
I don't understand how to do it with bitmaps. I currently have two images that I set as sprites and I want to take a picture of them (they're the only two things located in the upper half of the screen). How can i change these to bitmaps if that's the only way, or how can I take a screenshot of them if they're sprites?
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2012 17:00
Should just be dbPasteImage() or dbPasteSprite() to actually paint them on the currently selected bitmap. After that you should be able to grab an image of the current bitmap and save it or just save the bitmap...

You can also create a separate bitmap and paste them to that.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 26th Apr 2012 17:16
does the dbGetImage() function accept a bitmap?

dbGetImage : void dbGetImage ( int iImage, int iLeft, int iTop, int iRight, int iBottom )


looks like it needs a image as its first argument, but i'm trying to give it a bitmap (it's still not working)
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 26th Apr 2012 17:29
Okay this is what I have:



This is -almost- there. I set my staff sprite as an image, then I can use that to get image and save it.

However, there are up to 12 other sprites (the notes on the staff) that also need to be saved, how can I combine the staff sprite and the note sprites into one image?

My screenshot IS working appropriately for the staff, but now I don't know how to expand it to all 13 (staff+12 notes) sprites
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2012 19:33 Edited at: 26th Apr 2012 19:35
dbGetImage( imageID, top, left, right, bottom )

Grabs an image into the imageID number from the current bitmap. DBP and GDK functions don't return an imageID, instead you have to assign one.

ie.

dbGetImage( 1, 0,0,640,480 ); // now image 1 is the screen grab...

dbSaveImage() will allow you to save that image and

dbDeleteImage() will remove the image from memory when you've finished.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
silvermace
8
Years of Service
User Offline
Joined: 24th Apr 2012
Location:
Posted: 26th Apr 2012 22:37
I understand that works for one image. I can change on sprite to one image, but I want to take a picture of 13 different sprites (staff + 13 notes on the staff, each a separate sprite).

Ur method allows m to grab/save one image, but i want to save 13 sprite as 1 image together.
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 27th Apr 2012 02:04


Which is almost the same as your first code snippet. Formats that I know that work are bmp and png. Apart from that, cos it works on my machine for screen grabs, is that you're on win 7 or something... Befuddled...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2020-09-19 07:44:50
Your offset time is: 2020-09-19 07:44:50