Autor Beitrag
nepleurepas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: So 15.10.06 13:07 
Hallo,

wie kann man Pixel, oder irgendwelche andere Einheiten auf dem Bildschirm ansteuern? Hab mal snake auf meinem grafikfähigen taschenrechner programmiert und wollte es nun mal in delphi versuchen.
Falls die Frage so einfach nicht beantwortet werden kann wäre es ja net wenn Ihr mir irgendeinen link posten könntet.

Vielen dank im vorraus

Stefan
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: So 15.10.06 13:19 
Wie meinst du "auf dem Bildschirm"? Einen Pixel von einem TImage oder vom Desktop?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
nepleurepas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: So 15.10.06 16:12 
user profile iconMarco D. hat folgendes geschrieben:
Wie meinst du "auf dem Bildschirm"? Einen Pixel von einem TImage oder vom Desktop?



Weiß nicht was ein Timage ist. Brauche halt eine möglichkeit auf jeden pixel innerhalb des laufenden Programmfensters zugreifen zu können. So irgendwie zeile y, spalte x, farbe. Hoff mal du verstehst was ich mein.

Gruß
Stefan
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 15.10.06 17:10 
Hallo,

ein TImage ist eine Komponente die Du auf deine Form legen kannst, um diese dann zum Zeichnen zu verwenden.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Image1.Canvas.Pixels[200,200] := clRed;
end;

Damit färbst Du einen Pixel auf dem TImage.

Du kannst aber auch direkt auf das Canvas der Form zeichnen.

ausblenden Delphi-Quelltext
1:
Canvas.Pixels[200,200] := clRed;					

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 15.10.06 18:24 
nimm lieber gleich Canvas.Rectangle, sonst ist entweder alles zu klein oder du machst du viel aufwand und am ende läuft es dann ultralangsam.
nepleurepas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: Mi 18.10.06 14:45 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
nimm lieber gleich Canvas.Rectangle, sonst ist entweder alles zu klein oder du machst du viel aufwand und am ende läuft es dann ultralangsam.


Was macht canvas.rectangle und wie lautet die syntax?


Gruß
Stefan
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Mi 18.10.06 14:47 
zu 1. Zeichnet ein Rechteck/Quadrat
zu 2. siehe Online Hilfe

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
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: Mi 18.10.06 15:12 
mit Scanline kann man auch auf bestimmte Pixel zugreifen ist aber deutlich schneller als Canvas.Pixels. mehr darüber gibts auf www.dsdt.info

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.