Prinudjen sam da pokusam i ovde, svasta sam probao, Google-ao po netu kao blesav, pregledao sto puta help fajl, faq fajl, demo programe i primere... Ne razumem, nesto sto je naizgled toliko prosto nece pa nece da radi.
Imam problema sa prikazom trenutnog frejma aktivnog gif-a.
Instalirao sam u Delphi TGifImage, i sad u okviru komponente TImage mogu da ubacim gif fajl. Kako TGifImage dodaje jos gomilu mogucnosti za rad sa samim gif-om, postoji i opcija (parametar, kako vec) prikaza aktivnog frejma, a sintaksa ide
Ocigledno imam problem da pozovem ovaj parametar, tj. probao sam i sa tajmerom, koji bi na recimo svakih 0.5 sekundi izvrsavao nesto tipa
Nemam problema sa pokretanjem programa, sve radi osim sto se broj frejmova ne ispisuje, tj. sa ovakvom procedurom (tajmer na 0.5 sec) se u labelu prilikom prvog ontimer dogadjaja upise -1 (sto bi trebalo da je prvi frejm, ne znam zasto ali tako ga prikazuje), i tu i ostane, na -1.
Evo primera iz FAQ fajla, samo da napomenem da nisam uspeo da ga umetnem u svoj kod tako da radi :(
U primeru koji dolazi uz TGifImage (GifExplorer) se lepo ispisuje broj frejmova za sliku za koju ja pokusavam da ispisem to isto na svojoj formi, ali ocito da negde gresim, moze li mi neko pomoci...?
Evo kako izgleda deo koda iz primera Exlporer...
Ja sam se potrudio da objasnim svoj problem, ne znam koliko sam u tome uspeo i koliko ste me razumeli, ali ako vam je potrebna jos neka informacija, kod, sta vec, kazite.
Hvala unapred, propadoh uz ovo :(
Imam problema sa prikazom trenutnog frejma aktivnog gif-a.
Instalirao sam u Delphi TGifImage, i sad u okviru komponente TImage mogu da ubacim gif fajl. Kako TGifImage dodaje jos gomilu mogucnosti za rad sa samim gif-om, postoji i opcija (parametar, kako vec) prikaza aktivnog frejma, a sintaksa ide
Code:
TGifPainter(slika1.Picture.Graphic).ActiveImage : integer;
, gde je slika1 naziv komponente TImage na formi (u TImage je ucitan gif).TGifPainter(slika1.Picture.Graphic).ActiveImage : integer;
Ocigledno imam problem da pozovem ovaj parametar, tj. probao sam i sa tajmerom, koji bi na recimo svakih 0.5 sekundi izvrsavao nesto tipa
Code:
Label1.Caption := IntToStr(TGifPainter(slika1.Picture.Graphic).ActiveImage);
Label1.Refresh;
, gde je Label1 labela u kojoj zelim da se ispisuje broj trenutnog frejma.Label1.Caption := IntToStr(TGifPainter(slika1.Picture.Graphic).ActiveImage);
Label1.Refresh;
Nemam problema sa pokretanjem programa, sve radi osim sto se broj frejmova ne ispisuje, tj. sa ovakvom procedurom (tajmer na 0.5 sec) se u labelu prilikom prvog ontimer dogadjaja upise -1 (sto bi trebalo da je prvi frejm, ne znam zasto ali tako ga prikazuje), i tu i ostane, na -1.
Evo primera iz FAQ fajla, samo da napomenem da nisam uspeo da ga umetnem u svoj kod tako da radi :(
Citat:
I can't figure out (after spending a long time reading the help
and looking at the demo code) how to get the index of the current
frame in an animated gif. This would be very useful in order make a
text comment in a memo when a certain frame is played thereby
synchronizing text and gif.
Is there a way to get the frame number currectly displayed?
To display the frame number of an animated GIF file:
and looking at the demo code) how to get the index of the current
frame in an animated gif. This would be very useful in order make a
text comment in a memo when a certain frame is played thereby
synchronizing text and gif.
Is there a way to get the frame number currectly displayed?
To display the frame number of an animated GIF file:
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog.Execute then
begin
Image.Picture.Assign(nil);
FrameLabel.Caption := '';
Image.Picture.LoadFromFile(OpenPictureDialog.FileName);
if (Image.Picture.Graphic is TGifImage) then
TGifImage(Image.Picture.Graphic).OnPaint := OnGifPaint;
end;
end;
procedure TForm1.OnGifPaint(Sender: TObject);
var
ai: Integer;
begin
ai := (Sender as TGIFPainter).ActiveImage;
FrameLabel.Caption := IntToStr(ai);
FrameLabel.Refresh;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog.Execute then
begin
Image.Picture.Assign(nil);
FrameLabel.Caption := '';
Image.Picture.LoadFromFile(OpenPictureDialog.FileName);
if (Image.Picture.Graphic is TGifImage) then
TGifImage(Image.Picture.Graphic).OnPaint := OnGifPaint;
end;
end;
procedure TForm1.OnGifPaint(Sender: TObject);
var
ai: Integer;
begin
ai := (Sender as TGIFPainter).ActiveImage;
FrameLabel.Caption := IntToStr(ai);
FrameLabel.Refresh;
end;
U primeru koji dolazi uz TGifImage (GifExplorer) se lepo ispisuje broj frejmova za sliku za koju ja pokusavam da ispisem to isto na svojoj formi, ali ocito da negde gresim, moze li mi neko pomoci...?
Evo kako izgleda deo koda iz primera Exlporer...
Code:
// Update status bar (on animate)
procedure TFormExplorer.OnAnimate(Sender: TObject);
begin
if not(Sender is TGIFPainter) then
exit;
if (TGIFPainter(Sender).ActiveImage < 0) then
begin
StatusBar.Panels[1].Text := '';
end else
begin
StatusBar.Panels[1].Text := ' Frame '+IntToStr(TGIFPainter(Sender).ActiveImage+1) +
' of '+IntToStr(TGIFPainter(Sender).Image.Images.Count);
StatusBar.Update;
end;
end;
// Update status bar (on animate)
procedure TFormExplorer.OnAnimate(Sender: TObject);
begin
if not(Sender is TGIFPainter) then
exit;
if (TGIFPainter(Sender).ActiveImage < 0) then
begin
StatusBar.Panels[1].Text := '';
end else
begin
StatusBar.Panels[1].Text := ' Frame '+IntToStr(TGIFPainter(Sender).ActiveImage+1) +
' of '+IntToStr(TGIFPainter(Sender).Image.Images.Count);
StatusBar.Update;
end;
end;
Ja sam se potrudio da objasnim svoj problem, ne znam koliko sam u tome uspeo i koliko ste me razumeli, ali ako vam je potrebna jos neka informacija, kod, sta vec, kazite.
Hvala unapred, propadoh uz ovo :(