Hi Leute
Mein erster Code mit Scanline:
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:
| Procedure TForm1.ChangeImage(bit: TBitmap; Value: Integer); Type ByteArray = Array[1..3] Of Byte; Var h, w: Integer; p: ^ByteArray; i:integer; Begin bit.PixelFormat:= pf24Bit; i:=0; For h := 0 to bit.Height-1 Do Begin p := bit.ScanLine[h]; For w := 0 To bit.Width-1 Do Begin Begin inc(i); p^[1] := 255; p^[2] := 0; p^[3] := 0; End; End; End; Label2.Caption:=IntToStr(i); End; |
Es hat keinen wirklichen sinn, ich dachte eigentlich bloß, teile des Images blau zu färben. Als NICHTS geschah hab ich mal die If-Abfrage auskommentiert. Weiterhin NICHTS.
Ausgelößt wird das ganze so:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7:
| Procedure TForm1.ScrollBar1Change(Sender: TObject);Begin Label1.Caption := IntToStr(ScrollBar1.Position); Image1.Picture.Bitmap.LoadFromFile(open.Filename); ChangeImage(Image1.Picture.Bitmap,Scrollbar1.Position); Image1.Refresh; End; |
Was hab ich denn nun schon wieder falsch gemacht X_x