fltk::xbmImage Class Reference

Inherits fltk::Image.

List of all members.

Public Member Functions

bool fetch ()

Detailed Description

Image based on a 1-bit bitmap from memory. This matches the very first type of image provided with X10 in 1980 or so. To use an actual xbm file:

#include "image_name.xbm"
static xbmImage image_name(image_name_bits, image_name_width, image_name_height);

Each byte in the bitmap determines 8 pixels, a 1 bit is opaque and a 0 bit is transparent. The low-order bit is the left-most (this is inverted from similar data used by Windows). If the width is not a multiple of 8 each line starts at the start of the next byte.


Member Function Documentation

bool xbmImage::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;
  }

Reimplemented from fltk::Image.


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