Autor Beitrag
eniac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Win 98, Win XP, SuSE Linux 9.0
D3 Prof
BeitragVerfasst: Fr 27.08.04 10:44 
Sers,

man kann ja TColor-Variablen als Zahlen-Werte angeben: 65536*blau+256*grün+rot !
Kann man auch Integer-Variablen in TColor-Variablen umwandeln???
Geht das auch umgekehrt (TColor in Integer)?

Danke für Bemühungen im Vorraus ...
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 27.08.04 10:47 
Hallo

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
color:=rgb(rot,grün,blau]

rot :=getRvalue(color);
grün:=getGvalue(color);
blau:=getBvalue(color);


meinst du das?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
eniac Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Win 98, Win XP, SuSE Linux 9.0
D3 Prof
BeitragVerfasst: Fr 27.08.04 11:09 
Wenn ich deine Antwort richtig verstanden habe, dann kann ich auf diese Weise die Rot-/Grün-/Blauanteile auslesen und einer Integer-Variable zuweisen.

Geht das auch umgekehrt?
Wenn ich z.B. für eine Integer-Variable den Wert 255 habe müsste das irgendwie Rot für die TColor-Variable ergeben.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 27.08.04 11:11 
das ist dann die erste Zeile
ausblenden Delphi-Quelltext
1:
color:=rgb(rot,grün,blau)					

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
eniac Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Win 98, Win XP, SuSE Linux 9.0
D3 Prof
BeitragVerfasst: Fr 27.08.04 11:28 
ahh... ich habs verstanden . :lol: Rot, grün und blau sind also die Integer-Variablen!

vielen Dank für die Hilfe!
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Fr 27.08.04 13:42 
eniac hat folgendes geschrieben:
65536*blau+256*grün+rot

Hiermit hast du deine Frage schon beantwortet, denn das kannst du direkt zuweisen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  c : TColor;
  r, g, b : Integer;
begin
  //...
  c:=b*65536+g*256+r;//ist kein Problem so
  r:=c mod 256;//und andersrum
  g:=c mod 65536 shr 8;
  b:=c div 65536;