Bitmap(3X) manual page
Table of Contents
Bitmap - bit mapped data
#include <ivplus/bitmap.h>
Bitmap
is a two dimensional array of boolean values. Bitmaps can be used in Painter
operations and 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 or from a font character. Geometric transformations and
painting operations are performed relative to the bitmap’s origin. Bitmap
is derived from Resource and has an initial reference count of 1.
Bitmap -> Resource
Create a bitmap from
the data specified. The data format is the same as that of a bitmap(1)
file.
The width and height are the size of the bitmap in pixels and the bitmap’s
origin is located at <x, y>.
Creates a bitmap using the character of the given Font. The width
and height reflect the actual size of the character in pixels and may not
be equal to the width and height of the character as returned by the Font
operations. The bitmap’s origin is set to the character’s origin.
Creates a copy of the given bitmap.
Returns the location of the bottom edge of the bitmap.
Flips
the bitmap about its vertical axis. The origin of the bitmap is left unchanged.
Flips the bitmap about its horizontal axis. The origin
of the bitmap is left unchanged.
Returns the
height in pixels of the bitmap.
Toggles each bit in the bitmap.
Bits set to true will be toggled to false and bits set to false will
be toggled to true creating the inverse effect. The origin of the bitmap
is left unchanged.
Returns the location of the left edge
of the bitmap.
Creates a bitmap
from the given filename. The file format must be that produced by the X
bitmap program. The bitmap’s origin will be the hot spot specified by the
file or the lower left corner if the file does not define a hot spot.
Returns whether the bit at <x, y> is set to true
or false. If the x and y coordinates are not within the bounds of the
bitmap, then Peek() returns false.
Sets
the bit at <x, y> to true or false.
Returns the location
of the right edge of the bitmap.
Moves the data,
in a counter-clockwise direction angle degrees around the bitmap’s center.
Moves the data in a counter-clockwise direction 90 degrees
around the bitmap’s center. The origin of the bitmap is left unchanged.
Moves the data in a counter-clockwise direction 180 degrees around
the bitmap’s center. The origin of the bitmap is left unchanged.
Moves
the data in a counter-clockwise direction 270 degrees around the bitmap
center. The origin of the bitmap is unchanged.
Enlarges or reduces the data in the bitmap by a factor of sx (x-dimension)
and sy (y-dimension).
Returns the location of the top edge
of the bitmap.
Moves the data in the bitmap
using the specified transformer.
Returns the width
in pixels of the bitmap.
Writes the
contents of the bitmap to the specified file. Returns zero if successful,
otherwise returns a non-zero error code. See XWriteBitmapFile(3X)
for a description
of the error codes.
None.
None.
// Bitmap Example
#include <ivplus/box.h>
#include <ivplus/bitmap.h>
#include <ivplus/frame.h>
#include <ivplus/message.h>
#include <ivplus/world.h>
int main(int argc, char **argv)
{
// Create the world to get the connection with the display.
World* world = new World("MyApp", argc, argv);
// using "/usr/lib/X11/bitmaps/HPlogo.bm"
const int HPlogo_width=46;
const int HPlogo_height=34;
static char HPlogo_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xff, 0x79, 0xfe, 0xff, 0xc1,
0xf8, 0xff, 0x39, 0xfe, 0xff, 0xc7, 0xfc, 0xff, 0x3d, 0xfc, 0xff, 0xcf,
0xfc, 0xff, 0x3c, 0xe0, 0xff, 0xcf, 0xfe, 0x7f, 0x1c, 0x80, 0xff, 0xdf,
0xfe, 0x3f, 0x1c, 0x00, 0xff, 0xdf, 0xfe, 0x1f, 0x1e, 0x00, 0xfe, 0xdf,
0xfe, 0x0f, 0x1e, 0x00, 0xfc, 0xdf, 0xfe, 0x07, 0x0e, 0x00, 0xf8, 0xdf,
0xfe, 0x07, 0x0f, 0x00, 0xf8, 0xdf, 0xfe, 0x03, 0x7f, 0xfc, 0xf1, 0xdf,
0xfe, 0x03, 0xff, 0xfc, 0xf3, 0xdf, 0xfe, 0x03, 0xff, 0xfc, 0xf3, 0xdf,
0xfe, 0x81, 0xf7, 0xde, 0xe3, 0xdf, 0xfe, 0x81, 0x77, 0xde, 0xe1, 0xdf,
0xfe, 0x81, 0x73, 0xce, 0xe1, 0xdf, 0xfe, 0xc1, 0x7b, 0xee, 0xe1, 0xdf,
0xfe, 0xc1, 0x7b, 0xef, 0xe1, 0xdf, 0xfe, 0xc1, 0x3b, 0xe7, 0xe0, 0xdf,
0xfe, 0xc3, 0x39, 0xff, 0xf0, 0xdf, 0xfe, 0xe3, 0xbd, 0xff, 0xf0, 0xdf,
0xfe, 0xe3, 0xbd, 0x7f, 0xf0, 0xdf, 0xfe, 0x07, 0x80, 0x03, 0xf8, 0xdf,
0xfe, 0x07, 0x80, 0x03, 0xf8, 0xdf, 0xfe, 0x0f, 0xc0, 0x03, 0xfc, 0xdf,
0xfe, 0x1f, 0xc0, 0x03, 0xfe, 0xdf, 0xfe, 0x3f, 0xc0, 0x01, 0xff, 0xdf,
0xfe, 0x7f, 0xc0, 0x81, 0xff, 0xdf, 0xfc, 0xff, 0xe1, 0xe1, 0xff, 0xcf,
0xfc, 0xff, 0xe7, 0xfc, 0xff, 0xcf, 0xf8, 0xff, 0xe7, 0xfc, 0xff, 0xc7,
0xe0, 0xff, 0xf3, 0xfc, 0xff, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0
};
// Create a bitmap using the above bits.
Bitmap* hplogo = new Bitmap(HPlogo_bits, HPlogo_width, HPlogo_height);
// Invert the bitmap (i.e. toggle each bit in the bitmap).
hplogo->Invert();
// Enlarge the bitmap by a factor of 2 in y & 1.5 times in x direction.
hplogo->Scale(2.0, 1.5);
// Create a message using this bitmap.
Message* msg = new Message(hplogo);
// Map the window.
world->InsertApplication(new Frame(msg, 1, BevelOut));
// Enter the event loop.
world->Run();
return 0;
}
bitmap.h
Font(3X)
, Painter(3X)
, Resource(3X)
, Transformer(3X)
, XWriteBitmapFile(3X)
.
Table of Contents