Entwickler-Ecke

Multimedia / Grafik - paintbox: FläschenFarbverlauf Zeichen?


ALF - Di 29.06.10 13:24
Titel: paintbox: FläschenFarbverlauf Zeichen?
Hi, ob das Topic richtig ist?
Mein Problem ist eigentlich mathematisch :mrgreen:
Ich möchte die Farbwerte in Abhängigkeit von der Höhe der Paintbox machen.Der Endwert der Farbe soll dann 255 sein

Delphi-Quelltext
1:
2:
3:
4:
5:
6:
for y:=0 to PaintBox1.Height-1 do
  begin
    paintbox1.Canvas.Pen.Color:=RGB(133+y,135+y,148+y);//<--hie rmüsste also ne Formel hin?
    PaintBox1.Canvas.MoveTo(PaintBox1.Left,PaintBox1.Top+y);
    PaintBox1.Canvas.LineTo(PaintBox1.Width,PaintBox1.Top+y);
  end;

Fragt mich nicht, was ich alles versucht/gesucht habe!? Problem ist ja das ich nie den Endwert von 255 erreiche.
Die Werte sind ja abhängig von der Höhe, Startwert zb. 133 zu Endwert 255 prozentual zur Höhe, oder so.
Habs also nicht gepackt die logik zu erkennen :cry:

Gruss Alf


bummi - Di 29.06.10 13:57


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  y:Integer;
begin
for y:=0 to PaintBox1.Height-1 do
  begin

    paintbox1.Canvas.Pen.Color:=RGB( Trunc(133+ (255 - 133) / PaintBox1.Height *y) , Trunc(135+ (255 - 133) / PaintBox1.Height *y) , Trunc(148+ (255 - 133) / PaintBox1.Height *y) );//<--hie rmüsste also ne Formel hin?
    PaintBox1.Canvas.MoveTo(PaintBox1.Left,PaintBox1.Top+y);
    PaintBox1.Canvas.LineTo(PaintBox1.Width,PaintBox1.Top+y);
  end;
end;


ALF - Di 29.06.10 14:11

Nice :beer:
Seit 3 Tagen fumle ich daran :shock:
kleine Korektur noch von mir8) , wegen C&P, funct aber Super!

Danke!!!!

Gruss Alf