OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / man / man3 / Tk_PhotoGetSize.3
1 '\"
2 '\" Copyright (c) 1994 The Australian National University
3 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 '\" Author: Paul Mackerras (paulus@cs.anu.edu.au),
9 '\"         Department of Computer Science,
10 '\"         Australian National University.
11 '\"
12 '\" RCS: @(#) $Id: FindPhoto.3,v 1.3 1999/10/29 03:57:40 hobbs Exp $
13 '\"
14 '\" The definitions below are for supplemental macros used in Tcl/Tk
15 '\" manual entries.
16 '\"
17 '\" .AP type name in/out ?indent?
18 '\"     Start paragraph describing an argument to a library procedure.
19 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
20 '\"     or "in/out" to describe whether procedure reads or modifies arg,
21 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
22 '\"     needed;  use .AS below instead)
23 '\"
24 '\" .AS ?type? ?name?
25 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
26 '\"     name are examples of largest possible arguments that will be passed
27 '\"     to .AP later.  If args are omitted, default tab stops are used.
28 '\"
29 '\" .BS
30 '\"     Start box enclosure.  From here until next .BE, everything will be
31 '\"     enclosed in one large box.
32 '\"
33 '\" .BE
34 '\"     End of box enclosure.
35 '\"
36 '\" .CS
37 '\"     Begin code excerpt.
38 '\"
39 '\" .CE
40 '\"     End code excerpt.
41 '\"
42 '\" .VS ?version? ?br?
43 '\"     Begin vertical sidebar, for use in marking newly-changed parts
44 '\"     of man pages.  The first argument is ignored and used for recording
45 '\"     the version when the .VS was added, so that the sidebars can be
46 '\"     found and removed when they reach a certain age.  If another argument
47 '\"     is present, then a line break is forced before starting the sidebar.
48 '\"
49 '\" .VE
50 '\"     End of vertical sidebar.
51 '\"
52 '\" .DS
53 '\"     Begin an indented unfilled display.
54 '\"
55 '\" .DE
56 '\"     End of indented unfilled display.
57 '\"
58 '\" .SO
59 '\"     Start of list of standard options for a Tk widget.  The
60 '\"     options follow on successive lines, in four columns separated
61 '\"     by tabs.
62 '\"
63 '\" .SE
64 '\"     End of list of standard options for a Tk widget.
65 '\"
66 '\" .OP cmdName dbName dbClass
67 '\"     Start of description of a specific option.  cmdName gives the
68 '\"     option's name as specified in the class command, dbName gives
69 '\"     the option's name in the option database, and dbClass gives
70 '\"     the option's class in the option database.
71 '\"
72 '\" .UL arg1 arg2
73 '\"     Print arg1 underlined, then print arg2 normally.
74 '\"
75 '\" RCS: @(#) $Id: man.macros,v 1.3 1999/04/16 00:46:35 stanton Exp $
76 '\"
77 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
78 .if t .wh -1.3i ^B
79 .nr ^l \n(.l
80 .ad b
81 '\"     # Start an argument description
82 .de AP
83 .ie !"\\$4"" .TP \\$4
84 .el \{\
85 .   ie !"\\$2"" .TP \\n()Cu
86 .   el          .TP 15
87 .\}
88 .ta \\n()Au \\n()Bu
89 .ie !"\\$3"" \{\
90 \&\\$1  \\fI\\$2\\fP    (\\$3)
91 .\".b
92 .\}
93 .el \{\
94 .br
95 .ie !"\\$2"" \{\
96 \&\\$1  \\fI\\$2\\fP
97 .\}
98 .el \{\
99 \&\\fI\\$1\\fP
100 .\}
101 .\}
102 ..
103 '\"     # define tabbing values for .AP
104 .de AS
105 .nr )A 10n
106 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
107 .nr )B \\n()Au+15n
108 .\"
109 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
110 .nr )C \\n()Bu+\\w'(in/out)'u+2n
111 ..
112 .AS Tcl_Interp Tcl_CreateInterp in/out
113 '\"     # BS - start boxed text
114 '\"     # ^y = starting y location
115 '\"     # ^b = 1
116 .de BS
117 .br
118 .mk ^y
119 .nr ^b 1u
120 .if n .nf
121 .if n .ti 0
122 .if n \l'\\n(.lu\(ul'
123 .if n .fi
124 ..
125 '\"     # BE - end boxed text (draw box now)
126 .de BE
127 .nf
128 .ti 0
129 .mk ^t
130 .ie n \l'\\n(^lu\(ul'
131 .el \{\
132 .\"     Draw four-sided box normally, but don't draw top of
133 .\"     box if the box started on an earlier page.
134 .ie !\\n(^b-1 \{\
135 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
136 .\}
137 .el \}\
138 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
139 .\}
140 .\}
141 .fi
142 .br
143 .nr ^b 0
144 ..
145 '\"     # VS - start vertical sidebar
146 '\"     # ^Y = starting y location
147 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
148 .de VS
149 .if !"\\$2"" .br
150 .mk ^Y
151 .ie n 'mc \s12\(br\s0
152 .el .nr ^v 1u
153 ..
154 '\"     # VE - end of vertical sidebar
155 .de VE
156 .ie n 'mc
157 .el \{\
158 .ev 2
159 .nf
160 .ti 0
161 .mk ^t
162 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
163 .sp -1
164 .fi
165 .ev
166 .\}
167 .nr ^v 0
168 ..
169 '\"     # Special macro to handle page bottom:  finish off current
170 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
171 '\"     # page bottom macro.
172 .de ^B
173 .ev 2
174 'ti 0
175 'nf
176 .mk ^t
177 .if \\n(^b \{\
178 .\"     Draw three-sided box if this is the box's first page,
179 .\"     draw two sides but no top otherwise.
180 .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
181 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
182 .\}
183 .if \\n(^v \{\
184 .nr ^x \\n(^tu+1v-\\n(^Yu
185 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
186 .\}
187 .bp
188 'fi
189 .ev
190 .if \\n(^b \{\
191 .mk ^y
192 .nr ^b 2
193 .\}
194 .if \\n(^v \{\
195 .mk ^Y
196 .\}
197 ..
198 '\"     # DS - begin display
199 .de DS
200 .RS
201 .nf
202 .sp
203 ..
204 '\"     # DE - end display
205 .de DE
206 .fi
207 .RE
208 .sp
209 ..
210 '\"     # SO - start of list of standard options
211 .de SO
212 .SH "STANDARD OPTIONS"
213 .LP
214 .nf
215 .ta 4c 8c 12c
216 .ft B
217 ..
218 '\"     # SE - end of list of standard options
219 .de SE
220 .fi
221 .ft R
222 .LP
223 See the \\fBoptions\\fR manual entry for details on the standard options.
224 ..
225 '\"     # OP - start of full description for a single option
226 .de OP
227 .LP
228 .nf
229 .ta 4c
230 Command-Line Name:      \\fB\\$1\\fR
231 Database Name:  \\fB\\$2\\fR
232 Database Class: \\fB\\$3\\fR
233 .fi
234 .IP
235 ..
236 '\"     # CS - begin code excerpt
237 .de CS
238 .RS
239 .nf
240 .ta .25i .5i .75i 1i
241 ..
242 '\"     # CE - end code excerpt
243 .de CE
244 .fi
245 .RE
246 ..
247 .de UL
248 \\$1\l'|0\(ul'\\$2
249 ..
250 .TH Tk_FindPhoto 3 8.0 Tk "Tk Library Procedures"
251 .BS
252 .SH NAME
253 Tk_FindPhoto, Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock, Tk_PhotoGetImage, Tk_PhotoBlank, Tk_PhotoExpand, Tk_PhotoGetSize, Tk_PhotoSetSize \- manipulate the image data stored in a photo image.
254 .SH SYNOPSIS
255 .nf
256 \fB#include <tk.h>\fR
257 \fB#include <tkPhoto.h>\fR
258 .sp
259 Tk_PhotoHandle
260 .VS 8.0 br
261 \fBTk_FindPhoto\fR(\fIinterp, imageName\fR)
262 .VE
263 .sp
264 void
265 \fBTk_PhotoPutBlock\fR(\fIhandle, blockPtr, x, y, width, height\fR)
266 .sp
267 void
268 \fBTk_PhotoPutZoomedBlock\fR(\fIhandle, blockPtr, x, y, width, height,\
269 zoomX, zoomY, subsampleX, subsampleY\fR)
270 .sp
271 int
272 \fBTk_PhotoGetImage\fR(\fIhandle, blockPtr\fR)
273 .sp
274 void
275 \fBTk_PhotoBlank\fR(\fIhandle\fR)
276 .sp
277 void
278 \fBTk_PhotoExpand\fR(\fIhandle, width, height\fR)
279 .sp
280 void
281 \fBTk_PhotoGetSize\fR(\fIhandle, widthPtr, heightPtr\fR)
282 .sp
283 void
284 \fBTk_PhotoSetSize\fR(\fIhandle, width, height\fR)
285 .SH ARGUMENTS
286 .AS Tk_PhotoImageBlock window_path
287 .AP Tcl_Interp *interp in
288 .VS
289 Interpreter in which image was created.
290 .VE
291 .AP char *imageName in
292 Name of the photo image.
293 .AP Tk_PhotoHandle handle in
294 Opaque handle identifying the photo image to be affected.
295 .AP Tk_PhotoImageBlock *blockPtr in
296 Specifies the address and storage layout of image data.
297 .AP int x in
298 Specifies the X coordinate where the top-left corner of the block is
299 to be placed within the image.
300 .AP int y in
301 Specifies the Y coordinate where the top-left corner of the block is
302 to be placed within the image.
303 .AP int width in
304 Specifies the width of the image area to be affected (for
305 \fBTk_PhotoPutBlock\fR) or the desired image width (for
306 \fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR).
307 .AP int height in
308 Specifies the height of the image area to be affected (for
309 \fBTk_PhotoPutBlock\fR) or the desired image height (for
310 \fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR).
311 .AP int *widthPtr out
312 Pointer to location in which to store the image width.
313 .AP int *heightPtr out
314 Pointer to location in which to store the image height.
315 .AP int subsampleX in
316 Specifies the subsampling factor in the X direction for input
317 image data.
318 .AP int subsampleY in
319 Specifies the subsampling factor in the Y direction for input
320 image data.
321 .AP int zoomX in
322 Specifies the zoom factor to be applied in the X direction to pixels
323 being written to the photo image.
324 .AP int zoomY in
325 Specifies the zoom factor to be applied in the Y direction to pixels
326 being written to the photo image.
327 .BE
328
329 .SH DESCRIPTION
330 .PP
331 \fBTk_FindPhoto\fR returns an opaque handle that is used to identify a
332 particular photo image to the other procedures.  The parameter is the
333 name of the image, that is, the name specified to the \fBimage create
334 photo\fR command, or assigned by that command if no name was specified.
335 .PP
336 \fBTk_PhotoPutBlock\fR is used to supply blocks of image data to be
337 displayed.  The call affects an area of the image of size
338 \fIwidth\fR x \fIheight\fR pixels, with its top-left corner at
339 coordinates (\fIx\fR,\fIy\fR).  All of \fIwidth\fR, \fIheight\fR,
340 \fIx\fR, and \fIy\fR must be non-negative.
341 If part of this area lies outside the
342 current bounds of the image, the image will be expanded to include the
343 area, unless the user has specified an explicit image size with the
344 \fB\-width\fR and/or \fB\-height\fR widget configuration options
345 (see photo(n)); in that
346 case the area is silently clipped to the image boundaries.
347 .PP
348 The \fIblock\fR parameter is a pointer to a
349 \fBTk_PhotoImageBlock\fR structure, defined as follows:
350 .CS
351 typedef struct {
352         unsigned char *\fIpixelPtr\fR;
353         int \fIwidth\fR;
354         int \fIheight\fR;
355         int \fIpitch\fR;
356         int \fIpixelSize\fR;
357         int \fIoffset[4]\fR;
358 } Tk_PhotoImageBlock;
359 .CE
360 The \fIpixelPtr\fR field points to the first pixel, that is, the
361 top-left pixel in the block.
362 The \fIwidth\fR and \fIheight\fR fields specify the dimensions of the
363 block of pixels.  The \fIpixelSize\fR field specifies the address
364 difference between two horizontally adjacent pixels.  Often it is 3
365 or 4, but it can have any value.  The \fIpitch\fR field specifies the
366 address difference between two vertically adjacent pixels.  The
367 \fIoffset\fR array contains the offsets from the address of a pixel
368 to the addresses of the bytes containing the red, green, blue and alpha
369 (transparency) components.  These are normally 0, 1, 2 and 3, but can
370 have other values, e.g., for images that are stored as separate red,
371 green and blue planes.
372 .PP
373 The value given for the \fIwidth\fR and \fIheight\fR parameters to
374 \fBTk_PhotoPutBlock\fR do not have to correspond to the values specified
375 in \fIblock\fR.  If they are smaller, \fBTk_PhotoPutBlock\fR extracts a
376 sub-block from the image data supplied.  If they are larger, the data
377 given are replicated (in a tiled fashion) to fill the specified area.
378 These rules operate independently in the horizontal and vertical
379 directions.
380 .PP
381 \fBTk_PhotoPutZoomedBlock\fR works like \fBTk_PhotoPutBlock\fR except that
382 the image can be reduced or enlarged for display.  The
383 \fIsubsampleX\fR and \fIsubsampleY\fR parameters allow the size of the
384 image to be reduced by subsampling.
385 \fBTk_PhotoPutZoomedBlock\fR will use only pixels from the input image
386 whose X coordinates are multiples of \fIsubsampleX\fR, and whose Y
387 coordinates are multiples of \fIsubsampleY\fR.  For example, an image
388 of 512x512 pixels can be reduced to 256x256 by setting
389 \fIsubsampleX\fR and \fIsubsampleY\fR to 2.
390 .PP
391 The \fIzoomX\fR and \fIzoomY\fR parameters allow the image to be
392 enlarged by pixel replication.  Each pixel of the (possibly subsampled)
393 input image will be written to a block \fIzoomX\fR pixels wide and
394 \fIzoomY\fR pixels high of the displayed image.  Subsampling and
395 zooming can be used together for special effects.
396 .PP
397 \fBTk_PhotoGetImage\fR can be used to retrieve image data from a photo
398 image.  \fBTk_PhotoGetImage\fR fills
399 in the structure pointed to by the \fIblockPtr\fR parameter with values
400 that describe the address and layout of the image data that the
401 photo image has stored internally.  The values are valid
402 until the image is destroyed or its size is changed.
403 \fBTk_PhotoGetImage\fR returns 1 for compatibility with the
404 corresponding procedure in the old photo widget.
405 .PP
406 \fBTk_PhotoBlank\fR blanks the entire area of the
407 photo image.  Blank areas of a photo image are transparent.
408 .PP
409 \fBTk_PhotoExpand\fR requests that the widget's image be expanded to be
410 at least \fIwidth\fR x \fIheight\fR pixels in size.  The width and/or
411 height are unchanged if the user has specified an explicit image width
412 or height with the \fB\-width\fR and/or \fB\-height\fR configuration
413 options, respectively.
414 If the image data
415 are being supplied in many small blocks, it is more efficient to use
416 \fBTk_PhotoExpand\fR or \fBTk_PhotoSetSize\fR at the beginning rather than
417 allowing the image to expand in many small increments as image blocks
418 are supplied.
419 .PP
420 \fBTk_PhotoSetSize\fR specifies the size of the image, as if the user
421 had specified the given \fIwidth\fR and \fIheight\fR values to the
422 \fB\-width\fR and \fB\-height\fR configuration options.  A value of
423 zero for \fIwidth\fR or \fIheight\fR does not change the image's width
424 or height, but allows the width or height to be changed by subsequent
425 calls to \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR or
426 \fBTk_PhotoExpand\fR.
427 .PP
428 \fBTk_PhotoGetSize\fR returns the dimensions of the image in
429 *\fIwidthPtr\fR and *\fIheightPtr\fR.
430
431 .SH CREDITS
432 .PP
433 The code for the photo image type was developed by Paul Mackerras,
434 based on his earlier photo widget code.
435
436 .SH KEYWORDS
437 photo, image