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.

Newcomers DBPro Corner / bitmap width/height question

Author
Message
D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 7th Jul 2009 09:39
Hi all,
When I read the descriptions of the BITMAP WIDTH/HEIGHT commands, I thought it meant that it would return the width and height of the bitmap I passed to the command. However, what I get in return is my screen resolution width and height. I’ve tried passing the commands the image number and leaving it blank. Could someone please tell me what I’m doing wrong?



backdrop on
color backdrop rgb(180, 35, 165)

set dir "Y:\Dark Basic Projects\bitmap experiment"

load bitmap "OrangewithShadow.png",0

width = bitmap width ()
height = bitmap height ()
get image 1,0,0,321,321

do



text 0,500,"mouse X position " + str$(mousex())
text 0,520,"mouse Y position " + str$(mousey())
text 0,540,"image width " + str$(width)
text 0,560,"image height " + str$(height)
paste image 1,0,0,0

loop

"GOTTA HAVE MORE COW BELL, BABY!!!!!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Jul 2009 16:34
If you use image then all will work ok.

In DBPro bitmap is the hidden screen size an work place, its not the type of image, its not bmp.

If you knew that already then ok.

Dark Physics makes any hot drink go cold.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Jul 2009 18:43
It's because bitmap 0 is the main screen that is always going to be the resolution the program is at. Load that on bitmap 1 and you'll see the exact size of the bitmap created.

D_dredar
15
Years of Service
User Offline
Joined: 6th Jun 2009
Location: The Nevada Desert
Posted: 8th Jul 2009 08:52
Thanks for the info, changing the load command from bitmap to image allows me to get the image width and height. However, when I use the GET IMAGE command produces a black square. I'm guessing that this is happening because the file is loaded as an image not a bitmap, and changing the bitmap number does not seem to make a difference. Could someone tell me what I'm not doing correctly?

"GOTTA HAVE MORE COW BELL, BABY!!!!!

Login to post a reply

Server time is: 2024-11-24 03:40:14
Your offset time is: 2024-11-24 03:40:14