FLTK 1.4.4: Fl_GIF_Image.H Source File

FLTK 1.4.4

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-2024 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
29 class 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.
52 Fl_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 time) { dispose = mode; this->delay = time; }
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
Fl_GIF_Image::load
void load(const char *filename, bool anim)
The protected load() methods are used by Fl_Anim_GIF_Image to request loading of animated GIF's.
Definition Fl_GIF_Image.cxx:787
Fl_GIF_Image::animate
static bool animate
Sets how the shared image core routine should treat animated GIF files.
Definition Fl_GIF_Image.H:44
Fl_GIF_Image::Fl_GIF_Image
Fl_GIF_Image(const char *filename)
This constructor loads a GIF image from the given file.
Definition Fl_GIF_Image.cxx:133
Fl_Image_Reader
Definition Fl_Image_Reader.h:32
Fl_Image::data
void data(const char *const *p, int c)
Sets the current data pointer and count of pointers in the array.
Definition Fl_Image.H:117
Fl_Image::h
void h(int H)
Sets the height of the image data.
Definition Fl_Image.H:93
Fl_Image::w
void w(int W)
Sets the width of the image data.
Definition Fl_Image.H:87
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(char *const *D)
The constructors create a new pixmap from the specified XPM data.
Definition Fl_Pixmap.H:58
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
Fl_GIF_Image::GIF_FRAME::CPAL
Definition Fl_GIF_Image.H:66
Fl_GIF_Image::GIF_FRAME
Definition Fl_GIF_Image.H:61