OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / man / mann / bitmap.n
1 '\"
2 '\" Copyright 1991-2001 by Bell Labs Innovations for Lucent Technologies.
3 '\"
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.
11 '\"
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
18 '\" of this software.  
19 '\"
20 '\" Bitmap command created by George Howlett.
21 '\"
22 '\" The definitions below are for supplemental macros used in Tcl/Tk
23 '\" manual entries.
24 '\"
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)
31 '\"
32 '\" .AS ?type? ?name?
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.
36 '\"
37 '\" .BS
38 '\"     Start box enclosure.  From here until next .BE, everything will be
39 '\"     enclosed in one large box.
40 '\"
41 '\" .BE
42 '\"     End of box enclosure.
43 '\"
44 '\" .CS
45 '\"     Begin code excerpt.
46 '\"
47 '\" .CE
48 '\"     End code excerpt.
49 '\"
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.
56 '\"
57 '\" .VE
58 '\"     End of vertical sidebar.
59 '\"
60 '\" .DS
61 '\"     Begin an indented unfilled display.
62 '\"
63 '\" .DE
64 '\"     End of indented unfilled display.
65 '\"
66 '\" .SO
67 '\"     Start of list of standard options for a Tk widget.  The
68 '\"     options follow on successive lines, in four columns separated
69 '\"     by tabs.
70 '\"
71 '\" .SE
72 '\"     End of list of standard options for a Tk widget.
73 '\"
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.
79 '\"
80 '\" .UL arg1 arg2
81 '\"     Print arg1 underlined, then print arg2 normally.
82 '\"
83 '\" RCS: @(#) $Id: man.macros,v 1.1.1.1 2009/05/09 16:27:42 pcmacdon Exp $
84 '\"
85 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
86 .if t .wh -1.3i ^B
87 .nr ^l \n(.l
88 .ad b
89 '\"     # Start an argument description
90 .de AP
91 .ie !"\\$4"" .TP \\$4
92 .el \{\
93 .   ie !"\\$2"" .TP \\n()Cu
94 .   el          .TP 15
95 .\}
96 .ta \\n()Au \\n()Bu
97 .ie !"\\$3"" \{\
98 \&\\$1  \\fI\\$2\\fP    (\\$3)
99 .\".b
100 .\}
101 .el \{\
102 .br
103 .ie !"\\$2"" \{\
104 \&\\$1  \\fI\\$2\\fP
105 .\}
106 .el \{\
107 \&\\fI\\$1\\fP
108 .\}
109 .\}
110 ..
111 '\"     # define tabbing values for .AP
112 .de AS
113 .nr )A 10n
114 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
115 .nr )B \\n()Au+15n
116 .\"
117 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
118 .nr )C \\n()Bu+\\w'(in/out)'u+2n
119 ..
120 .AS Tcl_Interp Tcl_CreateInterp in/out
121 '\"     # BS - start boxed text
122 '\"     # ^y = starting y location
123 '\"     # ^b = 1
124 .de BS
125 .br
126 .mk ^y
127 .nr ^b 1u
128 .if n .nf
129 .if n .ti 0
130 .if n \l'\\n(.lu\(ul'
131 .if n .fi
132 ..
133 '\"     # BE - end boxed text (draw box now)
134 .de BE
135 .nf
136 .ti 0
137 .mk ^t
138 .ie n \l'\\n(^lu\(ul'
139 .el \{\
140 .\"     Draw four-sided box normally, but don't draw top of
141 .\"     box if the box started on an earlier page.
142 .ie !\\n(^b-1 \{\
143 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
144 .\}
145 .el \}\
146 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
147 .\}
148 .\}
149 .fi
150 .br
151 .nr ^b 0
152 ..
153 '\"     # VS - start vertical sidebar
154 '\"     # ^Y = starting y location
155 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
156 .de VS
157 .if !"\\$2"" .br
158 .mk ^Y
159 .ie n 'mc \s12\(br\s0
160 .el .nr ^v 1u
161 ..
162 '\"     # VE - end of vertical sidebar
163 .de VE
164 .ie n 'mc
165 .el \{\
166 .ev 2
167 .nf
168 .ti 0
169 .mk ^t
170 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
171 .sp -1
172 .fi
173 .ev
174 .\}
175 .nr ^v 0
176 ..
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.
180 .de ^B
181 .ev 2
182 'ti 0
183 'nf
184 .mk ^t
185 .if \\n(^b \{\
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
190 .\}
191 .if \\n(^v \{\
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
194 .\}
195 .bp
196 'fi
197 .ev
198 .if \\n(^b \{\
199 .mk ^y
200 .nr ^b 2
201 .\}
202 .if \\n(^v \{\
203 .mk ^Y
204 .\}
205 ..
206 '\"     # DS - begin display
207 .de DS
208 .RS
209 .nf
210 .sp
211 ..
212 '\"     # DE - end display
213 .de DE
214 .fi
215 .RE
216 .sp
217 ..
218 '\"     # SO - start of list of standard options
219 .de SO
220 .SH "STANDARD OPTIONS"
221 .LP
222 .nf
223 .ta 4c 8c 12c
224 .ft B
225 ..
226 '\"     # SE - end of list of standard options
227 .de SE
228 .fi
229 .ft R
230 .LP
231 See the \\fBoptions\\fR manual entry for details on the standard options.
232 ..
233 '\"     # OP - start of full description for a single option
234 .de OP
235 .LP
236 .nf
237 .ta 4c
238 Command-Line Name:      \\fB\\$1\\fR
239 Database Name:  \\fB\\$2\\fR
240 Database Class: \\fB\\$3\\fR
241 .fi
242 .IP
243 ..
244 '\"     # CS - begin code excerpt
245 .de CS
246 .RS
247 .nf
248 .ta .25i .5i .75i 1i
249 .ft CW
250 .sp
251 ..
252 '\"     # CE - end code excerpt
253 .de CE
254 .fi
255 .RE
256 .ft R
257 .sp
258 ..
259 .de UL
260 \\$1\l'|0\(ul'\\$2
261 ..
262 .TH bitmap n 2.5 BLT "BLT Built-In Commands"
263 .BS
264 '\" Note:  do not modify the .SH NAME line immediately below!
265 .SH NAME
266 bitmap \- Define a new bitmap from a Tcl script
267 .SH SYNOPSIS
268 \fBbitmap define \fIbitmapName data\fR ?\fIoption value\fR?...
269 .sp
270 \fBbitmap compose \fIbitmapName text\fR ?\fIoption value\fR?...
271 .sp
272 \fBbitmap exists \fIbitmapName\fR
273 .sp
274 \fBbitmap source \fIbitmapName\fR
275 .sp
276 \fBbitmap data \fIbitmapName\fR
277 .sp
278 \fBbitmap height \fIbitmapName\fR
279 .sp
280 \fBbitmap width \fIbitmapName\fR
281 .BE
282 .SH DESCRIPTION
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.
287 .SH INTRODUCTION
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.
295 .PP
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
301 degrees.
302 .SH EXAMPLE
303 <<<<<<< bitmap.mann
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.
307 .CS
308 label .l -bitmap @/usr/X11R6/include/X11/bitmaps/gray1
309 .CE
310 But you can simply cut and paste the contents of "gray1" into the 
311 \fBbitmap\fR command.
312 .CS
313 bitmap define gray1 {
314     #define gray1_width 2
315     #define gray1_height 2
316     static char gray1_bits[] = {
317        0x01, 0x02};
318 }
319 label .l -bitmap gray1
320 .CE
321 Tk will recognize "gray1" as a bitmap which can now be used with any
322 widget that accepts bitmaps.
323 .CS
324 .barchart element configure elem1 -stipple gray1
325 .CE
326 The bitmap data can be specified in a mulitude of forms.
327 The following commands are all equivalent.
328 .CS
329 bitmap define gray1 {
330     #define gray1_width 2
331     #define gray1_height 2
332     static char gray1_bits[] = {
333        0x01, 0x02};
334 }
335 bitmap define gray1 { { 2 2 } { 0x01, 0x02 } }
336 bitmap define gray1 { { 2 2 } { 0x01 0x02 } }
337 bitmap define gray1 { { 2 2 } { 1 2 } }
338 .CE
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. 
345 .P
346 You can scale or rotate the bitmap as you create it, by using the
347 \fB-scale\fR or\fB-rotate\fR options.
348 .CS
349 bitmap define gray1 {
350     #define gray1_width 2
351     #define gray1_height 2
352     static char gray1_bits[] = {
353        0x01, 0x02};
354 } -scale 2.0 -rotate 90.0
355 .CE
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
358 multi-line.  
359 .CS
360 bitmap compose rot_text "This is rotated\\ntext" \\
361         -rotate 90.0 -font fixed
362 .CE
363 There are also a number of ways to query bitmaps.  This isn't limited
364 to bitmaps that you create, but any bitmap.
365 .CS
366 bitmap exists rot_text
367 bitmap width rot_text
368 bitmap height rot_text
369 bitmap data rot_text
370 bitmap source rot_text
371 .CE
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.
378 .CS
379 set data [bitmap data @/usr/X11R6/include/X11/bitmaps/ghost.xbm]
380 send {wish #2} bitmap define ghost $data
381 .CE
382 .SH OPERATIONS
383 The following operations are available for \fBbitmap\fR:
384 .TP
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.
389 .RS
390 .TP
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.
395 .TP
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.
400 .TP
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.
408 .RE
409 .TP
410 \fBbitmap data \fIbitmapName\fR 
411 Returns a list of both the
412 dimensions of the bitmap \fIbitmapName\fR and its source data.
413 .TP
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.
427 .RS
428 .TP
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.
433 .TP
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.
441 .RE
442 .TP
443 \fBbitmap exists \fIbitmapName\fR 
444 Returns \fB1\fR if a bitmap \fIbitmapName\fR exists, otherwise \fB0\fR. 
445 .TP
446 \fBbitmap height \fIbitmapName\fR 
447 Returns the height in pixels of the bitmap \fIbitmapName\fR.
448 .TP
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.  
452 .TP
453 \fBbitmap width \fIbitmapName\fR 
454 Returns the width in pixels of the bitmap \fIbitmapName\fR.
455 .SH LIMITATIONS
456 Tk currently offers no way of destroying bitmaps.  Once a bitmap is
457 created, it exists until the application terminates.
458 .SH KEYWORDS
459 bitmap