InterViews Reference Manual -- Bitmap
NAME
Bitmap - bit mapped data
SYNOPSIS
#include <InterViews/bitmap.h>
DESCRIPTION
A Bitmap is a two-dimensional array of bool values. Bitmaps can be
used in Painter operations or to define window manager icons for top-level
Interactors. Bitmaps can be constructed from data contained in a file, from
data supplied by the application program, or from a font character. Operations
include geometric transformations, common bit transformations, and individual
bit manipulations. Geometric transformations and painting operations are
relative to an origin.
PUBLIC OPERATIONS
Bitmap(const char* filename)
Create a bitmap from the named file. The file format is that produced by the X
bitmap(3X) program. The bitmap origin will be the hot spot specified
by the file or the lower left corner if the file does not define a hot spot.
Bitmap(void* data, int width, int height, int x0 = 0, int y0 =
0)
Create a bitmap from the data specified. The data format is the same as that
of a bitmap(3X) file. The coordinates x0 and y0 specify the
bitmap origin. The data is transferred into an internal format, so subsequent
changes in either the passed data or the bitmap will not affect the other.
Passing a nil pointer to data is equivalent to passing an array with
all values set to false.
Bitmap(Font* font, int character)
Create a bitmap from the given character of the font. The bitmap width and
height will reflect the actual size of the character glyph and will not usually
equal the width and height of the character cell as reported by operations on
the Font. The bitmap origin is set to the character origin.
Bitmap(Bitmap*)
Create a copy of the given bitmap.
int Left()
int Right()
int
Top()
int Bottom()
int
Width()
int Height()
These operations return the size and bounds of the bitmap.
void Transform(Transformer*)
void Scale(float x,
float y)
void Rotate(float angle)
Transform the bitmap in place. Scale and Rotate provide
convenient interfaces to common transformations. Transformations are relative
to the bitmap origin.
void FlipHorizontal()
void
FlipVertical()
void Rotate90()
void
Rotate180()
void Rotate270()
void
Invert()
Perform an operation on the bitmap data. FlipHorizontal and
FlipVertical reflect the data about its vertical or horizontal center
respectively. The Rotate functions move the data in a
counter-clockwise direction about the bitmap center. Invert toggles
each bit in the bitmap. In each case, the bitmap origin is unchanged.
bool Peek(int x, int y)
void Poke(bool bit, int
x, int y)
bool Contains(int x, int y)
Operations for reading and writing individual bits in the bitmap. If the
specified coordinates are not within the bitmap bounds, Contains and
Peek return false, and Poke has no effect.
SEE ALSO
Painter , Transformer
Next: Border
| Prev: Banner
| Up: index
| Top: index