SRL Archive - General

how does scar convery colors to numbers


weaselforce

2006-04-09 00:58:54

how exactly does scar convert colors to numbers, are the colors built into scar somesort?

phantombmx

2006-04-09 01:18:43

i always thought it converted it by hex (somewhat) just a different way.. similar in concept tho

dont take my word that thats the way it works :D

WhiteShadow

2006-04-09 02:27:05

From: weaselforce
how exactly does scar convert colors to numbers, are the colors built into scar somesort?


This is something only Kaitnieks and a few others would know. He made it. SCAR is vast it probably has a integer for all colors.

I never thought about this before.

Pwnd

2006-04-09 04:24:02

From: phantombmx
i always thought it converted it by hex (somewhat) just a different way.. similar in concept tho

dont take my word that thats the way it works :D

Yeah, it's a different way than hex, since all of the numbers aren't 6 consecutive numbers, and none of them have any sort of letter in them.

phantombmx

2006-04-09 05:37:53

From: Pwnd
Yeah, it's a different way than hex, since all of the numbers aren't 6 consecutive numbers, and none of them have any sort of letter in them.


eh.. its just a thought…. :rolleyes:

solemn wishes

2006-04-09 06:15:50

its a program builld into scar i think, i downloaded one when i was making a visual basic program. i dont think he made it from scratch but i may be wrong.

Renax

2006-04-09 10:20:37

there is at least 3+ color systems used in visual basic programs, i highly doubt kait coded a new color system for scar. just google it you'll find a better answer there.

BenLand100

2006-04-09 10:50:41

Bit Shifts and logic ;) Pretend the var RGBColor is a scar color and R, G, B are the different color chanels (0-255):
B:= (RGBColor and $ff0000) shr 16;
G:= (RGBColor and $00ff00) shr 8;
R:= (RGBColor and $0000ff) shr 0;
now some of that can be taken out (like the shr 0) but that can convert a color into its R, G, B values. To put them back:
RGBColor:= ((B shl 16) or (G shl 8) or(R shl 0));
now in that the shl 0 can be taken out but i left it in so you could understand ;)

BTW: it is hex ;)
$ffffff = 16777215 = white;
$ff0000 = 16711680 = blue;
$00ff00 = 65280 = green;
$0000ff = 255 = red;
$000000 = 0 = black;

moparisthebest

2006-04-09 11:24:25

From: BenLand100
Bit Shifts and logic ;) Pretend the var RGBColor is a scar color and R, G, B are the different color chanels (0-255):
B:= (RGBColor and $ff0000) shr 16;
G:= (RGBColor and $00ff00) shr 8;
R:= (RGBColor and $0000ff) shr 0;
now some of that can be taken out (like the shr 0) but that can convert a color into its R, G, B values. To put them back:
RGBColor:= ((B shl 16) or (G shl 8) or(R shl 0));
now in that the shl 0 can be taken out but i left it in so you could understand ;)

BTW: it is hex ;)
$ffffff = 16777215 = white;
$ff0000 = 16711680 = blue;
$00ff00 = 65280 = green;
$0000ff = 255 = red;
$000000 = 0 = black;


there is somthing wrong with you…

XxKanexX

2006-04-09 18:08:47

From: BenLand100
Bit Shifts and logic ;) Pretend the var RGBColor is a scar color and R, G, B are the different color chanels (0-255):
B:= (RGBColor and $ff0000) shr 16;
G:= (RGBColor and $00ff00) shr 8;
R:= (RGBColor and $0000ff) shr 0;
now some of that can be taken out (like the shr 0) but that can convert a color into its R, G, B values. To put them back:
RGBColor:= ((B shl 16) or (G shl 8) or(R shl 0));
now in that the shl 0 can be taken out but i left it in so you could understand ;)

BTW: it is hex ;)
$ffffff = 16777215 = white;
$ff0000 = 16711680 = blue;
$00ff00 = 65280 = green;
$0000ff = 255 = red;
$000000 = 0 = black;

Soon you'll be one of those people the government wants dead 'cause you know too much. -.-

Mutant Squirrle

2006-04-09 18:54:58

an amazing explanation by benland haha *expects mopar to be the government*

WhiteShadow

2006-04-09 20:28:11

I agree with Mopar and Kane. Gar, Benland where'd you learn all this?

Bebe

2006-04-09 20:35:56

Benland, I wish to burn your body (and you wouldn't even know :) ) then steal your brain. And your cool no temperature powers :D

BenLand100

2006-04-09 21:23:49

From: WhiteShadow
Gar, Benland where'd you learn all this?

You might think i'm lying but… I teach myself everything ;)

WhiteShadow

2006-04-09 22:35:19

From: BenLand100
You might think i'm lying but… I teach myself everything ;)


You mean just observing and reading tuts?

God damn my fingers hurt. I fell of my bike and landed in some roses in my back yard. :(

phantombmx

2006-04-10 01:04:18

haha!! :D it was hex!! woot!! anyways yeah i kinda figured it had to do somethin with hex in some way.. :p

weaselforce

2006-04-10 01:14:33

yea…. well thanks for the answer. i'll try to understand it when i'm older or something lol

Brown

2006-04-13 17:51:58

I kinda do the same thing as benland on the learning deal. I had learned 4 computer programming languages by age 13 just by looking at code and see'ing how they change things. I never really cared or took the time to be sure, by my best hunch was that the color system was similar to rgb.

stan boy

2007-11-09 17:20:16

is there anything on the market that is handheld and converts colors to numbers. similar to Home Depot analyzing fabric to give you a paint color. In photoshop or whatever, you will notice al colors are broken into combinations of RGB, with numbers assigned to each one and combined, they give you one color. What would it take to get a device that would do this–convert the color of a surface into these numbers? My wall would be the color 45/22/114. any ideas?

RAM

2007-11-09 21:24:48

From: stan boy
is there anything on the market that is handheld and converts colors to numbers. similar to Home Depot analyzing fabric to give you a paint color. In photoshop or whatever, you will notice al colors are broken into combinations of RGB, with numbers assigned to each one and combined, they give you one color. What would it take to get a device that would do this–convert the color of a surface into these numbers? My wall would be the color 45/22/114. any ideas?


WOW, I think you set the new record for grave digging…. 04-13-2006, 05:51 PM… perhaps next time, you could just make your own post and site a link to the one you are referencing…

However, this was a good read…and Ben Land…. this was a year and a half ago, that boy has sure gotten more smarteful since then….

Anyways…. what is the particular application you are looking to use this device for ? as I would think the values would change, depending on the light source…. my suggestion to you ,would be ,to check some photography sites…. I know there is something similar to this for that purpose..

Best regards,

~RAM

NxTitle

2007-11-11 11:04:27

It says "old thread but i have a question" in his subject line but still, that's your first post, and it's a gravedig, and it doesn't have to do with SCAR, your reputation isn't very good so far…

Anyways, I always thought the colours were a function within Delphi, because I've seen other programs that use colours as integers (example, Game Maker) . I haven't checked if the colours matched up, but BenLand gave a very good explanation of it.

I would probably have gone down to the bytes in memory.
an Integer in memory is made up of 4 bytes, or 32 bits. Each byte can hold 256 different values. What usually happens is the first byte holds the red, the second holds the green, the third holds the blue, and the fourth holds an alpha value (which doesn't really matter in SCAR). So it's just editing each separate byte and returning an integer. I would find it hard working with 3 bytes, though.

n3ss3s

2007-11-11 13:37:57

@RAM: I have a feeling that I've made the record for gravedigging :rolleyes:

SRL Developer/SRL Master/Moderator


Woah!

That could be expressed in one word - GOD!

@Mopar&Kane: Lets get him :p

Hmm, I think theres been threads asking this, but didn't get any answers.

search button lol..

Harry

2007-11-11 13:40:14

04-09-2006, 12:58 AM
:eek:

R0b0t1

2007-11-11 13:45:16

No… I think there was another that was close to this.

But anyway:

http://www.easyrgb.com/calculator.php
http://www.easyrgb.com/math.php?

Freddy1990

2007-11-11 14:08:24

EDIT: Wtf, how old is this? lol

NxTitle

2007-11-11 20:30:51

Freddy: It was from April of last year.

Freddy1990

2007-11-17 03:22:33

Well yea, I can see that, I do know how to read…

Negaal

2007-11-18 08:15:36

Again sorry for gravedigging, but is was kinda useful for me… now i know something about converting colors to numbers…

hehe… when i saw lot of SRL devs posting here i was scrolling down and looking for Benland post to laugh hard:D And yeap. found it…

I agree with Bebe aswell…

BenLand100

2007-11-19 00:03:43

Hand him a shovel and send him to the cemetery!

From: Nontitle
I would find it hard working with 3 bytes, though.

So would everyone else, which is why they pretend colors take 4 bytes and just "waste" a byte per pixel :)
00BBGGRR00BBGGRR00BBGGRR etc.

Also, its not my fault I know how to pack data into 32 bit numbers :p

Negaal

2007-11-21 10:23:54

From: BenLand100
Also, its not my fault I know how to pack data into 32 bit numbers :p


Your explanations are so funny and wierd, because i can't understand anything of them!


Well i'm currently studing to computer engineer
It's called "computers and computer networks"

well,once i had test for these:
10 Gigabit Ethernet

24-bit image

32-bit operating system

32-bitine opsüsteem //32 - bit operating system

32-bit processor

3-D graphics

686

8.3 filename


http://www.estpak.ee/~rakkekk/AvoLeht/VMaarja/1kursussissejuhatus/Pohimoisted1/index.htm

- You can't understand, it's in estonian…

What do you think what was result? :p