Autor Beitrag
Michael Farlaub
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18


D6 PE, Indy 9
BeitragVerfasst: Do 16.06.05 17:09 
grüß euch

ich habe bissher pixel mit Canvas.Pixels[x,y] ausgelesen.
nun habe ich gehört, dass es mit scanline schneller geht.

nur ich verstehe nicht ganz wie ich damit einzelne pixel abfragen kann?



grüße


michael


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Do 16.06.2005 um 19:54
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 16.06.05 17:54 
Ohn Gewähr:
Mit Scanline bekommst Du direkten Zugriff auf die RGB Werte, sodass der RGB-Wert in Pixel [x,y] durch die drei Farbwerte ScanLine[y,3*x] (Rot), ScanLine[y,3*x+1] (Grün) und ScanLine[y,3*x+2] (Blau) abgebildet werden kann. Wenn ich mich nicht irre (bitte verifizieren) musst Du vorher die Farbtiefe auf pf24bit anpassen. Geht aber ganz einfach. Schau mal in der Hilfe nach.
Michael Farlaub Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18


D6 PE, Indy 9
BeitragVerfasst: Do 16.06.05 18:58 
danke für deine antwort

mit


ausblenden Quelltext
1:
2:
3:
bitmap.PixelFormat:= pf24Bit;
 Row := pByteArray(Bitmap.Scanline[0]);
 Row[0] := Value;


hab ich es jetzt geschafft ein pixel auszulesen.
sein integer wert 184

wie komme ich an die komplette farbinformation ran? sprich zb im hex code '000000'

grüße

michael
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 16.06.05 19:07 
Wie gesagt: mit RGBToColor (Row[0], row[1], row[2]) bekommst Du 24 bit Farbwert des ersten pixels.
Michael Farlaub Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18


D6 PE, Indy 9
BeitragVerfasst: Do 16.06.05 19:55 
danke es klappt!

hier noch die nötige funktion:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
function RGBToColor(R, G, B : byte): TColor;
begin
  Result := ((R and $FF) shl 16) +
    ((G and $FF) shl 8) + (B and $FF);
end;


thx

michael
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 16.06.05 20:08 
Sollte auch mit rgb aus windows.pas gehen :oops: