Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Teile eines images kopieren und in anderes image einfügen (https://www.delphipraxis.net/24645-teile-eines-images-kopieren-und-anderes-image-einfuegen.html)

Keldorn 23. Jun 2004 21:34

Re: Teile eines images kopieren und in anderes image einfüge
 
Zitat:

Zitat von Nicodius
ok dann halt der code ...

Delphi-Quellcode:
var i,j:integer;
    Bild,teilBild:TBitmap;


Bild:=TBitmapo.create();
bild.loadfromfile('c:\....');
For i:=0 to AnzahlX do
  For j:=0 to ANzahlY do
    begin
       teilBild:=TBitmap.create();
       teilbild.copyrect(round(bild.width/AnzahlX*i),round(bild.height/AnzahlY*j),
                         round(bild.width/AnzahlX*(i+1)),round(bild.height/AnzahlY*(j+1),
                         bild);
       teilbild.savetofile(....);
       teilbild.free;
    end;

das soll funktionieren? :roll:
- kein resourcenschutzblock bei bild:=tbitmap.create
- die copyrectfktn ist auch nicht korrekt
- teilbild: warum immer in der schleife erzeugen? einmal reicht
- teilbild: größe wird nicht gesetzt, du kannst kopieren was du willst und wirst nichts sehen
- evtl fehlt noch das pixelformat für die teilbitmap

jAcK oRsEn 23. Jun 2004 21:38

Re: Teile eines images kopieren und in anderes image einfüge
 
es geht nicht...


ich möchte von einem großen bild...ein teilstück in ein zweites image, welches leer ist copieren...

vom ersten bild soll das ein Stück von 105*105 pixeln sein!

Nicodius 23. Jun 2004 21:40

Re: Teile eines images kopieren und in anderes image einfüge
 
ich habs hier vom board kopiert und es geht ... der ist ja gekürzt ^^ deine teiel musst du schon ausstauschen :roll:

Keldorn 23. Jun 2004 21:42

Re: Teile eines images kopieren und in anderes image einfüge
 
Delphi-Quellcode:
a := rect(0,0,105,105); //destrect
b := rect(x*105,y*105,(x+1)*105,(y+1)*105); //srcrect
x und y geben die" Spalte und zeile" vom image 1 an

jAcK oRsEn 23. Jun 2004 21:44

Re: Teile eines images kopieren und in anderes image einfüge
 
@nicodius:bei mir gehts nicht, meldungen wie trect und int64 inkopatible typen u.s.w. ca 6 stück


keldorn: und der aufruf?

Nicodius 23. Jun 2004 21:45

Re: Teile eines images kopieren und in anderes image einfüge
 
nur mal so ne frage hast du

Delphi-Quellcode:
var a : TRect;
            b : TRect
auch geschireben sonst versteh ichs nicht :roll:

Keldorn 23. Jun 2004 21:45

Re: Teile eines images kopieren und in anderes image einfüge
 
Zitat:

Zitat von jAcK oRsEn
bei mir gehts nicht, meldungen wie trect und int64 inkopatible typen u.s.w. ca 6 stück

poste mal die prozedur

jAcK oRsEn 23. Jun 2004 21:47

Re: Teile eines images kopieren und in anderes image einfüge
 
kann mir nicht mal jemand nen code schreiben der funktioniert, ich verstehe jetzt rein garncihts mehr...noch weniger wie vprher

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);

var i,j:integer;
    Bild,teilBild:TBitmap;
begin


bild.loadfromfile('c:\jack.bmp');
For i:=0 to 1 do
  For j:=0 to 1 do
    begin
       teilBild:=TBitmap.create();
       image2.canvas.copyrect(round(bild.width/1*i),round(bild.height/1*j),
                         round(bild.width/1*(i+1)),round(bild.height/11*(j+1),
                         bild);
       teilbild.savetofile('c:\jacktemp.bmp');
       teilbild.free;
    end;

Nicodius 23. Jun 2004 21:47

Re: Teile eines images kopieren und in anderes image einfüge
 
DANN POSTE DOCH DIENEN CODE !


edit: sorry aber .. warum kannst du nicht einfach deinen code posten dann ists leichter?! :cry:

jAcK oRsEn 23. Jun 2004 21:48

Re: Teile eines images kopieren und in anderes image einfüge
 
hab ich oben


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:36 Uhr.
Seite 3 von 4     123 4      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz