Autor Beitrag
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 11.10.05 19:57 
Hi Leute

Mein erster Code mit Scanline: :)
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:
23:
24:
25:
26:
Procedure TForm1.ChangeImage(bit: TBitmap; Value: Integer);
Type
    ByteArray = Array[1..3Of 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
            //If p^[1] + p^[2] + p^[3] > Value Then
            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:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Procedure TForm1.ScrollBar1Change(Sender: TObject);//Fragt nicht warum ich ne ScrollBar genommen hab oO
Begin
  Label1.Caption := IntToStr(ScrollBar1.Position);
  Image1.Picture.Bitmap.LoadFromFile(open.Filename);//TOpenPictureDialog.
  ChangeImage(Image1.Picture.Bitmap,Scrollbar1.Position);
  Image1.Refresh;
End;

Was hab ich denn nun schon wieder falsch gemacht X_x
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 11.10.05 20:15 
Moin!

Guck dir doch mal diesen Fred hier an, das sollte dir weiter helfen. :wink:

user profile iconLossy eX hat den passenden Code und user profile iconjornbyte den korrekten Algo für den Grauwert. Wenn du blau färben willst, dann setzt du nur den Grauwert für blau, fertig.

cu
Narses
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 12.10.05 14:21 
ACH VERDAMMT.
Kann mir nicht einfach jemand sagen, dass ich vergessen hab, den Pointer zu erhöhen? ^^ mal schaun obs jetzt klappt.
rofl hier ist es:
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:
23:
24:
25:
26:
27:
Procedure TForm1.ChangeImage(bit: TBitmap; Value: Integer);
Type
    ByteArray = Array[1..3Of 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
            If p^[1] + p^[2] + p^[3] > Value Then
            Begin
            inc(i);
                p^[1] := 255;
                p^[2] := 255;
                p^[3] := 255;
            End;
            inc(p); 
        End;
    End;
Label2.Caption:=IntToStr(i);
End;


Damit hat sichs erledigt ^^ ganz lustiger effekt übrigens.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.