OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
//
|
|
|
|
// GIF image header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2024-04-18 17:27:29 +03:00
|
|
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
//
|
|
|
|
|
2008-10-15 17:46:06 +04:00
|
|
|
/* \file
|
2008-09-16 11:26:22 +04:00
|
|
|
Fl_GIF_Image widget . */
|
|
|
|
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
#ifndef Fl_GIF_Image_H
|
|
|
|
#define Fl_GIF_Image_H
|
|
|
|
# include "Fl_Pixmap.H"
|
|
|
|
|
2008-09-14 22:19:41 +04:00
|
|
|
/**
|
2015-05-24 02:42:26 +03:00
|
|
|
The Fl_GIF_Image class supports loading, caching,
|
|
|
|
and drawing of Compuserve GIF<SUP>SM</SUP> images. The class
|
|
|
|
loads the first image and supports transparency.
|
|
|
|
*/
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
class FL_EXPORT Fl_GIF_Image : public Fl_Pixmap {
|
|
|
|
|
2020-01-03 23:37:52 +03:00
|
|
|
public:
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
|
|
|
|
Fl_GIF_Image(const char* filename);
|
2021-10-02 18:01:00 +03:00
|
|
|
// deprecated constructor w/o length (for backwards compatibility)
|
|
|
|
Fl_GIF_Image(const char* imagename, const unsigned char *data);
|
|
|
|
// constructor with length (since 1.4.0)
|
|
|
|
Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length);
|
2020-01-03 23:37:52 +03:00
|
|
|
|
2023-01-21 19:27:58 +03:00
|
|
|
static bool is_animated(const char *name_);
|
|
|
|
/** Sets how the shared image core routine should treat animated GIF files.
|
|
|
|
The default is to treat them as ordinary GIF's e.g. it creates a Fl_GIF_Image object.
|
|
|
|
If this variable is set, then an animated GIF object Fl_Anim_GIF_Image is created.
|
|
|
|
*/
|
|
|
|
static bool animate;
|
|
|
|
|
2020-01-03 23:37:52 +03:00
|
|
|
protected:
|
|
|
|
|
2023-08-26 16:17:28 +03:00
|
|
|
// Protected constructors needed for animated GIF support through Fl_Anim_GIF_Image.
|
2023-01-21 19:27:58 +03:00
|
|
|
Fl_GIF_Image(const char* filename, bool anim);
|
|
|
|
Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length, bool anim);
|
|
|
|
// Protected default constructor needed for Fl_Anim_GIF_Image.
|
|
|
|
Fl_GIF_Image();
|
|
|
|
|
|
|
|
void load_gif_(class Fl_Image_Reader &rdr, bool anim=false);
|
|
|
|
|
|
|
|
void load(const char* filename, bool anim);
|
|
|
|
void load(const char* imagename, const unsigned char *data, const size_t length, bool anim);
|
|
|
|
|
|
|
|
// Internal structure to "glue" animated GIF support into Fl_GIF_Image.
|
|
|
|
// This data is passed during decoding to the Fl_Anim_GIF_Image class.
|
|
|
|
struct GIF_FRAME {
|
|
|
|
int ifrm, width, height, x, y, w, h,
|
|
|
|
clrs, bkgd, trans,
|
|
|
|
dispose, delay;
|
|
|
|
const uchar *bptr;
|
|
|
|
const struct CPAL {
|
|
|
|
uchar r, g, b;
|
|
|
|
} *cpal;
|
|
|
|
GIF_FRAME(int frame, uchar *data) : ifrm(frame), bptr(data) {}
|
|
|
|
GIF_FRAME(int frame, int W, int H, int fx, int fy, int fw, int fh, uchar *data) :
|
|
|
|
ifrm(frame), width(W), height(H), x(fx), y(fy), w(fw), h(fh), bptr(data) {}
|
2024-04-18 17:27:29 +03:00
|
|
|
void disposal(int mode, int time) { dispose = mode; this->delay = time; }
|
2023-01-21 19:27:58 +03:00
|
|
|
void colors(int nclrs, int bg, int tp) { clrs = nclrs; bkgd = bg; trans = tp; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// Internal virtual methods, which are called during decoding to pass data
|
|
|
|
// to the Fl_Anim_GIF_Image class.
|
2023-04-15 21:04:28 +03:00
|
|
|
virtual void on_frame_data(GIF_FRAME &) {}
|
|
|
|
virtual void on_extension_data(GIF_FRAME &) {}
|
2023-01-21 19:27:58 +03:00
|
|
|
|
|
|
|
private:
|
2020-01-03 23:37:52 +03:00
|
|
|
|
2023-01-21 19:27:58 +03:00
|
|
|
void lzw_decode(Fl_Image_Reader &rdr, uchar *Image, int Width, int Height, int CodeSize, int ColorMapSize, int Interlace);
|
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2001-11-19 04:06:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|