106 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
<HTML><HEAD><TITLE>Tk Built-In Commands - bitmap manual page</TITLE></HEAD>
 | 
						|
<BODY bgcolor = #c3c3ff>
 | 
						|
<H2><IMG ALIGN=BOTTOM SRC="./Img/ManPageBlue.gif"> bitmap</H2>
 | 
						|
<I>Images that display two colors</I><P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
 | 
						|
<H3><A NAME="M2">SYNOPSIS</A></H3>
 | 
						|
(<B>image 'create 'bitmap </B>?<I>name</I>? ?<I>options</I>?)<BR>
 | 
						|
<H3><A NAME="M3">DESCRIPTION</A></H3>
 | 
						|
A bitmap is an image whose pixels can display either of two colors
 | 
						|
or be transparent.
 | 
						|
A bitmap image is defined by four things:  a background color,
 | 
						|
a foreground color, and two bitmaps, called the <I>source</I>
 | 
						|
and the <I>mask</I>.
 | 
						|
Each of the bitmaps specifies 0/1 values for a rectangular
 | 
						|
array of pixels, and the two bitmaps must have the same
 | 
						|
dimensions.
 | 
						|
For pixels where the mask is zero, the image displays nothing,
 | 
						|
producing a transparent effect.
 | 
						|
For other pixels, the image displays the foreground color if
 | 
						|
the source data is one and the background color if the source
 | 
						|
data is zero.
 | 
						|
 | 
						|
<H3><A NAME="M4">CREATING BITMAPS</A></H3>
 | 
						|
Like all images, bitmaps are created using the <B><A HREF=.././image.n.html>image create</A></B>
 | 
						|
procedure.
 | 
						|
Bitmaps support the following <I>options</I>:
 | 
						|
<P>
 | 
						|
<DL>
 | 
						|
<DT><A NAME="M5"><B>:background </B><I>color</I></A><DD>
 | 
						|
Specifies a background color for the image in any of the standard
 | 
						|
ways accepted by Tk.  If this option is set to an empty string
 | 
						|
then the background pixels will be transparent.  This effect
 | 
						|
is achieved by using the source bitmap as the mask bitmap, ignoring
 | 
						|
any <B>:maskdata</B> or <B>:maskfile</B> options.
 | 
						|
<P>
 | 
						|
<DT><A NAME="M6"><B>:data </B><I>string</I></A><DD>
 | 
						|
Specifies the contents of the source bitmap as a string.
 | 
						|
The string must adhere to X11 bitmap format (e.g., as generated
 | 
						|
by the <B>bitmap</B> program).
 | 
						|
If both the <B>:data</B> and <B>:file</B> options are specified,
 | 
						|
the <B>:data</B> option takes precedence.
 | 
						|
<P>
 | 
						|
<DT><A NAME="M7"><B>:file </B><I>name</I></A><DD>
 | 
						|
<I>name</I> gives the name of a file whose contents define the
 | 
						|
source bitmap.
 | 
						|
The file must adhere to X11 bitmap format (e.g., as generated
 | 
						|
by the <B>bitmap</B> program).
 | 
						|
<P>
 | 
						|
<DT><A NAME="M8"><B>:foreground </B><I>color</I></A><DD>
 | 
						|
Specifies a foreground color for the image in any of the standard
 | 
						|
ways accepted by Tk.
 | 
						|
<P>
 | 
						|
<DT><A NAME="M9"><B>:maskdata </B><I>string</I></A><DD>
 | 
						|
Specifies the contents of the mask as a string.
 | 
						|
The string must adhere to X11 bitmap format (e.g., as generated
 | 
						|
by the <B>bitmap</B> program).
 | 
						|
If both the <B>:maskdata</B> and <B>:maskfile</B> options are specified,
 | 
						|
the <B>:maskdata</B> option takes precedence.
 | 
						|
<P>
 | 
						|
<DT><A NAME="M10"><B>:maskfile </B><I>name</I></A><DD>
 | 
						|
<I>name</I> gives the name of a file whose contents define the
 | 
						|
mask.
 | 
						|
The file must adhere to X11 bitmap format (e.g., as generated
 | 
						|
by the <B>bitmap</B> program).
 | 
						|
 | 
						|
<P>
 | 
						|
</DL>
 | 
						|
<H3><A NAME="M11">IMAGE PROCEDURE</A></H3>
 | 
						|
When a bitmap image is created, Tk also creates a new procedure
 | 
						|
whose name is the same as the image.
 | 
						|
This procedure may be used to invoke various operations
 | 
						|
on the image.
 | 
						|
It has the following general form:
 | 
						|
<PRE>(<I>imageName option </I>?<I>arg arg ...</I>?)</PRE>
 | 
						|
<I>Option</I> and the <I>arg</I>s
 | 
						|
determine the exact behavior of the procedure.  The following
 | 
						|
procedures are possible for bitmap images:
 | 
						|
<P>
 | 
						|
<DL>
 | 
						|
<DT><A NAME="M12">(<I>imageName </I><B>cget</B> <I>option</I>)</A><DD>
 | 
						|
Returns the current value of the configuration option given
 | 
						|
by <I>option</I>.
 | 
						|
<I>Option</I> may have any of the values accepted by the
 | 
						|
<B>image create bitmap</B> procedure.
 | 
						|
<P>
 | 
						|
<DT><A NAME="M13">(<I>imageName </I><B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>?)</A><DD>
 | 
						|
Query or modify the configuration options for the image.
 | 
						|
If no <I>option</I> is specified, returns a list describing all of
 | 
						|
the available options for <I>imageName</I> (see <B>Tk_ConfigureInfo</B> for
 | 
						|
information on the format of this list).  If <I>option</I> is specified
 | 
						|
with no <I>value</I>, then the procedure returns a list describing the
 | 
						|
one named option (this list will be identical to the corresponding
 | 
						|
sublist of the value returned if no <I>option</I> is specified).  If
 | 
						|
one or more <I>option-value</I> pairs are specified, then the procedure
 | 
						|
modifies the given option(s) to have the given value(s);  in
 | 
						|
this case the procedure returns an empty string.
 | 
						|
<I>Option</I> may have any of the values accepted by the
 | 
						|
<B>image create bitmap</B> procedure.
 | 
						|
 | 
						|
<P>
 | 
						|
</DL>
 | 
						|
<H3><A NAME="M14">SEE ALSO</A></H3>
 | 
						|
<B><A HREF="./image.n.html">image</A></B>, <B><A HREF="./photo.n.html">photo</A></B>, <B>pixmap</B>
 | 
						|
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
 | 
						|
<A HREF=./STk-hlp.html><IMG ALIGN=BOTTOM SRC="./Img/RefBookBlue.gif"> Back to the <B>STk</B> main page</A>
 | 
						|
</BODY></HTML>
 |