Autor Beitrag
Benny27
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 10:39 
hallo,
ich möchte ein projekt objektorientiert programmieren, indem ich 30 mal einen unterschiedlichen teil aus einem bitmap analysiere. dafür schreibe ich eine eigene unit in der ich nur einmal die procedure schreibe. wenn ich aber jetzt den scanline befehl in dieser unit aufrufe bekomme ich die fehlermeldung: "object or class type required" kann mir da jemand helfen???
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: Mo 10.12.07 10:43 
zeig mal bitte ein bisschen code. Ansonsten würd ich auf ein fehlendes Objekt tippen. ;-)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 11:10 
das programm ist noch nicht fertig, aber den ablauf krieg ich hin. ich weiß nur nicht was ich mit dem scanline befehl machen muss. muss ich bei uses noch was einbinden, damit der den scanline befehl versteht?

ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
unit auswertung;

interface

uses graphics,windows; 
  
type tauswertung=class(tobject)

procedure start (canv:tcanvas);

end;

implementation

procedure tauswertung.start(canv:tcanvas);

var reihe:^trgbtriple;
x:integer;
y:integer;
r:integer;
g:integer;
b:integer;
nges:integer;
neinz:integer;
tol:integer;

begin
with canv do begin

neinz:=0;
for y:= 116 to 126 do   //anzahl reihen
  begin
    reihe:=Bitmap.ScanLine[y];                       //hier kommt die fehlermeldung object or class type required
    inc(reihe,104);  //x - startwert
    for x:=0 to 10 do //breit vom x - wert
      begin
        r:=reihe^.rgbtred;   //rotwert vom pointer    edit2.text:=inttostr(r);
        g:=reihe^.rgbtGreen; //grünwert vom pointer   edit3.Text:=inttostr(g);
        b:=reihe^.rgbtBlue;  //blauwert vom pointer  edit4.text:=inttostr(b);
        if (reihe^.rgbtRed<tol) and (reihe^.rgbtGreen<tol) and (reihe^.rgbtBlue<tol) then
          begin
            nges:=nges+1;     //schwarze punkte gesamt
            neinz:=neinz+1;   //schwarze punkte von einem Loch
          end;
        inc(reihe);          //immer die nächste reihe ansprechen
      end;
  end;
  edit5.text:=inttostr(nges);  //Anzahl schwarze Punkte ausgeben

    if (neinz<35or (neinz>55then     //loch zu groß oder zu klein
    begin
      for y:= 116 to 126 do   //anzahl reihen
        begin
          reihe:=image1.Picture.Bitmap.ScanLine[y];  //rgb werte aus den reihen auslesen
          inc(reihe,105);  //x - startwert
          for x:=0 to 10 do //breit vom x - wert
            begin
              r:=reihe^.rgbtred;   //rotwert vom pointer    edit2.text:=inttostr(r);
              g:=reihe^.rgbtGreen; //grünwert vom pointer   edit3.Text:=inttostr(g);
              b:=reihe^.rgbtBlue;  //blauwert vom pointer  edit4.text:=inttostr(b);
              if (reihe^.rgbtRed<tol) and (reihe^.rgbtGreen<tol) and (reihe^.rgbtBlue<tol) then
                begin
                  reihe^.rgbtred:=255;  //Das dunkle Pixel rot einfärben
                  reihe^.rgbtgreen:=0;
                  reihe^.rgbtblue:=0;
                end;
            inc(reihe);          //immer die nächste reihe ansprechen
            end;
        image1.Repaint;          //neu zeichnen
        end;
    end;



end;
end;
end.


Moderiert von user profile iconTino: Delphi-Tags hinzugefügt
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 11:50 
hallo,

welche delphi-version verwendest du?

oder wo ist trgbtriple definiert?

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 11:56 
hi,

ich verwende delphi 6 enterprise.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
implementation

procedure tauswertung.start(canv:tcanvas);

var reihe:^trgbtriple;


ich habe den nur bei den variablen deklariert, oder muss ich den ander deklarieren ?

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 12:04 
hallo,

wo kommt den dein Bitmap her?

das ist kein Member von Canvas...

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 12:06 
ps: die einrückung ist schrecklich.

probiers mal mit GExperts und der AutoCodeFormatierungserweiterung...

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 12:10 
ich mache ein snapshot mit einer webcam, dieses foto speicher ich als bmp und rufe es nachher wieder auf.
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 12:11 
nein, du hast mich falsch verstanden,

wo ist das Bitmap deklariert?

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 12:16 
wo muss ich das GExperts denn einfügen, und was ist die AutoCodeFormatierungserweiterung?

was meinst du mit wo ist das bitmap deklariert? wir haben das in eine imagebox eingefügt
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 12:28 
Du verwendest in deiner Routine eine Variable names Bitmap.

TCanvas hat kein Member namens Bitmap.

Also musst du Bitmap irgendwo deklaerieren.

GExperts findest du unter

[url]
www.gexperts.org/
[/url]

Den Sourceformatter unter:

[url]
www.dummzeuch.de/
[/url]

genauer unter "Experimentelle GExperts Version 1.32-2007-09-22 released"

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 13:34 
hi,

also habe das mit dem scanline im griff, jedoch habe ich nun ein weiteres problem und zwar
wie kann ich einer neuen klasse die eigenschaften von zwei objekten vererben ?

schon mal danke vorab
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 13:51 
die neue klasse soll von Tobjekt und Tbitmap erben
Sinspin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1335
Erhaltene Danke: 118

Win 10
RIO, CE, Lazarus
BeitragVerfasst: Mo 10.12.07 13:57 
TBitmap ist ein TObject. TBitmap kann also schon alles was TObject kann.

_________________
Wir zerstören die Natur und Wälder der Erde. Wir töten wilde Tiere für Trophäen. Wir produzieren Lebewesen als Massenware um sie nach wenigen Monaten zu töten. Warum sollte unser aller Mutter, die Natur, nicht die gleichen Rechte haben?
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 14:06 
wenn ich jedoch nur mit tbitmap arbeite, bekomme ich bei der variablen deklaration die fehlermeldung "published field 'x1' not a class nor interface type"


hier mal das stück programmtext:


type tauswertung= class (Tbitmap)

x1:= integer;
y1:= integer;

end;
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 14:09 
nur :

ist ja keine Zuweisung

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 14:13 
oh sorry habe mich da vertippt, habe es auch mit : gemacht bekomme da die gennannte fhelermeldung
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 10.12.07 14:15 
versuchs mal so

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type TAuswertung = class(TBitmap)
public
  x1: integer;
  y1: integer;
end;


r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Benny27 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 10.12.07 14:19 
super klappt

vielen dank