Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 26.06.05 15:55 
Hallo :D

Ich habe gerade angefangen ein Programm zu schreiben, welches Gifs in Sprites umwandeln soll, ist auch schon fast fertig, jedoch bekomme ich die Gif-Frames nicht in meine Bitmap kopiert, zuerst habe ich es mit Draw probiert und jetzt mit BitBlt, aber das Bild bleibt weiß, warum ?
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:
procedure TForm1.SpeedButton3Click(Sender: TObject);
var
  GIF: TGifImage;
  BMP: TBitmap;
  FrameInfo: TFrameInfo;
  nstr: string;
  i, w: integer;
begin
  GIF := TGifImage.Create(nil);
  BMP := TBitmap.Create;
  BMP_Path := edit2.text;
  try
    if GIF.loadfromFile(GIF_Path) then
      begin
        BMP.Height := Gif.ImageHeight;
        BMP.Width := Gif.ImageWidth * Gif.NumFrames;
        for i := 1 to Gif.NumFrames do
          begin
            FrameInfo := GIF.GetFrameInfo(i);
            BitBlt(BMP.Canvas.Handle, i * Gif.ImageWidth - Gif.ImageWidth, 0, Gif.ImageWidth, Gif.ImageHeight, FrameInfo.iiImage.Handle, 0, 0, SRCCopy);
          end;
        nstr := ExtractFilename(Gif_Path);
        delete(nstr, pos('.gif', nstr) + 1, 3);
        nstr := nstr + 'bmp'; 
        BMP.SaveToFile(BMP_Path + nstr);
      end;
  finally
    Gif.Free;
    Bmp.Free;
  end;
end;
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 26.06.05 19:01 
ganz dummer fehler, hatte das handle vom bild und nicht vom canvas übergeben :lol:
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:
procedure TForm1.SpeedButton3Click(Sender: TObject);
var
  GIF: TGifImage;
  BMP: TBitmap;
  FrameInfo: TFrameInfo;
  nstr: string;
  i, w: integer;
begin
  GIF := TGifImage.Create(nil);
  BMP := TBitmap.Create;
  BMP_Path := edit2.text;
  try
    if GIF.loadfromFile(GIF_Path) then
      begin
        BMP.Height := Gif.ImageHeight;
        BMP.Width := Gif.ImageWidth * Gif.NumFrames;
        for i := 1 to Gif.NumFrames do
          begin
            FrameInfo := GIF.GetFrameInfo(i);
            BitBlt(BMP.Canvas.Handle, i * Gif.ImageWidth - Gif.ImageWidth, 0, Gif.ImageWidth, Gif.ImageHeight, FrameInfo.iiImage.Canvas.Handle, 0, 0, SRCCopy);
          end;
        nstr := ExtractFilename(Gif_Path);
        delete(nstr, pos('.gif', nstr) + 1, 3);
        nstr := nstr + 'bmp'; 
        BMP.SaveToFile(BMP_Path + nstr);
      end;
  finally
    Gif.Free;
    Bmp.Free;
  end;
end;

funzt jetzt