SRL Archive - Help and Support

Moving numbers right to make decimals, and Degrees in SCAR


R0b0t1

2007-08-18 23:18:06

Yep, two questions.


1. How do I get a number to be moved right a certain amount of decimal places. EX. 245 -> 2.45 .

2. How do I get SCAR to do degrees? EX. 60° * (g - b)/(min - max) + 360° (Please, don't make me explain that equation).


Thanks for your help.

Bobarkinator

2007-08-18 23:23:59

1. Divide by 100 for that

2. Please explain.

R0b0t1

2007-08-18 23:40:10

Doy. I feel stupid… Multiply by 100.

RARG! NOOO!


Well, anyway, that is the equation to convert RGB to the "H" in HSL. I need to multiply by degrees, (parts of 360) you know, the obtuse ( < 90° ) shizz.

The variables "g" and "b" are originally whole numbers, but I need them to be between 0 and 1 (you explained this).

In case this makes no sense,


<3 google.

R0b0t1

2007-08-19 13:02:41

Please! Someone that knows how to multiply by degrees!


PL0X

n3ss3s

2007-08-19 13:13:26

Close your eyes if you dont want to be rly pissed off.

Quote from SCAR manual:
procedure ColortoRGB(Color: TColor; var R, G, B: Byte);
Converts a Color to RGB values.

function RGBtoColor(R, G, B: Integer): TColor;
Converts RGB values to a color.

procedure ColortoHSL(C: TColor; var H, S, L: Extended);
Converts Color to Hue, Saturation and Luminance map.

function HSLtoColor(var H, S, L: Extended): TColor;
Converts Hue, Saturation and Luminance map to a Color.

procedure RGBtoHSL(R, G, B: Integer; var H, S, L: Extended);
Converts RGB values to Hue, Saturation and Luminance map.

procedure HSLtoRGB(H, S, L: Extended; var R, G, B: Integer);
Converts Hue, Saturation and Luminance map to RGB values.

procedure RGBtoXYZ(R, G, B: Integer; var X, Y, Z: Extended);
Converts RGB values to XYZ values of the CIE color space.

procedure XYZtoRGB(X, Y, Z: Extended; var R, G, B: Integer);
Converts XYZ values of the CIE color space to RGB values.

procedure ColortoXYZ(Color: TColor; var X, Y, Z: Extended);
Converts a Color to XYZ values of the CIE color space.

function XYZtoColor(X, Y, Z: Extended): TColor;
Converts XYZ values of the CIE color space to a color.

procedure HSLtoXYZ(H, S, L: Extended; var X, Y, Z: Extended);
Converts HSL values to XYZ values of the CIE color space.

procedure XYZtoHSL(X, Y, Z: Extended; var H, S, L: Extended);
Converts XYZ values of the CIE color space to HSL values.

R0b0t1

2007-08-19 13:18:11

I know all of that stuff, but its not what I am looking for. I need to be able to Get individual parts of the HSL.

Really, no one knows how to multiply by degrees in SCAR?

Bobarkinator

2007-08-19 13:49:41

RGBtoHSL(R,G,B,H,S,L);
WriteLn(FloatToStr(H));

?

R0b0t1

2007-08-19 14:34:11

Bobarkinator, if I'm wrong, you just made me feel really stupid.


BTW any one know how to multiply by degrees in SCAR anyway?

bullzeye95

2007-08-19 15:03:26

function ThisFunctionIsCalledMultiplyByDegreesAndWasMadeByBullzeye95ForR0b0t1(Num, Degrees: Extended): Extended;
begin
Result:= Num * (Degrees div 360);
end;
That work?

R0b0t1

2007-08-19 20:30:56

Thanks. I'll try it an see if it works right.


Lol… WTF? Sorry… Funny errors, and I'm sure my scripts right.