## class fltk::Image

This class holds an image, normally used to label a widget. The subclasses define how the data is interpreted, and usually store server-side cached versions of the image. All the current types define pixel arrays, but other types of images, such as vector graphics, can be defined.

### Methods

#### void* id, mask;
int w,h;
void _draw(int x, int y, fltk::Flags flags)

Subclasses that draw a fixed-size and unchanging image can use these protected methods that use system-specific code to cache images in a form that is ready to be drawn on the screen quickly. In the first call to `draw()` they can set `w` and `h` to the size of the image, `id` and `mask` to the color and transparency offscreen windows, using system-specific code. Then they can call `_draw()` to draw them, and all subsequent calls they can just call `_draw()`. To test if this is the first call to `draw()` a subclass can check if `id` is zero.

#### virtual void fltk::Image::measure(int& w, int& h);

The two parameters are set to the size the image will occupy when drawn. For image types that can scale these are also input parameters: they must be preset to the rectangle the caller intends to pass to `draw()`. This is for scaling and tiling image types. To find the "natural" size of a scaling image, preset w and h to zero before calling this.

#### virtual void fltk::Image::draw(int x,int y,int w,int h, fltk::Flags);

Draw the image with the upper-left corner at x,y. If the image can scale or tile or otherwise uses a size, the w,h describe the size of the box it is wanted to fill. The flags can be used by subclasses to draw differently if `fltk::INACTIVE` or any other flags are set.

#### virtual fltk::Image::~Image();

The destructor throws away temporary data created to draw the image, but in most cases does not destroy the local data passed to a constructor.

#### void draw(int x, int y, fltk::Flags = 0)

Draws the image with the upper-left corner at `x,y`. This is the same as doing `draw(x, y, this->w, this->h, flags)`.

The base class destructor will destroy anything created for `id` or `mask`.