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 Discussion / Getting rgb values from memblock image

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 10th Mar 2009 17:26
I was bored and messing around with a image and memblocks because i wasn't sure how the memblock image was set up well i fugured it out but just wondering is there a way to get the rgb values from the pixel data? that would make making a fade image thing very very easy lol you could just set all the rgb value down one. well that sounds right in my head idk if it is.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 10th Mar 2009 17:38
You can use this.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 10th Mar 2009 17:47 Edited at: 10th Mar 2009 18:13
yay i didn't even know about rgbr,rgbg,rgbb commands thank you i love quick replies thanks ashinga




aahhhh once again my mind has failed me! lol changing the rgb values bye -1 doesn't fade it. it turns the picture yellow lol hmmmm maybe i should look up that other fade function someone made. i just wanna know how it works lol


Edit:

Is there a better way to get the color of a point on the screen then using make memblock from bitmap 100,0 then Color=Memblock float(100,Position) because i tested it and that is about 9 millaseconds slower then the built in point command. i know people have done it before just don't know how.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Mar 2009 20:27
I think you can use memblock dword for the color data, but it only works properly in 32 bit resolution.

For fade, I managed to do it by taking the difference between the two colors, dividing that by 100 (to get what a difference of 1% is) and then multiplied that by the desired percentage. It is slow though, not much you can do about that.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 11th Mar 2009 00:06
hmmm interesting. i will try that in just a sec almost done with home work lol


ok i'm jumping around with memblocks sorry but i was just sitting here thinking if you could make a memblock from a image then save the data and load it back it (not very usefull just a question) so i tried well it works but the colors arn't correct they always come out green. course its in 16 bit but thats all paint will do that and 24 i have tried everything any ideas? i love learning things hahahaha
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 11th Mar 2009 00:11
Are making sure to skip every fourth byte? That's the alpha value for each picture. The memblock from an image goes like:

R value for 1,1
G value for 1,1
B value for 1,1
Alpha value for 1,1
R value for 2,1
G value for 2,1
B value for 2,1
A value for 2,1
etc...

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 11th Mar 2009 01:40 Edited at: 11th Mar 2009 01:41
oh i though it was one number for each pixel. like color value for pixel 1,2,3 so on. i was skipping 4 bytes because of the dword takes for bytes hmmm this is different then i thought. i will look into this


edit what is the alpha value?
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 11th Mar 2009 02:07
Alpha is for transparency.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 11th Mar 2009 02:16
oh ok i didn't know that. so theoreticly you could use this to change the default transperant color (black) for db? lol i like to learn random ways around random things
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 11th Mar 2009 22:03
No, it's like in a PNG, where you can have totally transparent pixels. The Alpha value ranges from 0 to 255, where 255 is completely opaque, and 0 in completely transparent.

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 12th Mar 2009 17:46
oh ok i get it thnaks well i'm not going to be coding for a while. my "mommy" is taking my computer cuz i wasn't doing homework lol
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 15th Mar 2009 05:09
i wouldnt admit to too many people caleb
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 15th Mar 2009 05:45
hahaha ya i know lol

New Site! Check it out \/
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Mar 2009 05:00
Perhaps you could play your cards right so that you NEED your computer to do homework...

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Mar 2009 05:12
hahahaha ya or i could just do it. tried that and geuss what!? it works! lol

New Site! Check it out \/

Login to post a reply

Server time is: 2025-05-16 04:11:52
Your offset time is: 2025-05-16 04:11:52