Autor Beitrag
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: So 25.05.03 11:32 
Hi Leutz,
mein Problem ist, dass ich einem per Create erstelltem TBitMap eines Ausschnitt eines anderen tBitMaps Objekt zuweisen möchte. Ich hab´das mit CopyRect versucht klappt aber nicht.
Sieht ungefähr so aus:
ausblenden Quelltext
1:
2:
3:
vbmp := tBitMap.create;
//Hier möchte ich vbmp den Auschnitt rect(x1,y1,x2,y2) des image1.picture.bitmap zuweisen
vbmp.assign(image1.picture.bitmap);

Ich hab´s so versucht:
ausblenden Quelltext
1:
2:
vbmp.width := x2; vbmp.height := y2;
vbmp.canvas.copyrect(rect(0,0,x2,y2), image1.canvas, rect(x1,y1,x2,y2));
funktioniert aber nicht.

Wer kann mir helfen?
Danke schon im Vorraus.

mfg
GSE


Moderiert von user profile icontommie-lie: Topic verschoben

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
GSE Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mo 26.05.03 15:50 
Hab´s jetzt so gelöst:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
  if x2 >= x1 then dx := x2-x1 else dx := x1-x2;
  if y2 >= y1 then dy := y2-y1 else dy := y1-y2;
  vbmp := TBitMap.create;
  vbmp.assign(image1.picture.bitmap);
  vbmp.canvas.copyrect(Rect(0,0,dx,dy), vbmp.canvas, rect(x1,y1,x2,y2));
  vbmp.width := dx;
  vbmp.height := dy;


Erst wird dem erstellten TBitMap das ganze Bild zugewiesen, dann wird der ausgewählte Bereich in die linke obere Ecke kopiert und das BitMap wird entsprechend verkleinert.

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)