Autor Beitrag
Nano-Ware
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Mo 13.09.10 18:02 
Hey,

ich würde gern einen Punkt (rot) auf einer weißten Fläche (TImage) bewegen. Wie stelle ich das an? (Ich kenn mich nicht wirklich mit Canvas aus)


Danke schonmal
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Mo 13.09.10 18:14 
So kannst du die Farbe eines Pixels setzen:

ausblenden Delphi-Quelltext
1:
Image1.Canvas.Pixels[5,3]:= ClRed; // ClWhite; sechste Zeile, vierte Spalte...					

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
Nano-Ware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Mo 13.09.10 18:18 
Ja das wusste ich ;D aber muss ich dann den alten roten immer wieder weiß färben?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mo 13.09.10 18:22 
na ja. Indem man ihn weiß übermalt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
  point : TPoint;
begin
  canvas.pixels[point.x,point.y] := clWhite;
  point.x := point.x + 1;
  point.y := point.y + 2
  canvas.pixels[point.x,point.y] := clRed;
end;
Nano-Ware Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: Mo 13.09.10 19:36 
Okay also doch so umständlich wie ich gedacht hab :'P ich hätte noch ein kleines problem ich wollte jetzt eine Line zeichnen (LineTo) erstmal habe ich jetzt eine normale linie in schwarz gezeichnet jetzt möchte ich den linken punkt der linie nach oben schieben und damit die ganze linie. Muss ich jetzt auch die ganze linie übermalen? Und dann eine neue malen? Wenn ja flackert das nicht fürchterlich?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mo 13.09.10 19:39 
Du könntest mit Doublebuffering arbeiten.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 14.09.10 07:08 
Außerdem würd ich dir zu einem Off-Screen-Bitmap raten. Da kannst du hintergrund und neu gezeichnetes schön von einander trennen.

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Di 14.09.10 12:20 
user profile iconNano-Ware hat folgendes geschrieben Zum zitierten Posting springen:
ich würde gern einen Punkt (rot) auf einer weißten Fläche (TImage) bewegen.
Ich würde es mit Sprites machen. Ist zwar etwas mehr Aufwand, dafür kann sich aber das Ergebnis sehen lassen. Beispiele siehe hier: delphiforfun.org/pro...niques/animation.htm