2 '\" Copyright 1991-2001 by Bell Labs Innovations for Lucent Technologies.
4 '\" Permission to use, copy, modify, and distribute this software and its
5 '\" documentation for any purpose and without fee is hereby granted, provided
6 '\" that the above copyright notice appear in all copies and that both that the
7 '\" copyright notice and warranty disclaimer appear in supporting documentation,
8 '\" and that the names of Lucent Technologies any of their entities not be used
9 '\" in advertising or publicity pertaining to distribution of the software
10 '\" without specific, written prior permission.
12 '\" Lucent Technologies disclaims all warranties with regard to this software,
13 '\" including all implied warranties of merchantability and fitness. In no event
14 '\" shall Lucent Technologies be liable for any special, indirect or
15 '\" consequential damages or any damages whatsoever resulting from loss of use,
16 '\" data or profits, whether in an action of contract, negligence or other
17 '\" tortuous action, arising out of or in connection with the use or performance
20 '\" Bitmap command created by George Howlett.
22 '\" The definitions below are for supplemental macros used in Tcl/Tk
25 '\" .AP type name in/out ?indent?
26 '\" Start paragraph describing an argument to a library procedure.
27 '\" type is type of argument (int, etc.), in/out is either "in", "out",
28 '\" or "in/out" to describe whether procedure reads or modifies arg,
29 '\" and indent is equivalent to second arg of .IP (shouldn't ever be
30 '\" needed; use .AS below instead)
33 '\" Give maximum sizes of arguments for setting tab stops. Type and
34 '\" name are examples of largest possible arguments that will be passed
35 '\" to .AP later. If args are omitted, default tab stops are used.
38 '\" Start box enclosure. From here until next .BE, everything will be
39 '\" enclosed in one large box.
42 '\" End of box enclosure.
45 '\" Begin code excerpt.
50 '\" .VS ?version? ?br?
51 '\" Begin vertical sidebar, for use in marking newly-changed parts
52 '\" of man pages. The first argument is ignored and used for recording
53 '\" the version when the .VS was added, so that the sidebars can be
54 '\" found and removed when they reach a certain age. If another argument
55 '\" is present, then a line break is forced before starting the sidebar.
58 '\" End of vertical sidebar.
61 '\" Begin an indented unfilled display.
64 '\" End of indented unfilled display.
67 '\" Start of list of standard options for a Tk widget. The
68 '\" options follow on successive lines, in four columns separated
72 '\" End of list of standard options for a Tk widget.
74 '\" .OP cmdName dbName dbClass
75 '\" Start of description of a specific option. cmdName gives the
76 '\" option's name as specified in the class command, dbName gives
77 '\" the option's name in the option database, and dbClass gives
78 '\" the option's class in the option database.
81 '\" Print arg1 underlined, then print arg2 normally.
83 '\" RCS: @(#) $Id: man.macros,v 1.1.1.1 2009/05/09 16:27:42 pcmacdon Exp $
85 '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
89 '\" # Start an argument description
93 . ie !"\\$2"" .TP \\n()Cu
98 \&\\$1 \\fI\\$2\\fP (\\$3)
111 '\" # define tabbing values for .AP
114 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
117 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
118 .nr )C \\n()Bu+\\w'(in/out)'u+2n
120 .AS Tcl_Interp Tcl_CreateInterp in/out
121 '\" # BS - start boxed text
122 '\" # ^y = starting y location
130 .if n \l'\\n(.lu\(ul'
133 '\" # BE - end boxed text (draw box now)
138 .ie n \l'\\n(^lu\(ul'
140 .\" Draw four-sided box normally, but don't draw top of
141 .\" box if the box started on an earlier page.
143 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
146 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
153 '\" # VS - start vertical sidebar
154 '\" # ^Y = starting y location
155 '\" # ^v = 1 (for troff; for nroff this doesn't matter)
159 .ie n 'mc \s12\(br\s0
162 '\" # VE - end of vertical sidebar
170 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
177 '\" # Special macro to handle page bottom: finish off current
178 '\" # box/sidebar if in box/sidebar mode, then invoked standard
179 '\" # page bottom macro.
186 .\" Draw three-sided box if this is the box's first page,
187 .\" draw two sides but no top otherwise.
188 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
189 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
192 .nr ^x \\n(^tu+1v-\\n(^Yu
193 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
206 '\" # DS - begin display
212 '\" # DE - end display
218 '\" # SO - start of list of standard options
220 .SH "STANDARD OPTIONS"
226 '\" # SE - end of list of standard options
231 See the \\fBoptions\\fR manual entry for details on the standard options.
233 '\" # OP - start of full description for a single option
238 Command-Line Name: \\fB\\$1\\fR
239 Database Name: \\fB\\$2\\fR
240 Database Class: \\fB\\$3\\fR
244 '\" # CS - begin code excerpt
252 '\" # CE - end code excerpt
262 .TH bitmap n 2.5 BLT "BLT Built-In Commands"
264 '\" Note: do not modify the .SH NAME line immediately below!
266 bitmap \- Define a new bitmap from a Tcl script
268 \fBbitmap define \fIbitmapName data\fR ?\fIoption value\fR?...
270 \fBbitmap compose \fIbitmapName text\fR ?\fIoption value\fR?...
272 \fBbitmap exists \fIbitmapName\fR
274 \fBbitmap source \fIbitmapName\fR
276 \fBbitmap data \fIbitmapName\fR
278 \fBbitmap height \fIbitmapName\fR
280 \fBbitmap width \fIbitmapName\fR
283 The \fBbitmap\fR command lets you create new bitmaps directly from your
284 Tcl script. The bitmap can be specified as a list of data or a text string
285 which is converted into a bitmap. You can arbitrarily scale
286 or rotate the bitmap too.
288 Bitmaps are commonly used within Tk. In label and button widgets, you
289 display bitmaps them instead of text strings and in the canvas and
290 text widgets, they're used for stippling. But Tk let's you can create
291 new bitmaps only by reading the bitmap data from a file. This makes
292 bitmaps cumbersome to manage, especially in packaging the program as a
293 \fBwish\fR script, since each bitmap must be its own file. It would
294 be nicer if you could create new bitmaps directly from your Tcl script.
296 The \fBbitmap\fR command lets you do just that. You can specify the
297 bitmap as in various formats (such as the X11 bitmap format). You can
298 also compose a bitmap from a text string. The \fBbitmap\fR command
299 also lets you and arbitrarily rotate or scale the bitmap. For example, you
300 could use this to create button widgets with the text label rotated 90
304 You can define a new bitmap with the \fBdefine\fR operation. For
305 example, let's say you are using the X11 bitmap "gray1". Normally to
306 use it, you would specify the location of the file.
308 label .l -bitmap @/usr/X11R6/include/X11/bitmaps/gray1
310 But you can simply cut and paste the contents of "gray1" into the
311 \fBbitmap\fR command.
313 bitmap define gray1 {
314 #define gray1_width 2
315 #define gray1_height 2
316 static char gray1_bits[] = {
319 label .l -bitmap gray1
321 Tk will recognize "gray1" as a bitmap which can now be used with any
322 widget that accepts bitmaps.
324 .barchart element configure elem1 -stipple gray1
326 The bitmap data can be specified in a mulitude of forms.
327 The following commands are all equivalent.
329 bitmap define gray1 {
330 #define gray1_width 2
331 #define gray1_height 2
332 static char gray1_bits[] = {
335 bitmap define gray1 { { 2 2 } { 0x01, 0x02 } }
336 bitmap define gray1 { { 2 2 } { 0x01 0x02 } }
337 bitmap define gray1 { { 2 2 } { 1 2 } }
339 Either the data is in the standard X11 bitmap form, or it's a list of
340 two lists. The first list contains the height and width of the bitmap.
341 The second list is the bitmap source data. Each element of that list
342 is an hexadecimal number specifying which pixels are foreground (1)
343 and which are background (0) of the bitmap. Note that the format of
344 the source data is exactly that of the XBM format.
346 You can scale or rotate the bitmap as you create it, by using the
347 \fB-scale\fR or\fB-rotate\fR options.
349 bitmap define gray1 {
350 #define gray1_width 2
351 #define gray1_height 2
352 static char gray1_bits[] = {
354 } -scale 2.0 -rotate 90.0
356 In addition, you can compose bitmaps from text strings. This makes it
357 easy to create rotated buttons or labels. The text string can have
360 bitmap compose rot_text "This is rotated\\ntext" \\
361 -rotate 90.0 -font fixed
363 There are also a number of ways to query bitmaps. This isn't limited
364 to bitmaps that you create, but any bitmap.
366 bitmap exists rot_text
367 bitmap width rot_text
368 bitmap height rot_text
370 bitmap source rot_text
372 The \fBexists\fR operation indicates if a bitmap by that name is
373 defined. You can query the dimensions of the bitmap using the
374 \fBwidth\fR and \fBheight\fR operations. The \fBdata\fR operation
375 returns the list of the data used to create the bitmap.
376 For example, you could query the data of a bitmap and \fBsend\fR
377 it across the network to another Tk application.
379 set data [bitmap data @/usr/X11R6/include/X11/bitmaps/ghost.xbm]
380 send {wish #2} bitmap define ghost $data
383 The following operations are available for \fBbitmap\fR:
385 \fBbitmap compose \fIbitmapName text \fR?\fIoption value\fR?...
386 Creates a bitmap \fIbitmapName\fR from the text string \fItext\fR.
387 A bitmap \fIbitmapName\fR can not already exist.
388 The following options are available.
391 \fB\-font \fIfontName\fR
392 Specifies a font to use when drawing text into the bitmap.
393 If this option isn't specified then \fIfontName\fR defaults to
394 \fB*-Helvetica-Bold-R-Normal-*-140-*\fR.
396 \fB\-rotate \fItheta\fR
397 Specifies the angle of rotation of the text in the bitmap.
398 \fITheta\fR is a real number representing the angle in degrees.
399 It defaults to \fB0.0\fR degrees.
401 \fB\-scale \fIvalue\fR
402 Specifies the scale of the bitmap.
403 \fIValue\fR is a real number representing the scale. A scale
404 of 1.0 indicates no scaling is necessary, while 2.0 would
405 double the size of the bitmap. There is no way to specify
406 differents scales for the width and height of the bitmap.
407 The default scale is \fB1.0\fR.
410 \fBbitmap data \fIbitmapName\fR
411 Returns a list of both the
412 dimensions of the bitmap \fIbitmapName\fR and its source data.
414 \fBbitmap define \fIbitmapName data\fR \fR?\fIoption value\fR?...
415 Associates \fIbitmapName\fR with in-memory bitmap data so that
416 \fIbitmapName\fR can be used in later calls to \fBTk_GetBitmap\fR.
417 The \fIbitmapName\fR argument is the name of the bitmap; it must not
418 previously have been defined in either a call to Tk_DefineBitmap or
419 \fBbitmap\fR. The argument \fIdata\fP describes the bitmap to
420 be created. It is either the X11 bitmap format (a C structure) or
421 a list of two lists: the dimensions and source data. The dimensions
422 are a list of two numbers which are the width
423 and height of the bitmap. The source data is a list of hexadecimal
424 values in a format similar to the X11 or X10 bitmap format. The
425 values may be optionally separated by commas and do not need to be
426 prefixed with "0x". The following options are available.
429 \fB\-rotate \fItheta\fR
430 Specifies how many degrees to rotate the bitmap.
431 \fITheta\fR is a real number representing the angle.
432 The default is \fB0.0\fR degrees.
434 \fB\-scale \fIvalue\fR
435 Specifies how to scale the bitmap.
436 \fIValue\fR is a real number representing the scale. A scale
437 of 1.0 indicates no scaling is necessary, while 2.0 would
438 double the size of the bitmap. There is no way to specify
439 differents scales for the width and height of the bitmap.
440 The default scale is \fB1.0\fR.
443 \fBbitmap exists \fIbitmapName\fR
444 Returns \fB1\fR if a bitmap \fIbitmapName\fR exists, otherwise \fB0\fR.
446 \fBbitmap height \fIbitmapName\fR
447 Returns the height in pixels of the bitmap \fIbitmapName\fR.
449 \fBbitmap source \fIbitmapName\fR
450 Returns the source data of the bitmap \fIbitmapName\fR. The source data is a
451 list of the hexadecimal values.
453 \fBbitmap width \fIbitmapName\fR
454 Returns the width in pixels of the bitmap \fIbitmapName\fR.
456 Tk currently offers no way of destroying bitmaps. Once a bitmap is
457 created, it exists until the application terminates.