Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 28.07.06 17:34 
Hatte Langeweile und habe ein wenig mit Image1.Canvas rumgespielt und dabei ungewollt einen Algorithmus zum Zeichnen einer Schneeflocke geschrieben. :mrgreen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure Schneeflocke (ACanvas: TCanvas; PenWidth,X,Y: integer; AColor: TColor);
var i: integer;
begin
  with Acanvas do
  begin
    for i := 1 to PenWidth do
    begin
      Pixels[X-i,Y-i] := AColor;
      Pixels[X,Y-i] := AColor;
      Pixels[X+i,Y-i] := AColor;

      Pixels[X-i,Y] := AColor;
      Pixels[X,Y] := AColor;
      Pixels[X+i,Y] := AColor;

      Pixels[X-i,Y+i] := AColor;
      Pixels[X,Y+i] := AColor;
      Pixels[X+i,Y+i] := AColor;
     end;
     ACanvas.Pixels[X,Y] := AColor
   end;
end;

Ab PenWidth=5 sieht man es deutlich. ;)
Ok, das brauch eigentlich keiner...
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 28.07.06 23:52 
Wie kann man denn die Procedur aufrufen, wenn man keine Ahnung hat ?
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 28.07.06 23:56 
user profile iconBlackheart666 hat folgendes geschrieben:
Wie kann man denn die Procedur aufrufen, wenn man keine Ahnung hat ?

ausblenden volle Höhe Delphi-Quelltext
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:
private
  procedure Schneeflocke (ACanvas: TCanvas; PenWidth,X,Y: integer; AColor: TColor);

...

implementation

// eventuell anderen Prozeduren
procedure TForm1.Schneeflocke (ACanvas: TCanvas; PenWidth,X,Y: integer; AColor: TColor);
var i: integer;
begin
  with Acanvas do
  begin
    for i := 1 to PenWidth do
    begin
      Pixels[X-i,Y-i] := AColor;
      Pixels[X,Y-i] := AColor;
      Pixels[X+i,Y-i] := AColor;

      Pixels[X-i,Y] := AColor;
      Pixels[X,Y] := AColor;
      Pixels[X+i,Y] := AColor;

      Pixels[X-i,Y+i] := AColor;
      Pixels[X,Y+i] := AColor;
      Pixels[X+i,Y+i] := AColor;
     end;
     ACanvas.Pixels[X,Y] := AColor
   end;
end;

//Aufruf aus einer Methode heraus
Schneeflocke(Form1.Canvas,8,100,100,clGreen);

//am besten macht sich
Form1.Color := clNavy;
Schneeflocke(Form1.Canvas,8,100,100,clWhite);
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 29.07.06 00:04 
Ich Finds Genial - Super !!!
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 29.07.06 00:06 
user profile iconBlackheart666 hat folgendes geschrieben:
Ich Finds Genial - Super !!!

:?!?:
:lol: Sorry, aber die Begeisterung kann ich dir nicht ganz abnehmen :lol: Was ist daran denn 'genial' und 'super'?
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 29.07.06 00:10 
Natürlich mit einem Augenzwinkern, aber trotzdem Ich finds Gut (Wirklich) !!!
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 29.07.06 00:13 
user profile iconBlackheart666 hat folgendes geschrieben:
Natürlich mit einem Augenzwinkern, aber trotzdem Ich finds Gut (Wirklich) !!!

Naja auch egal, mehr Spielerei als Nutzen.