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 / Problem with point command?

Author
Message
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 18th Dec 2002 06:51
Look at this code:



Here is the bitmap Im using in PNG form:

http://justin5342001.tripod.com/world-mapclrs.PNG

You can clearly see that the color of the pixel at 96,204 should not be 0 but thats what its printed out as. If it matters Im using the Demo version of Darkbasic Pro.

By the way, does DBPro support constants and if so whats the command to make one?
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 18th Dec 2002 08:29
There was an issue with the Point command in DBPro up until patch 3, where it had problems reading the correct values, so I presume it's the same problem in the demo (I've never used the demo).

As for the constants use:

#CONSTANT <constant name> <constant value>

example:

#CONSTANT MAXLIVES 3

Note, there is no "=" between the constant name and value.

"Earth is the cradle of humanity,
but one cannot live in a cradle forever"
Konstantin E. Tsiolkovsky (1911)
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 18th Dec 2002 08:33
...or was that patch 2 (scratches head) hmmm can't remember now

"Earth is the cradle of humanity,
but one cannot live in a cradle forever"
Konstantin E. Tsiolkovsky (1911)
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 18th Dec 2002 08:56
Ok, thanks for the info..I dont suppose there is a patch for the demo is there? If not, is there any work around?

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Dec 2002 15:43
I'm don't believe that there is a patch for the demo.

There are maybe two ways to work around this problem.

1) Convert the bitmap to a memblock and access the pixels using memblock byte etc.
2) Make your bitmap current, lock the pixels, get the pixel address and lookup using the '*' operator, not forgetting to unlock the pixels after.

1 is easiest but slow, 2 is faster but harder, because the '*' operator only works for DWORD sized access.
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 19th Dec 2002 20:59
hmm k, thanks. Can anyone direct me to some source or tutorial on how to use memblocks? And what do you mean the * operator (multiply?) How would I use it can you give an example? Thanks.

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 19th Dec 2002 21:19
In this case, he means using the * as a pointer, eg :

*ptr=3

Which puts the value of 3 into the address stored in ptr.

If you've got DBPro, you might find my peek/poke plug-ins easier to use.

Good news everyone! I really am THAT good...
Oh my, yes...
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 19th Dec 2002 22:13
Can someone give me an example of how you would get a specific pixel's color value using pointers?

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Dec 2002 21:34
Hmm, I don't have time to write an example of using pointers - you'll just have to work that out yourself.

However, here's an example using memblocks:


Depending on your display depth, you will either get a colour value of 65535 (16 bit) or 16777215 (24/32 bit) - which equate to white. You can get the individual colour components using the rgbr/rgbg/rgbb functions.

You should be able to work out how it all works. I would have put the whole thing in a function, but the compiler kept throwing a wobbly.
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 21st Dec 2002 00:10
thanks for the help

Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 23rd Dec 2002 20:47
i always get memblock out of range with this line:

if Depth=32 then Colour=memblock dword(1,12+(Width*y*4)+x)

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Dec 2002 20:59
Works for me in both 16 and 32 bit modes - the only one I couldn't test on this machine was the 24 bit.

What version of DBPro are you using? I'm using patch 3.1.

Login to post a reply

Server time is: 2024-05-05 01:16:12
Your offset time is: 2024-05-05 01:16:12