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 problems

Author
Message
Rodro
21
Years of Service
User Offline
Joined: 17th Sep 2002
Location:
Posted: 21st Sep 2002 07:02
As test I have the following code:

cardwidth = 71
cardheight = 96
cardnumber = 0
maxsuits = 4
maxranks = 13

LOAD image "deck.bmp",1

FOR i=1 TO maxsuits
FOR j=1 TO maxranks
INC cardnumber
right = (i*cardwidth)-1
bottom = (j*cardheight)-1
top = ((j-1)*cardheight)
left = ((i-1)*cardwidth)
GET IMAGE cardnumber, left, top, right, bottom
NEXT j
NEXT i

When J gets to 6, DB gives me a 'cannot grab image due to an ivalid area' error

The image is a deck of cards -- 4 cards across and 13 down.

Is this another bug or am I doing something wrong?
Washington Irving
21
Years of Service
User Offline
Joined: 7th Sep 2002
Location:
Posted: 21st Sep 2002 09:47
Had to get a pencil,paper, and a calculator to work this one through.

You are loading an IMAGE (presumably to bitmap 0) which i'm guessing is set at 640x480.

When J=5 bottom=479 ((96*5)-1) (j*cardheight)-1

When j=6 top=480 (96*5) ((j-1)*cardheight)
The bottom=575 which is over the bitmap size.

Try the LOAD BITMAP command to an offscreen bitmap or creating an offscreen bitmap with a Y size larger than 480, then pasting the "deck.bmp" image there.

Hope that it.

Rodro
21
Years of Service
User Offline
Joined: 17th Sep 2002
Location:
Posted: 21st Sep 2002 16:59
I agree, however, when I use the command bitmap height(1) I get 1248

Hey!! You talking to me?
Fireburst
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Sep 2002 00:24
The GET IMAGE command is bugged. If the bmp is larger in size than the resolution ie your res is 800x600 but you bmp is 810x500 or 780x650 you get that error.

In theory, there is no difference between theory and practice. But in practice, there is.
Rodro
21
Years of Service
User Offline
Joined: 17th Sep 2002
Location:
Posted: 22nd Sep 2002 01:15
Thanks! When I changed he bitmap size smaller than screen res, DBpro crashes......... Oh well. Dbpro needs a lot of work!

Hey!! You talking to me?
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 22nd Sep 2002 02:02
I have more spectacular things with GET IMAGE.

When I use examples , they work perfectly.

When I compile my entire game 'DarkAnoid' under DBPro , debugger crash with a GET IMAGE instruction.

When I take the small part of code that use the Get image and run it alone , it work perfectly !

how strange ? not ?

Login to post a reply

Server time is: 2024-04-19 19:46:54
Your offset time is: 2024-04-19 19:46:54