Page 1 of 3

GIF animation demo

Posted: Wed Dec 16, 2009 5:58 pm
by gfilatov
Hello Friends,

I want to present a small GIF animation demo based upon the Harbour TGif class.

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2002-09 Roberto Lopez <harbourminigui@gmail.com>
 *
 * Based upon sample Minigui\Samples\Advanced\AnimatedGif
 * Author: P.Chornyj <myorg63@mail.ru>
 *
 * Harbour TGif class
 * Copyright 2009 Grigory Filatov <gfilatov@freemail.ru>
*/

#include "minigui.ch"

Function Main()
Local oGif

	SET MULTIPLE OFF WARNING

	DEFINE WINDOW Form_Main ;
		AT 0,0 ;
		WIDTH 0 HEIGHT 0 ;
		TITLE 'Gif89 Demo' ;
		MAIN NOMAXIMIZE NOSIZE ;
		ON INTERACTIVECLOSE OnClose( oGif )

		DEFINE MAIN MENU

			DEFINE POPUP "&File" 

				MENUITEM '&Play' ACTION IIF( !oGif:IsRunning(), oGif:Play(), )
				MENUITEM '&Stop' ACTION IIF( oGif:IsRunning(), oGif:Stop(), )
				SEPARATOR
				MENUITEM "E&xit" ACTION OnClose( oGif )

			END POPUP

			DEFINE POPUP "&?" 

				MENUITEM "GIF &Info" ACTION IIF( oGif:nTotalFrames > 1, ;
					( oGif:Stop(), MsgInfo( ;
					"Picture name" + Chr(9) + ": " + cFileNoPath( oGif:cFileName ) + CRLF + ;
					"Image Width"  + Chr(9) + ": " + hb_ntos( oGif:nWidth ) + CRLF + ;
					"Image Height" + Chr(9) + ": " + hb_ntos( oGif:nHeight ) + CRLF + ;
					"Total Frames" + Chr(9) + ": " + hb_ntos( oGif:nTotalFrames ) + CRLF + ;
					"Current Frame" + Chr(9) + ": " + hb_ntos( oGif:nCurrentFrame ), ;
					"GIF Info" ), oGif:Play() ), )

			END POPUP

		END MENU

		oGif := TGif():New( 'santa.gif', 20, 20, 120, 350, 95 )

	END WINDOW

	Form_Main.Width := Max( 180, oGif:nWidth + 2 * GetBorderWidth() + 40 )
	Form_Main.Height := GetTitleHeight() + oGif:nHeight + 2 * GetBorderHeight() + 60
	oGif:nLeft := ( Form_Main.Width - oGif:nWidth - 2 * GetBorderWidth() ) / 2 + 1

	DRAW PANEL IN WINDOW Form_Main ;
		AT oGif:nTop - 2, oGif:nLeft - 2 ;
		TO oGif:nBottom, oGif:nRight

	CENTER WINDOW Form_Main

	ACTIVATE WINDOW Form_Main

Return Nil

/*
*/
Function OnClose( oGif )

	oGif:End()

	ThisWindow.Release()

Return Nil
Your comments are welcome :!:

Re: GIF animation demo

Posted: Wed Dec 16, 2009 6:26 pm
by luisvasquezcl
Hi Grigory,
excelent demo ...
best regards,
luis vasquez

Re: GIF animation demo

Posted: Wed Dec 16, 2009 6:39 pm
by Vanguarda
Hi friends,

Thanks Grigory for share this nice demo.

Best regards,

Re: GIF animation demo

Posted: Wed Dec 16, 2009 7:36 pm
by Rathinagiri
Thanks for sharing Grigory.

Re: GIF animation demo

Posted: Sat Dec 19, 2009 9:12 pm
by Ricci
gfilatov wrote:Hello Friends,

I want to present a small GIF animation demo based upon the Harbour TGif class.
Your comments are welcome :!:
Where do i get this TGif class ? I can´t compile your source.

Solved :D
And learned: never use a directory name with a space for compiling ("Animated GIFs") !!

But i´m still not able to compile: "DRAW PANEL IN WINDOW ..."
Compiler didn´t know the word PANEL.

Re: GIF animation demo

Posted: Sat Dec 19, 2009 9:27 pm
by Roberto Lopez
gfilatov wrote:Hello Friends,

I want to present a small GIF animation demo based upon the Harbour TGif class.
<...>
Your comments are welcome :!:
Nice!

Re: GIF animation demo

Posted: Sun Dec 20, 2009 10:57 am
by gfilatov
Ricci wrote:
gfilatov wrote:Hello Friends,

I want to present a small GIF animation demo based upon the Harbour TGif class.
Your comments are welcome :!:
Where do i get this TGif class ? I can´t compile your source.

Solved :D
And learned: never use a directory name with a space for compiling ("Animated GIFs") !!

But i´m still not able to compile: "DRAW PANEL IN WINDOW ..."
Compiler didn´t know the word PANEL.
Hello,

The command DRAW PANEL exists in the HMG Extended Edition.
The new TGif class will be available at the next buid of HMG EE :arrow:

Re: GIF animation demo

Posted: Sun Dec 20, 2009 4:27 pm
by Ricci
gfilatov wrote:The command DRAW PANEL exists in the HMG Extended Edition.
What is the difference between the Standard and the Extended Edition?
Which one should i use?
At the moment i use HMG 3 Test XII.

Re: GIF animation demo

Posted: Sun Dec 20, 2009 6:17 pm
by gfilatov
Ricci wrote:
gfilatov wrote:The command DRAW PANEL exists in the HMG Extended Edition.
What is the difference between the Standard and the Extended Edition?
Which one should i use?
At the moment i use HMG 3 Test XII.
Ricci,

Thanks for your interest :!:
It is an individual preference because the Extended Edition is a fork from the Official HMG and based upon Borland C++ (preferable), MinGW or Pelles C compilers. :idea:

Re: GIF animation demo

Posted: Sun Dec 20, 2009 7:23 pm
by Roberto Lopez
gfilatov wrote: The command DRAW PANEL exists in the HMG Extended Edition.
The new TGif class will be available at the next buid of HMG EE :arrow:
:mrgreen:

Could be you so kind to post the DRAW PANEL command source code adapted for HMG?

So, I could add in the 'PROPOSED.FEATURES' folder of the next HMG release... or better... you could add the code to HFCL.

TIA.