Wrap up GIF export; support speed

Different speed settings in slideshow dialog affect the speed
of the exported GIF.
This commit is contained in:
Bill Kendrick 2020-07-29 22:09:10 -07:00
parent 63b5aa15d6
commit c13c543cfe
3 changed files with 18 additions and 4 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$
2020.July.27 (0.9.25)
2020.July.29 (0.9.25)
* New Features
------------
* Export drawings:
@ -19,7 +19,6 @@ $Id$
* Depends on "libimagequant", from the "pngquant2" project:
https://github.com/ImageOptim/libimagequant
(GPL v3 or later, for Free/Libre Open Source Software)
* WORK IN PROGRESS -- Ignores speed
* Single image (PNG) export from the Open dialog.
(Closes https://sourceforge.net/p/tuxpaint/feature-requests/192/)
* Both utilize XDG user dirs settings, if available, to determine

View file

@ -246,6 +246,14 @@ get_bbox(ge_GIF *gif, uint16_t *w, uint16_t *h, uint16_t *x, uint16_t *y)
}
}
/* (From the docs)
* The `delay` parameter specifies how long the frame will be shown, in hundreths
* of a second. For example, `delay` == 100 means "show this frame for one second"
* and `delay` == 25 means "show this frame for a quarter of a second". Note that
* short delays may not be supported by some GIF viewers: it's recommended to keep
* a minimum of `delay` == 6. If `delay` == 0, no delay information will be stored
* for the frame. This can be used when creating still (single-frame) GIF images.
*/
static void
set_delay(ge_GIF *gif, uint16_t d)
{

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - July 27, 2020
June 14, 2002 - July 29, 2020
*/
@ -25389,6 +25389,7 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
liq_result *quantization_result;
liq_error qtiz_status;
const liq_palette *palette;
int gif_speed;
/* Back up the current image's IDs, because they will get
clobbered below! */
@ -25415,6 +25416,12 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
overall_h = screen->h;
overall_area = overall_w * overall_h;
if (speed == 0)
{
gif_speed = 1;
}
gif_speed = (10 - speed) * 50;
bitmap = malloc(num_selected * overall_area * 4);
if (bitmap != NULL)
{
@ -25517,7 +25524,7 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
for (i = 0; i < num_selected && !done; i++)
{
memcpy(gif->frame, raw_8bit_pixels + i * overall_area, overall_area);
ge_add_frame(gif, 100); // FIXME: Speed
ge_add_frame(gif, gif_speed);
show_progress_bar(screen);
done = export_gif_monitor_events();