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 / DWORD to RGB?

Author
Message
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th Oct 2005 15:21
Hi all,

Sorry but I had a look through with the search and couldn't find a nice simple way to do this.

I'm using point to get the colour of a pixel on the screen, and it spits out a DWORD. How do I get the red, green and blue parts of that, so I can use it in RGB?

Thanks. Sorry if I'm being slow.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 13th Oct 2005 15:30
i think there are get red() , get blue() , and get green() commands in DB.

I R tEh Antid0te! ROOOAAAR!
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th Oct 2005 15:37
I'm afraid I can't find them or they're not written like that.

I'm useing DBPro and I can't find any commands in the help with 'green' in them, and "get red()" doesn't highlight and it spits out an error if I try to use it anyway.

Thanks for trying to help, but I fear I'll need more help. :/
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th Oct 2005 15:52
Doh. I figured it out by trial, error, and sacrificing sandwitches to the brain-god.

For those who follow - this is how I did it (and if anyone has a better way of doing it, please tell!)



As you can see, I used the POINT command to get the DWORD colourvalue, and then had to make a memblock to put it in. The fact that it's 4 bytes long, and not three, scares me, but hey. Maybe it's for alpha.

Good luck everyone, and sorry I kind of worked it out so quickly after I posted. I'd just been very scared of memblocks and was convinced I wouldn't be able to manage to do it.

Hope it helps someone else, or I get shouted at for doing it the wrong way
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Oct 2005 16:10
That works, but there are easier ways
The fourth channel is alpha, by the way.

You can use
RGBR(colourvalue)
RGBG(colourvalue)
RGBB(colourvalue)


Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th Oct 2005 18:03
You know, I saw those, but for some reason the wording of the documentation made me think that they didn't do what I wanted. Oh well, learn something new every day
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 13th Oct 2005 18:07
OK so its not get red() its rgbr().

I R tEh Antid0te! ROOOAAAR!

Login to post a reply

Server time is: 2024-09-24 05:30:26
Your offset time is: 2024-09-24 05:30:26