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 / Get image problem

Author
Message
swissolo
16
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 21st Aug 2010 19:50 Edited at: 21st Aug 2010 19:54
I was just trying to split an image strip into multible images, all 256x256, so they would cooperate with my level editor but I'm baffled as to why get image just returns a blank blue image.

Here's they code I'm using, I feel like it must be something really obvious, but I can't put my finger on it.

(sorry for the weird spacing)

swis
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Aug 2010 20:21
Well, you have a few problems with that code...

I don't think you want to set your display mode to 256 x 256. It works, but why?

What you probably want to do is use SET BITMAP FORMAT, CREATE BITMAP and LOAD BITMAP to hold your image strip. The bitmap should be the same resolution as the image. Then you can use GET IMAGE to grab each piece of the bitmap into your images.

You don't really need to use sprites in this process, in fact using a SPRITE command turns on the 3D camera, thus the blue screen.

swissolo
16
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 21st Aug 2010 20:28 Edited at: 5th Jan 2011 23:34
Thanks, I read somewhere that get image worked best when the resolution was the same as it's grab area.
Edit: I've never actually used the bitmap commands before, could you explain them a little more. Sometimes things come up that make me feel all new again .
Edit2: Green Gandalf's code works for me , but it still would be nice to know what the bitmap commands really do. Oh, and again, I read you had to sync before get image

swis
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Aug 2010 20:34
This code works for me:



I think the main problem in your code was the inclusion of the sync command between paste sprite and get image.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Aug 2010 20:52
When you create a new bitmap, you have a new drawing area to work with. Bitmap zero is your work area when you start DBPro, and its size is the same as your screen width and height.

SET BITMAP FORMAT sets up the width, height, and pixel depth for any new bitmaps you create.

CREATE BITMAP creates a new bitmap, using the values you put into SET BITMAP FORMAT. It also sets the screen to display the bitmap.

You can use SET CURRENT BITMAP to switch between any of your bitmaps.

Once you have a new bitmap, you can LOAD BITMAP from an image file, then use GET IMAGE to grab any part of the bitmap.

After all your images are grabbed and saved, you can DELETE BITMAP to clear the bitmap from your memory.

There are a few other bitmap commands, I would suggest you visit the help files for the command. And you could look around for tutorials on bitmap usage.

Login to post a reply

Server time is: 2026-07-23 12:10:38
Your offset time is: 2026-07-23 12:10:38