Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 20.12.05 15:06 
hi ;)

wie kann ich eine farbe in Hue Saturation und Value zerlegen, und auch wieder zusammenfügen ? minmalwert = 0, maximalwert = 100.

danke schonmal ;)
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 20.12.05 15:09 

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 20.12.05 15:15 
Ich bin mir nicht ganz sicher, aber Dieser Thread dürfte dir weiterhelfen. Ziemlich am Ende sind ein paar Prozeduren. Allerdings ist da von HSL die Rede - balf haben wir das Alphabet durch :lol:

_________________
We are, we were and will not be.
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Di 20.12.05 16:58 
schau mal in der Unit GraphUtil 8)

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 20.12.05 17:03 
hab ich net
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 20.12.05 18:23 
HSV = HSB <> HSL: V steht für Value, B für Brightness, L für Luminocity

Sei der Farbton H rot und die Saturierung (S) maximal. Der Unterschied sieht man am folgenden Beispiel:
HSV mit variablem V: V=0 = schwarz, V=50% = dunkelrot, V=100% = rot
HSL mit variablem L: L=0 = schwarz, L=50% = rot, L=100% = weiss

RGB zu HSV bzw. HSL habe ich - wenn mich nicht alles täuscht - irgendwo hier im Forum gepostet.
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 20.12.05 18:25 
also hatte ich doch in gewisserweise reicht mit HSB :P
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 20.12.05 18:30 
Hier noch einge meiner Posts über das Thema:
rgb2hsv: www.delphi-forum.de/....php?p=246442#246442
rgb2hsl: www.delphi-forum.de/....php?p=246881#246881

Die Rückkonversion habe ich auf php.net in PHP gepostet. Aber ich bin überzeugt, dass du es auch anderswo in Delphi findest. Ansonsten kannst du ja das hier übersetzen.
ausblenden volle Höhe PHP-Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
<?php
// $c = array($red, $green, $blue)
// $red=[0..1], $green=[0..1], $blue=[0..1];
function rgb2hsv($c) {
 list($r,$g,$b)=$c;
 $v=max($r,$g,$b);
 $t=min($r,$g,$b);
 $s=($v==0)?0:($v-$t)/$v;
 if ($s==0)
  $h=-1;
 else {
  $a=$v-$t;
  $cr=($v-$r)/$a;
  $cg=($v-$g)/$a;
  $cb=($v-$b)/$a;
  $h=($r==$v)?$cb-$cg:(($g==$v)?2+$cr-$cb:(($b==$v)?$h=4+$cg-$cr:0));
  $h=60*$h;
  $h=($h<0)?$h+360:$h;
 }
 return array($h,$s,$v);
}

// $c = array($hue, $saturation, $brightness)
// $hue=[0..360], $saturation=[0..1], $brightness=[0..1]
function hsv2rgb($c) {
 list($h,$s,$v)=$c;
 if ($s==0)
  return array($v,$v,$v);
 else {
  $h=($h%=360)/60;
  $i=floor($h);
  $f=$h-$i;
  $q[0]=$q[1]=$v*(1-$s);
  $q[2]=$v*(1-$s*(1-$f));
  $q[3]=$q[4]=$v;
  $q[5]=$v*(1-$s*$f);
  return(array($q[($i+4)%6],$q[($i+2)%6],$q[$i%6]));
 }
}
?>
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 20.12.05 18:38 
danke, das sollte gehen, werde es mal ausprobieren ;)
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: So 14.05.06 18:03 
vielleicht hift dir ja dieser Thread Farbvergleich weiter.

ansonsten bin ich ratlos :roll:
Gruß

_________________
[b]Ich weiß nicht immer, wovon ich rede. Aber ich weiß, dass ich recht habe.[b]
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: So 14.05.06 18:05 
Edit: Sorry, bin irgenwie in den Falschen Thread gerutscht.

_________________
[b]Ich weiß nicht immer, wovon ich rede. Aber ich weiß, dass ich recht habe.[b]