2004-04-03 15:49:48 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2004 Richard Wilson <not_ginger_matt@sourceforge.net>
|
|
|
|
*/
|
|
|
|
|
2004-05-09 20:12:24 +04:00
|
|
|
/** \file
|
|
|
|
* Progressive animated GIF file decoding (interface).
|
|
|
|
*/
|
|
|
|
|
2004-04-03 15:49:48 +04:00
|
|
|
#ifndef _NETSURF_RISCOS_GIFREAD_H_
|
|
|
|
#define _NETSURF_RISCOS_GIFREAD_H_
|
|
|
|
|
|
|
|
#include "oslib/osspriteop.h"
|
|
|
|
|
|
|
|
/* Error return values
|
|
|
|
*/
|
2004-04-07 03:13:25 +04:00
|
|
|
#define GIF_INSUFFICIENT_FRAME_DATA -1
|
|
|
|
#define GIF_FRAME_DATA_ERROR -2
|
|
|
|
#define GIF_INSUFFICIENT_DATA -3
|
|
|
|
#define GIF_DATA_ERROR -4
|
|
|
|
#define GIF_INSUFFICIENT_MEMORY -5
|
2004-04-03 15:49:48 +04:00
|
|
|
|
|
|
|
/* Colour map size constant. Because we don't want to allocate
|
|
|
|
memory each time we decode a frame we get enough so all frames
|
|
|
|
will fit in there.
|
|
|
|
*/
|
|
|
|
#define GIF_MAX_COLOURS 256
|
|
|
|
|
|
|
|
/* Maximum LZW bits available
|
|
|
|
*/
|
|
|
|
#define GIF_MAX_LZW 12
|
|
|
|
|
2004-05-09 20:12:24 +04:00
|
|
|
/* The GIF frame dats
|
|
|
|
*/
|
|
|
|
typedef struct gif_frame {
|
|
|
|
/* Frame data
|
|
|
|
*/
|
|
|
|
unsigned int frame_pointer;
|
|
|
|
unsigned int frame_delay;
|
|
|
|
|
|
|
|
/* Redraw characteristics
|
|
|
|
*/
|
|
|
|
unsigned int redraw_required;
|
|
|
|
unsigned int redraw_x;
|
|
|
|
unsigned int redraw_y;
|
|
|
|
unsigned int redraw_width;
|
|
|
|
unsigned int redraw_height;
|
2004-08-11 20:26:13 +04:00
|
|
|
|
2004-05-09 20:12:24 +04:00
|
|
|
} gif_frame;
|
|
|
|
|
|
|
|
|
2004-04-03 15:49:48 +04:00
|
|
|
/* A simple hold-all for our GIF data
|
|
|
|
*/
|
2004-04-07 03:13:25 +04:00
|
|
|
typedef struct gif_animation {
|
2004-04-03 15:49:48 +04:00
|
|
|
/* Encoded GIF data
|
|
|
|
*/
|
|
|
|
unsigned char *gif_data;
|
|
|
|
unsigned int buffer_position;
|
|
|
|
unsigned int buffer_size;
|
2004-08-11 20:26:13 +04:00
|
|
|
|
2004-04-03 15:49:48 +04:00
|
|
|
/* Progressive decoding data
|
|
|
|
*/
|
|
|
|
unsigned int global_colours;
|
|
|
|
unsigned int frame_holders;
|
|
|
|
unsigned int colour_table_size;
|
|
|
|
|
|
|
|
/* Animation data
|
|
|
|
*/
|
|
|
|
unsigned int decoded_frame;
|
2004-05-09 20:12:24 +04:00
|
|
|
int loop_count;
|
|
|
|
gif_frame *frames;
|
2004-04-03 15:49:48 +04:00
|
|
|
|
|
|
|
/* Decoded GIF data
|
|
|
|
*/
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int frame_count;
|
|
|
|
unsigned int frame_count_partial;
|
|
|
|
unsigned int background_colour;
|
|
|
|
unsigned int aspect_ratio;
|
|
|
|
unsigned int *global_colour_table;
|
|
|
|
unsigned int *local_colour_table;
|
|
|
|
|
|
|
|
/* Decoded frame data
|
|
|
|
*/
|
2004-04-18 00:50:33 +04:00
|
|
|
unsigned int dirty_frame; // Frame needs erasing before next
|
2004-08-11 20:26:13 +04:00
|
|
|
osspriteop_area *frame_image;
|
2004-04-07 03:13:25 +04:00
|
|
|
} gif_animation;
|
2004-04-03 15:49:48 +04:00
|
|
|
|
|
|
|
/* Function declarations
|
|
|
|
*/
|
|
|
|
int gif_initialise(struct gif_animation *gif);
|
2004-04-07 03:13:25 +04:00
|
|
|
int gif_decode_frame(struct gif_animation *gif, unsigned int frame);
|
2004-04-03 15:49:48 +04:00
|
|
|
void gif_finalise(struct gif_animation *gif);
|
|
|
|
|
|
|
|
#endif
|