| 1 |
# Copyright (c) 1994 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk::Bitmap - Images that display two colors |
| 11 |
|
| 12 |
=for category Tk Image Classes |
| 13 |
|
| 14 |
=head1 SYNOPSIS |
| 15 |
|
| 16 |
S< >I<$image> = I<$widget>-E<gt>B<Bitmap>?(I<name>??,I<options>?) |
| 17 |
|
| 18 |
=head1 DESCRIPTION |
| 19 |
|
| 20 |
A bitmap is an image whose pixels can display either of two colors |
| 21 |
or be transparent. |
| 22 |
A bitmap image is defined by four things: a background color, |
| 23 |
a foreground color, and two bitmaps, called the I<source> |
| 24 |
and the I<mask>. |
| 25 |
Each of the bitmaps specifies 0/1 values for a rectangular |
| 26 |
array of pixels, and the two bitmaps must have the same |
| 27 |
dimensions. |
| 28 |
For pixels where the mask is zero, the image displays nothing, |
| 29 |
producing a transparent effect. |
| 30 |
For other pixels, the image displays the foreground color if |
| 31 |
the source data is one and the background color if the source |
| 32 |
data is zero. |
| 33 |
|
| 34 |
=head1 CREATING BITMAPS |
| 35 |
|
| 36 |
Bitmaps are created using I<$widget>-E<gt>B<Bitmap>. |
| 37 |
Bitmaps support the following I<options>: |
| 38 |
|
| 39 |
=over 4 |
| 40 |
|
| 41 |
=item B<-background> =E<gt> I<color> |
| 42 |
|
| 43 |
Specifies a background color for the image in any of the standard |
| 44 |
ways accepted by Tk. If this option is set to an empty string |
| 45 |
then the background pixels will be transparent. This effect |
| 46 |
is achieved by using the source bitmap as the mask bitmap, ignoring |
| 47 |
any B<-maskdata> or B<-maskfile> options. |
| 48 |
|
| 49 |
=item B<-data> =E<gt> I<string> |
| 50 |
|
| 51 |
Specifies the contents of the source bitmap as a string. |
| 52 |
The string must adhere to X11 bitmap format (e.g., as generated |
| 53 |
by the B<bitmap> program). |
| 54 |
If both the B<-data> and B<-file> options are specified, |
| 55 |
the B<-data> option takes precedence. |
| 56 |
|
| 57 |
=item B<-file> =E<gt> I<name> |
| 58 |
|
| 59 |
I<name> gives the name of a file whose contents define the |
| 60 |
source bitmap. |
| 61 |
The file must adhere to X11 bitmap format (e.g., as generated |
| 62 |
by the B<bitmap> program). |
| 63 |
|
| 64 |
=item B<-foreground> =E<gt> I<color> |
| 65 |
|
| 66 |
Specifies a foreground color for the image in any of the standard |
| 67 |
ways accepted by Tk. |
| 68 |
|
| 69 |
=item B<-maskdata> =E<gt> I<string> |
| 70 |
|
| 71 |
Specifies the contents of the mask as a string. |
| 72 |
The string must adhere to X11 bitmap format (e.g., as generated |
| 73 |
by the B<bitmap> program). |
| 74 |
If both the B<-maskdata> and B<-maskfile> options are specified, |
| 75 |
the B<-maskdata> option takes precedence. |
| 76 |
|
| 77 |
=item B<-maskfile> =E<gt> I<name> |
| 78 |
|
| 79 |
I<name> gives the name of a file whose contents define the |
| 80 |
mask. |
| 81 |
The file must adhere to X11 bitmap format (e.g., as generated |
| 82 |
by the B<bitmap> program). |
| 83 |
|
| 84 |
=back |
| 85 |
|
| 86 |
=head1 IMAGE METHODS |
| 87 |
|
| 88 |
When a bitmap image is created, Tk also creates a new object. |
| 89 |
This object supports the B<configure> and B<cget> methods |
| 90 |
described in L<Tk::options> which can be used to enquire and |
| 91 |
modify the options described above. |
| 92 |
|
| 93 |
=head1 SEE ALSO |
| 94 |
|
| 95 |
L<Tk::Image|Tk::Image> |
| 96 |
L<Tk::Pixmap|Tk::Pixmap> |
| 97 |
L<Tk::Photo|Tk::Photo> |
| 98 |
|
| 99 |
=head1 KEYWORDS |
| 100 |
|
| 101 |
bitmap, image |
| 102 |
|
| 103 |
=cut |