displaying_20animated_20gifs
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| displaying_20animated_20gifs [2018/03/31 13:19] – external edit 127.0.0.1 | displaying_20animated_20gifs [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =====Displaying animated GIFs===== | =====Displaying animated GIFs===== | ||
| - | //by Richard Russell, November 2007//\\ \\ | + | //by Richard Russell, November 2007 amended January 2022// |
| + | |||
| + | The easiest way of displaying | ||
| + | |||
| + | One straightforward method of displaying an animated GIF is to use an [[/ | ||
| + | |||
| + | <code bb4w> | ||
| INSTALL @lib$+" | INSTALL @lib$+" | ||
| PROC_gdipinit | PROC_gdipinit | ||
| Line 20: | Line 26: | ||
| SYS " | SYS " | ||
| SYS " | SYS " | ||
| - | You may of course put this code in a procedure or library if you don't want to clutter your main program. If you need to perform your own ' | + | </ |
| + | |||
| + | You may of course put this code in a procedure or library if you don't want to clutter your main program. If you need to perform your own ' | ||
| + | |||
| + | <code bb4w> | ||
| filename$ = " | filename$ = " | ||
| PROCanimatedgif(filename$, | PROCanimatedgif(filename$, | ||
| - | The second parameter of **PROCanimatedgif** is the time for which you want the animation to display, in centiseconds (one-hundredths of a second).\\ \\ Once you have finished with the GDI+ subsystem (typically on exit from your program) don't forget to call **PROC_gdipexit**: | + | </ |
| + | |||
| + | The second parameter of **PROCanimatedgif** is the time for which you want the animation to display, in centiseconds (one-hundredths of a second).\\ \\ Once you have finished with the GDI+ subsystem (typically on exit from your program) don't forget to call **PROC_gdipexit**: | ||
| + | |||
| + | <code bb4w> | ||
| PROC_gdipexit | PROC_gdipexit | ||
| END | END | ||
| - | Here is the all-important **PROCanimatedgif** routine:\\ \\ | + | </ |
| + | |||
| + | Here is the all-important **PROCanimatedgif** routine: | ||
| + | |||
| + | <code bb4w> | ||
| DEF PROCanimatedgif(filename$, | DEF PROCanimatedgif(filename$, | ||
| LOCAL wfile%, image%, ndims%, nframes%, frame%, psize%, xsize%, ysize% | LOCAL wfile%, image%, ndims%, nframes%, frame%, psize%, xsize%, ysize% | ||
| Line 74: | Line 92: | ||
| SYS `GdipDisposeImage`, | SYS `GdipDisposeImage`, | ||
| ENDPROC | ENDPROC | ||
| - | If the image is a ' | + | </ |
| + | |||
| + | If the image is a ' | ||
| + | |||
| + | <code bb4w> | ||
| endtime% = TIME + duration% | endtime% = TIME + duration% | ||
| SYS " | SYS " | ||
| Line 88: | Line 110: | ||
| UNTIL TIME> | UNTIL TIME> | ||
| SYS " | SYS " | ||
| + | </ | ||
| + | |||
| I'm sure you can see how you could modify this code if you wanted, for example, to display the animation for a certain number of loops or a certain number of frames, rather than for a certain time. The routine centers the GIF in the window; it could easily be modified to display it in a different position or at a different size. | I'm sure you can see how you could modify this code if you wanted, for example, to display the animation for a certain number of loops or a certain number of frames, rather than for a certain time. The routine centers the GIF in the window; it could easily be modified to display it in a different position or at a different size. | ||
displaying_20animated_20gifs.1522502356.txt.gz · Last modified: 2024/01/05 00:18 (external edit)