Autor Beitrag
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Di 24.05.05 21:04 
Hallo
Ich habe Zwei Tbitmaps und möchte nun aus dem ersten Tbitmap einen ausschnitt in das zweite Tbitmap kopieren,wobei das zweite tbitmap die größe des ausschnitts haben soll. Wie mache ich das?
Muetze1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 346



BeitragVerfasst: Di 24.05.05 21:07 
Moin!

1. 2. Bitmap anlegen und die gewünschte Ausschnittsgrösse festlegen bzw. dem Bitmap setzen (Width/Height)
2. Mit z.B. TCanvas Methode CopyRect() des zweiten Bitmaps den angegebenen Ausschnitt vom ersten Bitmap auf das 2. Bitmap kopieren.
3. Fertig

Wo genau liegt nun das Problem?

MfG
Muetze1

_________________
49 63 68 68 61 62 65 6B 65 69 6E 65 41 68 6E 75 6E 67 21
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Di 24.05.05 21:09 
ausblenden Delphi-Quelltext
1:
bitmap := CopyRect(ziel, tileset,quelle);					


so?
quelle und ziel sind 2 trects...
sag mir immer: copyrect: undefinirter bezeichner
in welcher unit ist das drinne?
welche muss ich da einbinden?

Edit:
ok ist "windows"
aber nu:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function TTileset.show_image(row,col:integer):tbitmap;//Row und Col geben die Position des Tiles im Tileset an
var quelle,ziel:trect;
tile:tbitmap;
begin
tile := tbitmap.Create;
tile.Width := 20
tile.Height := 20;
quelle := rect(x*row, col*y, x*row+x,y*col+y); // x und y sind die an anderer stelle definieren Breiten der einzelbilder (x=y=20)
ziel := rect(0, 0, x, y);
tile.Canvas.CopyRect(ziel,tileset.Canvas ,ziel);
result := tile;
end;


warum wird trotzdem immer immer nur da erste tile angezeigt?
Tileset sieht so aus 8 einzelbilder in 2 reihen, die werte sind jeweils row/col
ausblenden Quelltext
1:
2:
3:
4:
5:
+---+---+---+---+
|0,0|1,0|2,0|3,0|
+---+---+---+---+
|1,0|1,1|2,1|3,1|
+---+---+---+---+
Muetze1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 346



BeitragVerfasst: Di 24.05.05 22:37 
Moin!

user profile iconDarkHunter hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
tile.Canvas.CopyRect(ziel,tileset.Canvas ,ziel);					


Vllt weil du 2x Ziel als Rechteck angegeben hast?

MfG
Muetze1

_________________
49 63 68 68 61 62 65 6B 65 69 6E 65 41 68 6E 75 6E 67 21
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Mi 25.05.05 07:11 
user profile iconMuetze1 hat folgendes geschrieben:
Moin!

user profile iconDarkHunter hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
tile.Canvas.CopyRect(ziel,tileset.Canvas ,ziel);					


Vllt weil du 2x Ziel als Rechteck angegeben hast?

MfG
Muetze1


kann man so doof sein und das falsch machen?
Offensichtlig ja... :P Denn jetzt geht es.
Danke