#include <tk.h> Pixmap Tk_GetBitmap(interp, tkwin, id) int Tk_DefineBitmap(interp, nameId, source, width, height) Tk_Uid Tk_NameOfBitmap(display, bitmap) Tk_SizeOfBitmap(display, bitmap, widthPtr, heightPtr) Tk_FreeBitmap(display, bitmap)
Tk_GetBitmap takes as argument a Tk_Uid describing a bitmap. It returns a Pixmap identifier for a bitmap corresponding to the description. It re-uses an existing bitmap, if possible, and creates a new one otherwise. At present, id must have one of the following forms:
This code causes the bitmap file to be read at compile-time and incorporates the bitmap information into the program's executable image. The same bitmap file could be read at run-time using Tk_GetBitmap:Pixmap bitmap; #include "stip.bitmap" Tk_DefineBitmap(interp, Tk_GetUid("foo"), stip_bits, stip_width, stip_height); ... bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("foo"));
The second form is a bit more flexible (the file could be modified after the program has been compiled, or a different string could be provided to read a different file), but it is a little slower and requires the bitmap file to exist separately from the program.Pixmap bitmap; bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("@stip.bitmap"));
Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1994-1997 Sun Microsystems, Inc.