FLTK 1.4.0
Loading...
Searching...
No Matches
Fl_GIF_Image.H
1//
2// GIF image header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2023 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_GIF_Image widget . */
19
20#ifndef Fl_GIF_Image_H
21#define Fl_GIF_Image_H
22# include "Fl_Pixmap.H"
23
29class FL_EXPORT Fl_GIF_Image : public Fl_Pixmap {
30
31public:
32
33 Fl_GIF_Image(const char* filename);
34 // deprecated constructor w/o length (for backwards compatibility)
35 Fl_GIF_Image(const char* imagename, const unsigned char *data);
36 // constructor with length (since 1.4.0)
37 Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length);
38
39 static bool is_animated(const char *name_);
44 static bool animate;
45
46protected:
47
48 // Protected constructors needed for animated GIF support through Fl_Anim_GIF_Image.
49 Fl_GIF_Image(const char* filename, bool anim);
50 Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length, bool anim);
51 // Protected default constructor needed for Fl_Anim_GIF_Image.
53
54 void load_gif_(class Fl_Image_Reader &rdr, bool anim=false);
55
56 void load(const char* filename, bool anim);
57 void load(const char* imagename, const unsigned char *data, const size_t length, bool anim);
58
59 // Internal structure to "glue" animated GIF support into Fl_GIF_Image.
60 // This data is passed during decoding to the Fl_Anim_GIF_Image class.
61 struct GIF_FRAME {
62 int ifrm, width, height, x, y, w, h,
63 clrs, bkgd, trans,
64 dispose, delay;
65 const uchar *bptr;
66 const struct CPAL {
67 uchar r, g, b;
68 } *cpal;
69 GIF_FRAME(int frame, uchar *data) : ifrm(frame), bptr(data) {}
70 GIF_FRAME(int frame, int W, int H, int fx, int fy, int fw, int fh, uchar *data) :
71 ifrm(frame), width(W), height(H), x(fx), y(fy), w(fw), h(fh), bptr(data) {}
72 void disposal(int mode, int delay) { dispose = mode; this->delay = delay; }
73 void colors(int nclrs, int bg, int tp) { clrs = nclrs; bkgd = bg; trans = tp; }
74 };
75
76 // Internal virtual methods, which are called during decoding to pass data
77 // to the Fl_Anim_GIF_Image class.
78 virtual void on_frame_data(GIF_FRAME &) {}
79 virtual void on_extension_data(GIF_FRAME &) {}
80
81private:
82
83 void lzw_decode(Fl_Image_Reader &rdr, uchar *Image, int Width, int Height, int CodeSize, int ColorMapSize, int Interlace);
84};
85
86#endif
The Fl_GIF_Image class supports loading, caching, and drawing of Compuserve GIFSM images.
Definition Fl_GIF_Image.H:29
static bool animate
Sets how the shared image core routine should treat animated GIF files.
Definition Fl_GIF_Image.H:44
Definition Fl_Image_Reader.h:32
The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency.
Definition Fl_Pixmap.H:36
unsigned char uchar
unsigned char
Definition fl_types.h:30
Definition Fl_GIF_Image.H:66
Definition Fl_GIF_Image.H:61