Autor Beitrag
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 14.02.05 19:10 
Hey Leut's

die meisten von euch haben doch WinXP und kennen sicher den Effeckt beim öffnen des Win-Beenden Dialogs...
wo der Hintergrund langsam in graustufen umgewandelt wird.

Nun meine Frage: ist es möglich diesen Efeckt mit einem Timer und einer Function/Procedure zu realisieren?

Den Code für das umwandeln von einem Bild in Graustufen müsste bekannt sein (wurde hier glaub auch schon paarmal gepostet) aber hier nochmal zur Sicherheit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure GrauStufen(C:TCanvas);
var x, y: integer;
  Color: LongInt;
  R, G, B, Gr: Byte;
begin
  with C do begin
    for x:= ClipRect.Left to ClipRect.Right do
      for y:= ClipRect.Top to ClipRect.bottom do
      begin
        Color:=ColorToRGB(Pixels[x,Y]);

        R := GetRValue(Color);
        G := GetGValue(Color);
        B := GetBValue(Color);

        Gr:= Trunc(B*0.11+G*0.59+R*0.3);
        Pixels[x,Y] := RGB(Gr, Gr, Gr);
      end;
  end;
end;


Schon mal Danke im voraus, für eure Hilfe... :D
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mo 14.02.05 19:14 
Wieso nicht?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Timer1Timer(Sender. TObject);
begin
  Graustufen(EinObjekt.Canvas);
end;


AXMD
Stefan-W Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 14.02.05 19:17 
hmm... ich habs noch nicht versucht aber macht der Code nicht das Bild mit einem Schlag von Farbig in Graustufen?
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: Mo 14.02.05 19:22 
Du hast ja die RGB-Werte jedes Pixels, und die Grauwerte für diese Farbe.

Die 'Zwischen-Pixel' erhält man dann mit
ausblenden Delphi-Quelltext
1:
2:
3:
round(r - (r-grau)*x);
round(g - (g-grau)*x);
round(b - (b-grau)*x);
, wobei x ein Wert zwischen 0 und 1 ist. Ist x gleich 0, dann ist der Pixel farbig, für x=1 grau. In der Timer Prozedur muss man dann nur x kontinuierlich erhöhen.

Edit: Ich seh grade, dass ich über 1000 Beiträge habe. Zurückgerechnet dürfte dieser hier der Jubiläums-beitrag gewesen sein :party:

_________________
We are, we were and will not be.


Zuletzt bearbeitet von Gausi am Mo 14.02.05 22:48, insgesamt 2-mal bearbeitet
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mo 14.02.05 19:22 
Das kann ich dir nicht sagen, ich kenn den Code nicht ;). Außerdem würd ich Scanline verwenden - mit den Pixels[]-Zugriffen wirst du alt...

AXMD
Stefan-W Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: Mo 14.02.05 19:27 
@Gausi: gut danke ich versuchs mal

@AXMD: ich seh mir das mal an und werd das dann vielleicht auch nehmen, wenn du sagst das das schneller ist...