forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GIF animation
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Sep 20, 2012 11:17 am    Post subject: GIF animation Reply with quote

Do anyone have PCX/GIF animation program written in Clearwin? I have one written 15 years ago but when i compile it now it does not work anymore. It was written by dumbest complex way using all common blocks from huge hydrocode which now are completely changed plus i do not find such functions like PCX_TO_SCREEN_BLOCK, also program uses DOS program ALCHEMY to transform and resize files etc -- total darkness...it's easier to kill it and rewrite it from zero then fix it.

If you do not have one, then may be you will suggest how you'd write it? Just simplest skeleton how you think best way to write it is appreciated, like this
- after opening clearwin graphics window read all files ending with "gif" (i suppose it's using files@). Files i have are called something like this a001.gif, a002.gif ....
- make a cycle which visualizes them listening keyboard input to stop/continue/ accelerate/decelerate animation
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Sep 22, 2012 4:49 pm    Post subject: Reply with quote

winio@("%gi[...]") provides one approach where the animation is built into a GIF resource file.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Sep 23, 2012 10:13 am    Post subject: Reply with quote

Dan, Paul,

To make an animated GIF you need the appropriate software, but that does seem to me to be the answer if the animation takes up a small area of the screen, and is the same every time the program is run - like files going into the waste paper basket and such gimmicks.

The do it yourself approch could have a series of GIFs (or any other file format) drawn on top of each other. I suspect timing is vital. I have an initial splash screen that fades away using a SetWindowOpacity routine that was posted on this forum, and I discovered that to fade down the image in 2 seconds was as long as I could tolerate, and as this occurred in 255 steps, the rate was then 127 steps per second, set with a %dl.

To overlay the files, I would set up a %gr area, and use IMPORT_IMAGE@ in a callback to a %dl format code. I see that the latest version of FTN95 has proper support for the GIF format in IMPORT_IMAGE@ and IMPORT_GIF@. It isn't necessary to overlay the images over the whole %gr, just the parts that change. I suppose I would use images in my RESOURCES for speed, rather than loading them from disk one at a time, if it was the same animation run every time.

As well as timing, getting them in the right order is an issue if they are loaded from named files (generated as output from some other program), and also the animation will stutter if there is a lot going on in a computer at the same time. While there is a lot to be said about reading and storing all the files before starting to display them, if they were simple bitmaps, I don't think I would bother with copying to and from DIBs, instead I would use the painter's algorithm and just keep importing the images into the %gr area.

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Sep 25, 2012 11:55 am    Post subject: Reply with quote

I need both. Sometimes your custom animator is needed to be paused, stopped, and go back on specific frame etc. I've done that with PCX using Clearwin and it was useful. I showed such animations on the conferences, and when people have questions it is important to have full control of animation. With current support of GIF all can be done even more efficiently.

I've used also someones GIF animation programs but don't have them anymore. Which GIF animator program you know is good ?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Sep 25, 2012 7:11 pm    Post subject: Reply with quote

Dan,

Many years ago I used Graphics Workshop from Alchemy Mindworks. To my surprise they are still in business, and trading at http://www.mindworkshop.com/. It's try before you buy...

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Sep 27, 2012 1:08 am    Post subject: Reply with quote

Thanks all for suggestions.


P.S. Oct 07 2012

By the way i've tried PhotoScape and like it. Surprised it is completely free, i do not know how these people survive, unless they operate on photosynthesis and solar power. LOL.

It has absolutely intuitive GIF animator as one of the options. You just drag-and-drop GIF files and save the result. Behind the hood i even did not look - it has soooo many options if anyone needs them.

I'd still encourage Clearwin+ fans to write GIF player and post the source here. Just don't have time to do that myself
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Wed Nov 14, 2012 11:12 am    Post subject: Re: Reply with quote

DanRRight wrote:

I'd still encourage Clearwin+ fans to write GIF player and post the source here. Just don't have time to do that myself

I found a C# snippet for writing animated gifs. Based on that I wrote a module in Component Pascal for animated gif creation.

Currently it can scan all image files in a directory, sort them alphabetically, scale images to desired size and write animated gif from them. I also created a simple window form to play gif animation, so finished animated gif can be previewed.

These routines can be called from FTN95 Clearwin+ program.

I will clean up some stuff, add exception handling and put sources and DLL's available for download.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Nov 16, 2012 12:07 pm    Post subject: Reply with quote

That would be great, thanks for efforts.
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Sat Nov 17, 2012 10:06 pm    Post subject: Re: Reply with quote

DanRRight wrote:
That would be great, thanks for efforts.

Simple FTN95 callable animated GIF creator available here for testing.

The example project reads source image files from the "in" directory and then outputs the animated target GIF files into the "out" directory.

Let me know, if you find bugs. I will try to add simple Clearwin+ front end and then put all sources available.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Nov 18, 2012 6:03 am    Post subject: Reply with quote

It works. Produces visible squares in dark areas though for large JPG files and sometimes a lot of noise in grayish areas probably trying to find the best 8bit color for 24bit original. But for some specific contents all looks fine

Does your program take GIF files for input or only JPG? Things are that JPG is typically compressed lossy format, so people in science and engineering do not use it for animation purposes because it will show spontaneous noise on the wide slowly changing color areas which is specifically visible when scaling image size.
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Sun Nov 18, 2012 10:13 am    Post subject: Re: Reply with quote

DanRRight wrote:

Does your program take GIF files for input or only JPG? Things are that JPG is typically compressed lossy format, so people in science and engineering do not use it for animation purposes because it will show spontaneous noise on the wide slowly changing color areas which is specifically visible when scaling image size.



It seem's to work with some GIF formatted files, but not all of them.

Currently I just simply use .NET's Bitmap Class to read the image data and dumb the data in GIF image format into a buffer.

You should also be able to use: PNG, BMP and TIFF images as source files.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Nov 18, 2012 3:06 pm    Post subject: Reply with quote

Great. When and if you will be making Clearwin shell to it please look at the implementation of Photoscape GIF animator - everything done just by simple clicks and drag and drops, no single instance of typing. And if Paul some day implement the template for such resizable sub-windows Clearwin misssing very much our programs would look very professionally !
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Sun Nov 18, 2012 4:34 pm    Post subject: Re: Reply with quote

DanRRight wrote:

When and if you will be making Clearwin shell to it please look at the implementation of Photoscape GIF animator - everything done just by simple clicks and drag and drops, no single instance of typing.

I was thinking about a simple Clearwin+ user interface for the first version. Maybe use parameter box for animated GIF creation parameters and some buttons attached to directory browser dialog for selecting input and ouput directories. Simple and a nice addition would be to allow source image directory to be selected using drag and drop.

Feel free to help with the user interface creation! Wink

I have added simple image file validation for source images, so wrongly formatted images should now be handled gracefully.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Nov 18, 2012 5:42 pm    Post subject: Reply with quote

Dan,

I am not sure what you are looking for but here is some old code that implements a MDI sample...
Code:
      winapp
c--------------------------------------------------------------
      include <windows.ins>
      integer i,c0,c1,c2,h1,h2,cwh1
      logical L
      common h1,h2
      external child_func

      i=winio@('%ww[no_border]%ca[MDI frame]&')
      i=winio@('%mn[&Child]&',child_func)
      i=winio@('%pv%fr&',400,400)
      i=winio@('%lw',c0)

      i=winio@('%aw&',c0)
      i=winio@('%ww[no_border]%ca[First Child]&')
      i=winio@('%sm[&Child]&',child_func)
      i=winio@('%pv%30.3`cw[hscroll,vscroll]&',7,cwh1)
      i=winio@('%lw&',c1)
      i=winio@('%hw',h1)

      call set_max_lines@(cwh1,50L)
      write(7,*) 'Hello there!'

      i=winio@('%aw&',c0)
      i=winio@('%ww[no_border]%ca[Second Child]&')
      i=winio@('%pv%gr[black,metafile_resize]&',200,200)
      i=winio@('%lw&',c2)
      i=winio@('%hw',h2)

      call ellipse@(100,100,50,50,14)
      L=BringWindowToTop(h1)

      end

C--------------------------------------------
      integer function child_func()
      include <clearwin.ins>

      integer h,hh,i
      integer h1,h2
      common h1,h2

      h=clearwin_info@('FOCUS_WINDOW')
      hh=0
      if(h.eq.h1) hh=1
      if(h.eq.h2) hh=2
      if(hh.gt.0) then
        i=winio@('Window %wd is active %2nl%cn%`7bt[OK]',hh)
      endif

      child_func=1
      end
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Nov 18, 2012 5:46 pm    Post subject: Reply with quote

Again, here is some old code for drag and drop but I find that it needs a kick start under Windows 7. To kick start I disable/re-enable drag-and-drop from the Windows 8 Start menu.

Code:
       winapp
c---------------------------------------------------
       integer i,winio@,x,y
       external drop_func
       character*100 filename
       common filename,x,y
       filename=' '
       i=winio@('%ca[Drag and drop]Dropped file:&')
       i=winio@('%gp&',x,y)
       i=winio@('%dr&',drop_func)
       i=winio@('%2nl%60st',filename)       
       end
c --------------------------------------------------
       integer function drop_func()
       include <clearwin.ins>
       character*100 filename
       integer i,x,y
       common filename,x,y
       filename(1:100)=clearwin_string@('DROPPED_FILE')
       call window_update@(filename)
       i=winio@('%sp%ww[naked]%cn%8tt[Pause]',x+5,y-5)
       drop_func=1
       end
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group