fltk::gifImage Class Reference

Inherits fltk::SharedImage.

List of all members.

Public Member Functions

bool fetch ()

Static Public Member Functions

static bool test (const uchar *datas, unsigned size=0)

Detailed Description

This can either display an image from a .gif image file, or from a block of data that is the contents of the image file. By using a block of data the image can be compiled into a program, this is whta Fluid does to imbed gif images into the source code and is currently the most efficient way to get a Fluid program to produce an image.

To use data, pass a non-null pointer as the second argument to the constructor. The filename is ignored in this case, but the "guess image" code uses this to identify identical images and reuse them (nyi)


Member Function Documentation

bool gifImage::fetch ( ) [virtual]

This is called by the draw() functions once after the Image is created or after refetch() has been called. This allows subclasses to defer reading files and calling setpixels() calls until the first draw() or measure(). This should return true if successful, false on any error (though fltk does not do anything useful with errors).

The base class does nothing and returns true, thus leaving the image unchanged.

Sample implementation:

  bool MyImage::fetch() {
    setsize(get_width(file), get_height(file));
    setpixeltype(my_pixeltype);
    for (int y=0; y<height(); y++) {
      uchar* buffer = linebuffer(y);
      get_line_of_pixels(file, buffer, y);
      setpixels(buffer, y);
    }
    return true;
  }

Implements fltk::SharedImage.

bool gifImage::test ( const uchar *  datas,
unsigned  size = 0 
) [static]

Tests block of data to see if it looks like the start of a .gif file.


The documentation for this class was generated from the following files: