Tk

 view release on metacpan or  search on metacpan

pod/pTk/GetBitmap.pod  view on Meta::CPAN


The silhouette of a human head, with a question mark in it.

=item B<question>

A large question-mark.

=item B<warning>

A large exclamation point.

In addition, the following pre-defined names are available only on the
B<Macintosh> platform:

=item B<document>

A generic document.

=item B<stationery>

Document stationery.

=item B<edition>

The I<edition> symbol.

=item B<application>

Generic application icon.

=item B<accessory>

A desk accessory.

=item B<folder>

Generic folder icon.

=item B<pfolder>

A locked folder.

=item B<trash>

A trash can.

=item B<floppy>

A floppy disk.

=item B<ramdisk>

A floppy disk with chip.

=item B<cdrom>

A cd disk icon.

=item B<preferences>

A folder with prefs symbol.

=item B<querydoc>

A database document icon.

=item B<stop>

A stop sign.

=item B<note>

A face with ballon words.

=item B<caution>

A triangle with an exclamation point.

=back

=back

Under normal conditions, B<Tk_GetBitmap>
returns an identifier for the requested bitmap.  If an error
occurs in creating the bitmap, such as when I<id> refers
to a non-existent file, then B<None> is returned and an error
message is left in I<interp-E<gt>result>.

B<Tk_DefineBitmap> associates a name with
in-memory bitmap data so that the name can be used in later
calls to B<Tk_GetBitmap>.  The I<nameId>
argument gives a name for the bitmap;  it must not previously
have been used in a call to B<Tk_DefineBitmap>.
The arguments I<source>, I<width>, and I<height>
describe the bitmap.
B<Tk_DefineBitmap> normally returns TCL_OK;  if an error occurs
(e.g. a bitmap named I<nameId> has already been defined) then
TCL_ERROR is returned and an error message is left in
I<interp-E<gt>result>.
Note:  B<Tk_DefineBitmap> expects the memory pointed to by
I<source> to be static:  B<Tk_DefineBitmap> doesn't make
a private copy of this memory, but uses the bytes pointed to
by I<source> later in calls to B<Tk_GetBitmap>.

Typically B<Tk_DefineBitmap> is used by B<#include>-ing a
bitmap file directly into a C program and then referencing
the variables defined by the file.
For example, suppose there exists a file B<stip.bitmap>,
which was created by the B<bitmap> program and contains
a stipple pattern.
The following code uses B<Tk_DefineBitmap> to define a
new bitmap named B<foo>:

 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"));

This code causes the bitmap file to be read



( run in 2.428 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )