Autor Beitrag
Fighti
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Do 08.04.04 08:58 
Hallo,
kann mir irgend jemand bei meinen Problem helfen.

Und zwar habe ich folgendes Problem:
Ich will 4 Kartenteile auf eine TImage-Komponete ausgeben. Das ist auch kein Problem. Mein Problem besteht darin die Karte zu scrollen und die neuen Kartenstücke nachzuladen. Denn wenn ich das versuche braucht delphi jeweils 1-2 Sekunden um die neuen Kartenauschnitte anzuzeigen. Und diese stocken kann ich nicht gebrauchen.

Ich danke euch schon im Vorraus für eure Hilfe.

mfg

Fighti
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Do 08.04.04 12:26 
lad die bilder von anfang an in 4 buffer, aus denen du dann dein Bild zusammensetzen kannst, als 4xTBitmap(keine Komponente!) erstellen, laden, beim rendern auf dein Formular/sonst was kleben und nicht vergessen bei onclose wieder freigeben

MathiasH

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Do 08.04.04 12:37 
Tja, das mach ich zur Zeit auch. Ich verwende jedoch den Typen TJEPGImage, weil ich davon die Eigenschaft scale brauche um die Bilder zu zoomen.
Mein Problem besteht jedoch darin das ich nicht nur 4 Bilder habe sondern 96.
Und von diesen will ich immer 4 Stück ausgeben. Das funktioniert auch nur wenn ich dann die Karte scrollen will brauch mein prog etwa 1-2 Sekunden um die nächsten 4 Bilder zu laden.

Falls es jemandem Hilft ein Stück meines Quellcodes:

ausblenden volle Höhe 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:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls;

type
  Tmachmal = class(TForm)
    im: TImage;
    sbh: TScrollBar;
    sbv: TScrollBar;
    Label1: TLabel;
    lab: TLabel;
    procedure scrollen(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure ladeBild(typ : String; name : String);
  public
    { Public-Deklarationen }
  end;

var
  machmal  : Tmachmal;
  wid    : integer;
  hei    : integer;
  sca    : integer;
  ax     : integer;
  ay     : integer; 
  momx   : integer;
  momy   : integer;
  altx   : integer;
  alty   : integer;
  bildol : TJPEGImage;
  bildor : TJPEGImage;
  bildul : TJPEGImage;
  bildur : TJPEGImage;
  scale  : TJPEGScale;

implementation

{$R *.dfm}

procedure Tmachmal.ladeBild(typ : String; name : String);
begin
   if(typ = 'bildol') then
   begin
      bildol:=TJPEGImage.Create;
      bildol.LoadFromFile(name+'.jpg');
      bildol.Scale:=scale;
   end;
   if(typ = 'bildor') then
   begin
      bildor:=TJPEGImage.Create;
      bildor.LoadFromFile(name+'.jpg');
      bildor.Scale:=scale;
   end;
   if(typ = 'bildul') then
   begin
      bildul:=TJPEGImage.Create;
      bildul.LoadFromFile(name+'.jpg');
      bildul.Scale:=scale;
   end;
   if(typ = 'bildur') then
   begin
      bildur:=TJPEGImage.Create;
      bildur.LoadFromFile(name+'.jpg');
      bildur.Scale:=scale;
   end;
end;

procedure Tmachmal.scrollen(Sender: TObject);
var
   x  : integer;
   y  : integer;
   nx : integer;
   ny : integer;
begin
   label1.Caption:=inttostr(sbv.Position);
   x:=round((sbh.Position mod 5250)/sca)*-1;
   y:=round((sbv.Position mod 3600)/sca)*-1;
   momx:=sbh.Position div 5250;
   momy:=sbv.Position div 3600;
   lab.Caption:=inttostr(momx)+' '+inttostr(momy);
   //if(((altx <> momx) or (alty <> momy)) and (momy < 11) and (momx < 7)) then
   if((altx <> momx) or (alty <> momy)) then
   begin
      label1.Caption:='Karte wird geladen ...';

      if(momx > altx) then
      // move nach rechts
      begin
         bildol:=bildor;
         bildul:=bildur;
         if(momx < 7) then
         begin
            ladeBild('bildor',inttostr(momy)+inttostr(momx+1));
            ladeBild('bildur',inttostr(momy+1)+inttostr(momx+1));
         end;
      end;

      if(momx < altx) then
      // move nach links
      begin
         bildor:=bildol;
         bildur:=bildul;
         ladeBild('bildol',inttostr(momy)+inttostr(momx));
         ladeBild('bildul',inttostr(momy+1)+inttostr(momx));
      end;

      if(momy > alty) then
      // move nach unten
      begin
         bildol:=bildul;
         bildor:=bildur;
         if(momy < 11) then
         begin
            ladeBild('bildul',inttostr(momy+1)+inttostr(momx));
            if(momx < 7) then ladeBild('bildur',inttostr(momy+1)+inttostr(momx+1));
         end;
      end;

      if(momy < alty) then
      // move nach oben
      begin
         bildul:=bildol;
         bildur:=bildor;
         ladeBild('bildol',inttostr(momy)+inttostr(momx));
         if(momx < 7) then ladeBild('bildor',inttostr(momy)+inttostr(momx+1));
      end;
   end;

   im.Canvas.Draw(x,y,bildol);
   nx:=x+wid;
   im.Canvas.Draw(nx,y,bildor); 
   ny:=y+hei;
   im.Canvas.Draw(x,ny,bildul);
   im.Canvas.Draw(nx,ny,bildur);

   altx:=momx;
   alty:=momy;
end;

procedure Tmachmal.FormCreate(Sender: TObject);
begin
   sca := 8;
   if(sca = 1) then scale:=jsFullSize;
   if(sca = 2) then scale:=jsHalf;
   if(sca = 4) then scale:=jsQuarter;
   if(sca = 8) then scale:=jsEighth;
   hei := round(3600/sca);
   wid := round(5250/sca);
   sbv.Max:=43200-(sca*400);
   sbh.Max:=42000-(sca*400);
   altx:=0;
   alty:=0;

   ladeBild('bildol',inttostr(momy)+inttostr(momx));
   ladeBild('bildor',inttostr(momy)+inttostr(momx+1));
   ladeBild('bildul',inttostr(momy+1)+inttostr(momx));
   ladeBild('bildur',inttostr(momy+1)+inttostr(momx+1));
end;

end.
Ragnara
Hält's aus hier
Beiträge: 7


D6 Pers
BeitragVerfasst: Fr 09.04.04 18:22 
Tja, dann würde ich sagen:
Mach ein array, dass alle 96 Bilder im Create-Event lädt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var
 Bildarray: array[0..11] of array[0..7] of TJPEGImage; //Hier nehme ich 12X8 als Gesamtgröße, kannste natürlich ändern...

...

procedure TForm1.Create;
var i,j: Byte;
begin
for i := 0 to 11 do for j := 0 to 7 do 
begin
Bildarray[i,j] := TJPEGImage.Create;
Bildarray[i,j].LoadFromFile(InttoHex(i,2) + InttoHex(j,2) + '.jpg';
end
end;


Hier habe ich für die Bilder Dateinamen wie
0000.jpg ; 0001.jpg; 0A01.jpg und ähnlichem angenommen (X-Koordinate in Hex, Y-Koordinate in Hex), um sie bequem in einer Schleife zu laden.
Stattdessen kannst du das natürlich auch so machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Create;
var i,j: Byte;
begin
for i := 0 to 11 do for j := 0 to 7 do Bildarray[i,j] := TJPEGImage.Create;
Bildarray[0,0].LoadFromFile('GanzObenLinks.jpg');
Bildarray[1,0].LoadFromFile('BildGanzObenZweitesVonLinks.jpg');
...
end;


Diese Dateinamen nicht ernstnehmen :D

Dann brauchst du noch zwei Byte-Variablen, die die Koordinaten von dem Bild oben links speichern (von dem Bild, dass oben links angezeigt werden soll). Da kannst du natürlich auch eine Bereichsprüfung einbauen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
type TXKoordinate = 0..10;
       TYKoordinate = 0..6;//Jeweils noch ein Bild kleiner als die max. Position, da ja noch ein Bild daneben bzw. dadrunter ist

var
 XPos: TXKoordinate;
 YPos: TYKoordinate;

//Anzeigen...
bildol := Bildarray[XPos,YPos];
bildor := Bildarray[XPos+1,YPos];
bildul := Bildarray[XPos,YPos+1];
bildur := Bildarray[XPos+1,YPos+1];

_________________
cya
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Sa 10.04.04 09:10 
ohm, ganz sicher das das ne tole lösung ist?
96 images a geschätzt 1mb(jpeg müssen ja zum anzeigen dekomprimiert werden, oder nicht?)
ich würde eher sagen man sollte die images von einem eigenen theread laden lassen. damit es nie zu problemen kommt legt man um den spieler herum einen 3x3 matrix von bildern an, sobald der spieler zwischen zwei bildern wechselt werden 3 aus dem speicher entfernt und 3 neue geladen, die demnächst verwendet werden könnten

MathiasH

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Sa 10.04.04 14:58 
Ich würd gern mal wissen, was diese Karte zeigt, denn 96 Bilder zu 1 MB JPEG (!!!) - das müssen ja Mordsauflösungen sein!

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Sa 10.04.04 15:22 
die größenangabe 1mb ist von mir für die dekomprimierte variante, aber bei genauerem Überlegen muss jpeg glaub ich intern garnicht als bmp gespeichert werden...

ich nehm mal an, er will ne recht komplexe karte für ein Spiel machen, sowas in der art von BGII, da kann man nicht mit tiles arbeiten, sondern muss fast große images erstellen

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Sa 10.04.04 16:07 
@Fighti

Zuersteinmal solltest du die Karten vorher so skalieren wie zie zum Schluß auf dem Monitor ausgegeben werden. Also nicht erst im Spiel. Zweites kannst du auch Bitmaps skalieren. Ich weiß nicht wie du auf die Idee kommst, daß man nur Jpegs skalieren kann.

_________________
Gruß
Martin
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: So 11.04.04 14:01 
@MartinPb:
Ich kann die Bilder schon vorher Skallieren. Nur muss ich dann 3*96 Bilder vorvertigen weil ich die Karte in 3 Auflösungen brauche.
Und wie kann ich Bitmaps skallieren, wenn ich fragen darf?

@DaRkFiRe:
die Karte zeigt eine Landkarte wie du sie auch kennst. Von Ortschaften, Flüssen, Strassen und Häuser.

@MathiasH:
wie würde denn so ein Thread aussehen?

@Alle:
schon mal danke für eure Bemühungen.
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: So 11.04.04 16:04 
zu den threads: schau mal zu den delphi baispielen bzw in die Forums FAQ. Was du für diese sache allerdings noch bauen musst ist das auswechseln der kästchen, denn die 3 die nicht mehr gebraucht werden müssen ja nach vorne verschoben werden, wo sie vielleicht gebraucht werden können, d.h. du musst eine weitere matrix anlegen, in der du speicherst, welches bild wo im speicher liegt

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
phpchris
Hält's aus hier
Beiträge: 4



BeitragVerfasst: So 11.04.04 18:08 
Nochmal zu den *.ico-Dateien, hat jemand eine Idee?

//Edit: Sorry, falscher Thread
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Di 13.04.04 13:23 
@MathiasH:
Danke für dein Tipp. Ich hab jetzt mal einen thread geschriben. Der mir ein Bild in den Speicher lädt. Nur wird mein Prog immer noch ca. 1 Sekunde blokiert bis das Bild geladen wurde.
Sollte der Thread nicht im Hintergrund laufen oder versteh ich da was falsch?


Zuletzt bearbeitet von Fighti am Di 13.04.04 14:19, insgesamt 1-mal bearbeitet
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Di 13.04.04 13:40 
Fighti hat folgendes geschrieben:
@MartinPb:
Und wie kann ich Bitmaps skallieren, wenn ich fragen darf?

mit Canvas.StretchDraw.

Du mußt aber die Proportionen beachten. Mal grob aus dem Kopf:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  ZielBmp.Width := QuellBmp.Width div 2; // zuerst die Größe Ziel-Bitmap ...
  ZielBmp.Height := QuellBmp.Height div 2; // festlegen.

  ZielBmp.Canvas.StretchDraw(ZielBmp.Canvas.ClipRect, QuellBmp)


Müßte aber richtig sein.

Wenn ich nocht eine Frage stellen dürfte: warum drei Größen? Hab ich noch nie gesehen, daß ein Spiel drei größen hatte. Höchstens bei einem DirectX Game.

_________________
Gruß
Martin
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Di 13.04.04 14:13 
MartinPb hat folgendes geschrieben:
Wenn ich nocht eine Frage stellen dürfte: warum drei Größen? Hab ich noch nie gesehen, daß ein Spiel drei größen hatte. Höchstens bei einem DirectX Game.

Drei grössen darum, weil es sich nicht um ein Spiel handelt, sondern, wie oben schon erwähnt, um eine Landkarte. Und die will ich in drei Zoomstufen ausgeben können. Desshalb verwende ich auch die Eigenschaft Scale dammit ich die Karte nicht in 3 Grössen als Bilder ablegen muss.
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Di 13.04.04 14:16 
Wie schon gesagt, die kannst du auch als eine Bitmap ablegen und stuffenlos skalieren.

_________________
Gruß
Martin
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Mi 14.04.04 07:50 
Wenn der Therad richtig geschrieben ist sollte die anwendung durch ihn nicht zum erliegen kommen, allerdings musst du beachten, dass der Therad natürlich aufgerufen werden muss, bevor die Bilder benötigt werden (dafür die 3x3 Bitmap Matrix), wenn du den Therad erst aufrufst, wenn die Bilder effektiv benötigt werden muss dein Programm natürlich auf diesen Warten und "hängt"

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Mi 14.04.04 08:03 
@MathiasH:
ich habe eigentlich darauf geachtet das die bilder noch nicht gebracuth werden. aber vielleicht hab ich mich verschrieben. kannst du vielleicht mal den code überprüfen? Währe echt nett.

Hier mein code:
unit Unit1:
ausblenden volle Höhe 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:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls,Unit2;

type
  Tmachmal = class(TForm)
    im: TImage;
    sbh: TScrollBar;
    sbv: TScrollBar;
    Label1: TLabel;
    procedure scrollen(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormResize(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure ladeBild(typ : String; name : String);
  public
    { Public-Deklarationen }
  end;

var
  machmal  : Tmachmal;
  wid    : integer;
  hei    : integer;
  sca    : integer;
  ax     : integer;
  ay     : integer; 
  momx   : integer;
  momy   : integer;
  altx   : integer;
  alty   : integer;
  bildol : TJPEGImage;
  bildor : TJPEGImage;
  bildul : TJPEGImage;
  bildur : TJPEGImage;

  BILDTYP    : String;
  BILDNAME   : String;
  BILDOLDNAME   : String;

  scale  : TJPEGScale;

  bildorr : TJPEGImage;
  bildurr : TJPEGImage;
  bilduul : TJPEGImage; 
  bilduur : TJPEGImage;

  SecondThread : TMyThread;

implementation

{$R *.dfm}

procedure Tmachmal.ladeBild(typ : String; name : String);
var
   bild : TJPEGImage;
begin
   bild:=TJPEGImage.Create;
   bild.LoadFromFile(name+'.jpg');
   bild.Scale:=scale;
   
   if(typ = 'bildol') then bildol:=bild;
   if(typ = 'bildor') then bildor:=bild;
   if(typ = 'bildul') then bildul:=bild;
   if(typ = 'bildur') then bildur:=bild;

   if(typ = 'bildorr') then bildorr:=bild;
   if(typ = 'bilduul') then bilduul:=bild;
   if(typ = 'bilduur') then bilduur:=bild;
   if(typ = 'bildurr') then bildurr:=bild;
end;

procedure Tmachmal.scrollen(Sender: TObject);
var
   x  : integer;
   y  : integer;
   nx : integer;
   ny : integer;
begin
   x:=round(((sbh.Position-im.Width) mod 5250)/sca)*-1;
   y:=round(((sbv.Position-im.Height) mod 3600)/sca)*-1;
   x:=x-round(im.Width/sca);
   y:=y-round(im.Height/sca);
   momx:=(sbh.Position-im.Width) div 5250;
   momy:=(sbv.Position-im.Height) div 3600;
   //lab.Caption:=inttostr(momx)+' '+inttostr(momy);
   if((altx <> momx) or (alty <> momy)) then
   begin
      label1.Caption:='Karte wird geladen ...';
      label1.Refresh;

      {if(momx > (altx+1)) then
      // move nach rechts
      begin
         bildol:=bildor;
         bildul:=bildur;
         bildor:=bildorr;
         bildur:=bildurr;
         if(momx < 7) then
         begin
            ladeBild('bildorr',inttostr(momy)+inttostr(momx+2));
            ladeBild('bildurr',inttostr(momy+1)+inttostr(momx+2));
         end;
      end;

      if(momx < altx) then
      // move nach links
      begin
         bildorr:=bildor;
         bildurr:=bildur;
         bildor:=bildol;
         bildur:=bildul;
         ladeBild('bildol',inttostr(momy)+inttostr(momx));
         ladeBild('bildul',inttostr(momy+1)+inttostr(momx));
      end; }

      if(momy > alty) then
      // move nach unten
      begin
         bildol:=bildul;
         bildor:=bildur;
         bildul:=bilduul;
         bildur:=bilduur;
         if(momy < 11) then
         begin
            BILDTYP:='bilduul';
            BILDNAME:=inttostr(momy+2)+inttostr(momx);
            //ladeBild('bilduul',inttostr(momy+2)+inttostr(momx));
            //if(momx < 7) then ladeBild('bilduur',inttostr(momy+2)+inttostr(momx+1));
         end;
      end;

      {if(momy < alty) then
      // move nach oben
      begin
         bildul:=bildol;
         bildur:=bildor;
         ladeBild('bildol',inttostr(momy)+inttostr(momx));
         if(momx < 7) then ladeBild('bildor',inttostr(momy)+inttostr(momx+1));
      end;
      label1.Caption:='';
      label1.Refresh;  }
   end;

   im.Canvas.Draw(x,y,bildol);
   nx:=x+wid;
   im.Canvas.Draw(nx,y,bildor);
   ny:=y+hei;
   im.Canvas.Draw(x,ny,bildul);
   im.Canvas.Draw(nx,ny,bildur);

   altx:=momx;
   alty:=momy;
end;

procedure Tmachmal.FormCreate(Sender: TObject);
begin
   BILDTYP:='';
   BILDNAME:='';
   BILDOLDNAME:='';
   SecondThread := TMyThread.Create(False);
   bildol:=TJPEGImage.Create;
   bildor:=TJPEGImage.Create;
   bildul:=TJPEGImage.Create;
   bildur:=TJPEGImage.Create;

   bildorr:=TJPEGImage.Create;
   bilduul:=TJPEGImage.Create;
   bilduur:=TJPEGImage.Create;
   bildurr:=TJPEGImage.Create;
   sca := 8;
   if(sca = 1) then scale:=jsFullSize;
   if(sca = 2) then scale:=jsHalf;
   if(sca = 4) then scale:=jsQuarter;
   if(sca = 8) then scale:=jsEighth;
   hei := round(3600/sca);
   wid := round(5250/sca);
   sbv.Max:=43200-(sca*im.Width);
   sbh.Max:=42000-(sca*im.Height);
   altx:=0;
   alty:=0;

   ladeBild('bildol',inttostr(momy)+inttostr(momx));
   ladeBild('bildor',inttostr(momy)+inttostr(momx+1));
   ladeBild('bildul',inttostr(momy+1)+inttostr(momx));
   ladeBild('bildur',inttostr(momy+1)+inttostr(momx+1));

   ladeBild('bildorr',inttostr(momy)+inttostr(momx+2));
   ladeBild('bildurr',inttostr(momy+1)+inttostr(momx+2));
   ladeBild('bilduul',inttostr(momy+2)+inttostr(momx));
   ladeBild('bilduur',inttostr(momy+2)+inttostr(momx+1));
end;

procedure Tmachmal.FormResize(Sender: TObject);
begin
   im.Height:=machmal.Height-80;
   im.Width:=machmal.Width-50;
   label1.Top:=machmal.Height-50;
   sbh.Top:=machmal.Height-70;
   sbv.Left:=machmal.Width-40;  
   sbh.Width:=machmal.Width-50;
   sbv.Height:=machmal.Height-80;  
   sbv.Max:=43200-(sca*im.Width);
   sbh.Max:=42000-(sca*im.Height);
end;

end.


Thread:
ausblenden volle Höhe 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:
unit Unit2;

interface

uses
  Classes,jpeg;

type
  TMyThread = class(TThread)
  private
    { Private-Deklarationen }
  protected
    procedure Execute; override;
  end;

implementation

uses Unit1;

{ Wichtig: Methoden und Eigenschaften von Objekten in visuellen Komponenten dürfen 
  nur in einer Methode namens Synchronize aufgerufen werden, z.B.

      Synchronize(UpdateCaption);

  und UpdateCaption könnte folgendermaßen aussehen:

    procedure TMyThread.UpdateCaption;
    begin
      Form1.Caption := 'Aktualisiert in einem Thread';
    end; }

{ TMyThread }

procedure TMyThread.Execute;
var
   bild : TJPEGImage;
begin
   while not Terminated do
   begin
      if(BILDNAME <> BILDOLDNAME) then
      begin
         bild:=TJPEGImage.Create;
         bild.LoadFromFile(BILDNAME+'.jpg');
         bild.Scale:=scale;
   
         if(BILDTYP = 'bildol') then bildol:=bild;
         if(BILDTYP = 'bildor') then bildor:=bild;
         if(BILDTYP = 'bildul') then bildul:=bild;
         if(BILDTYP = 'bildur') then bildur:=bild;

         if(BILDTYP = 'bildorr') then bildorr:=bild;
         if(BILDTYP = 'bilduul') then bilduul:=bild;
         if(BILDTYP = 'bilduur') then bilduur:=bild;
         if(BILDTYP = 'bildurr') then bildurr:=bild;
         BILDOLDNAME:=BILDNAME;
      end;
   end;
   Terminate;
end;

end.


Vielleicht noch also hilfe. ich verwende folgende matrix,
und ich habe erst den teil mit dem scrollen nach unten implementiert. somit lade ich immer 2 bilder nach.

bildol bildor
bildul bildur
bilduul bilduur
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Mi 14.04.04 08:15 
m ich hab grad mal durchgesehen, mir fällt kein Fehler auf, allerdings bin ich aufgrund einer Lan gestern auch noch nicht wirklich wach :wink:

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Mi 14.04.04 08:34 
@MathiasH: Ok... :-) Trotzdem danke.

@Alle: wer sieht was bzw. wer kann mir weiterhelfen?!?