| 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.6 2002/08/05 04:30:38 dgp 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.4 2000/08/25 06:18:32 ericm 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 5.5c 11c |
| 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, compRule\fR) |
| 266 | .sp |
| 267 | void |
| 268 | \fBTk_PhotoPutZoomedBlock\fR(\fIhandle, blockPtr, x, y, width, height,\ |
| 269 | zoomX, zoomY, subsampleX, subsampleY, compRule\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 "CONST 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 | .VS 8.4 |
| 308 | .AP int compRule in |
| 309 | Specifies the compositing rule used when combining transparent pixels |
| 310 | in a block of data with a photo image. Must be one of |
| 311 | TK_PHOTO_COMPOSITE_OVERLAY (which puts the block of data over the top |
| 312 | of the existing photo image, with the previous contents showing |
| 313 | through in the transparent bits) or TK_PHOTO_COMPOSITE_SET (which |
| 314 | discards the existing photo image contents in the rectangle covered by |
| 315 | the data block.) |
| 316 | .VE 8.4 |
| 317 | .AP int height in |
| 318 | Specifies the height of the image area to be affected (for |
| 319 | \fBTk_PhotoPutBlock\fR) or the desired image height (for |
| 320 | \fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR). |
| 321 | .AP int *widthPtr out |
| 322 | Pointer to location in which to store the image width. |
| 323 | .AP int *heightPtr out |
| 324 | Pointer to location in which to store the image height. |
| 325 | .AP int subsampleX in |
| 326 | Specifies the subsampling factor in the X direction for input |
| 327 | image data. |
| 328 | .AP int subsampleY in |
| 329 | Specifies the subsampling factor in the Y direction for input |
| 330 | image data. |
| 331 | .AP int zoomX in |
| 332 | Specifies the zoom factor to be applied in the X direction to pixels |
| 333 | being written to the photo image. |
| 334 | .AP int zoomY in |
| 335 | Specifies the zoom factor to be applied in the Y direction to pixels |
| 336 | being written to the photo image. |
| 337 | .BE |
| 338 | |
| 339 | .SH DESCRIPTION |
| 340 | .PP |
| 341 | \fBTk_FindPhoto\fR returns an opaque handle that is used to identify a |
| 342 | particular photo image to the other procedures. The parameter is the |
| 343 | name of the image, that is, the name specified to the \fBimage create |
| 344 | photo\fR command, or assigned by that command if no name was specified. |
| 345 | .PP |
| 346 | \fBTk_PhotoPutBlock\fR is used to supply blocks of image data to be |
| 347 | displayed. The call affects an area of the image of size |
| 348 | \fIwidth\fR x \fIheight\fR pixels, with its top-left corner at |
| 349 | coordinates (\fIx\fR,\fIy\fR). All of \fIwidth\fR, \fIheight\fR, |
| 350 | \fIx\fR, and \fIy\fR must be non-negative. |
| 351 | If part of this area lies outside the |
| 352 | current bounds of the image, the image will be expanded to include the |
| 353 | area, unless the user has specified an explicit image size with the |
| 354 | \fB\-width\fR and/or \fB\-height\fR widget configuration options |
| 355 | (see photo(n)); in that |
| 356 | case the area is silently clipped to the image boundaries. |
| 357 | .PP |
| 358 | The \fIblock\fR parameter is a pointer to a |
| 359 | \fBTk_PhotoImageBlock\fR structure, defined as follows: |
| 360 | .CS |
| 361 | typedef struct { |
| 362 | unsigned char *\fIpixelPtr\fR; |
| 363 | int \fIwidth\fR; |
| 364 | int \fIheight\fR; |
| 365 | int \fIpitch\fR; |
| 366 | int \fIpixelSize\fR; |
| 367 | int \fIoffset[4]\fR; |
| 368 | } Tk_PhotoImageBlock; |
| 369 | .CE |
| 370 | The \fIpixelPtr\fR field points to the first pixel, that is, the |
| 371 | top-left pixel in the block. |
| 372 | The \fIwidth\fR and \fIheight\fR fields specify the dimensions of the |
| 373 | block of pixels. The \fIpixelSize\fR field specifies the address |
| 374 | difference between two horizontally adjacent pixels. Often it is 3 |
| 375 | or 4, but it can have any value. The \fIpitch\fR field specifies the |
| 376 | address difference between two vertically adjacent pixels. The |
| 377 | \fIoffset\fR array contains the offsets from the address of a pixel |
| 378 | to the addresses of the bytes containing the red, green, blue and alpha |
| 379 | (transparency) components. These are normally 0, 1, 2 and 3, but can |
| 380 | have other values, e.g., for images that are stored as separate red, |
| 381 | green and blue planes. |
| 382 | .PP |
| 383 | .VS 8.4 |
| 384 | The \fIcompRule\fR parameter to \fBTk_PhotoPutBlock\fR specifies a |
| 385 | compositing rule that says what to do with transparent pixels. The |
| 386 | value TK_PHOTO_COMPOSITE_OVERLAY says that the previous contents of |
| 387 | the photo image should show through, and the value |
| 388 | TK_PHOTO_COMPOSITE_SET says that the previous contents of the photo |
| 389 | image should be completely ignored, and the values from the block be |
| 390 | copied directly across. The behavior in Tk8.3 and earlier was |
| 391 | equivalent to having TK_PHOTO_COMPOSITE_OVERLAY as a compositing rule. |
| 392 | .VE 8.4 |
| 393 | .PP |
| 394 | The value given for the \fIwidth\fR and \fIheight\fR parameters to |
| 395 | \fBTk_PhotoPutBlock\fR do not have to correspond to the values specified |
| 396 | in \fIblock\fR. If they are smaller, \fBTk_PhotoPutBlock\fR extracts a |
| 397 | sub-block from the image data supplied. If they are larger, the data |
| 398 | given are replicated (in a tiled fashion) to fill the specified area. |
| 399 | These rules operate independently in the horizontal and vertical |
| 400 | directions. |
| 401 | .PP |
| 402 | \fBTk_PhotoPutZoomedBlock\fR works like \fBTk_PhotoPutBlock\fR except that |
| 403 | the image can be reduced or enlarged for display. The |
| 404 | \fIsubsampleX\fR and \fIsubsampleY\fR parameters allow the size of the |
| 405 | image to be reduced by subsampling. |
| 406 | \fBTk_PhotoPutZoomedBlock\fR will use only pixels from the input image |
| 407 | whose X coordinates are multiples of \fIsubsampleX\fR, and whose Y |
| 408 | coordinates are multiples of \fIsubsampleY\fR. For example, an image |
| 409 | of 512x512 pixels can be reduced to 256x256 by setting |
| 410 | \fIsubsampleX\fR and \fIsubsampleY\fR to 2. |
| 411 | .PP |
| 412 | The \fIzoomX\fR and \fIzoomY\fR parameters allow the image to be |
| 413 | enlarged by pixel replication. Each pixel of the (possibly subsampled) |
| 414 | input image will be written to a block \fIzoomX\fR pixels wide and |
| 415 | \fIzoomY\fR pixels high of the displayed image. Subsampling and |
| 416 | zooming can be used together for special effects. |
| 417 | .PP |
| 418 | \fBTk_PhotoGetImage\fR can be used to retrieve image data from a photo |
| 419 | image. \fBTk_PhotoGetImage\fR fills |
| 420 | in the structure pointed to by the \fIblockPtr\fR parameter with values |
| 421 | that describe the address and layout of the image data that the |
| 422 | photo image has stored internally. The values are valid |
| 423 | until the image is destroyed or its size is changed. |
| 424 | \fBTk_PhotoGetImage\fR returns 1 for compatibility with the |
| 425 | corresponding procedure in the old photo widget. |
| 426 | .PP |
| 427 | \fBTk_PhotoBlank\fR blanks the entire area of the |
| 428 | photo image. Blank areas of a photo image are transparent. |
| 429 | .PP |
| 430 | \fBTk_PhotoExpand\fR requests that the widget's image be expanded to be |
| 431 | at least \fIwidth\fR x \fIheight\fR pixels in size. The width and/or |
| 432 | height are unchanged if the user has specified an explicit image width |
| 433 | or height with the \fB\-width\fR and/or \fB\-height\fR configuration |
| 434 | options, respectively. |
| 435 | If the image data |
| 436 | are being supplied in many small blocks, it is more efficient to use |
| 437 | \fBTk_PhotoExpand\fR or \fBTk_PhotoSetSize\fR at the beginning rather than |
| 438 | allowing the image to expand in many small increments as image blocks |
| 439 | are supplied. |
| 440 | .PP |
| 441 | \fBTk_PhotoSetSize\fR specifies the size of the image, as if the user |
| 442 | had specified the given \fIwidth\fR and \fIheight\fR values to the |
| 443 | \fB\-width\fR and \fB\-height\fR configuration options. A value of |
| 444 | zero for \fIwidth\fR or \fIheight\fR does not change the image's width |
| 445 | or height, but allows the width or height to be changed by subsequent |
| 446 | calls to \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR or |
| 447 | \fBTk_PhotoExpand\fR. |
| 448 | .PP |
| 449 | \fBTk_PhotoGetSize\fR returns the dimensions of the image in |
| 450 | *\fIwidthPtr\fR and *\fIheightPtr\fR. |
| 451 | |
| 452 | .SH PORTABILITY |
| 453 | .VS 8.4 |
| 454 | .PP |
| 455 | In Tk 8.3 and earlier, \fBTk_PhotoPutBlock\fR and |
| 456 | \fBTk_PhotoPutZoomedBlock\fR had different signatures. If you want to |
| 457 | compile code that uses the old interface against 8.4 without updating |
| 458 | your code, compile it with the flag |
| 459 | -DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK. Code linked using Stubs against |
| 460 | older versions of Tk will continue to work. |
| 461 | .VE 8.4 |
| 462 | |
| 463 | .SH CREDITS |
| 464 | .PP |
| 465 | The code for the photo image type was developed by Paul Mackerras, |
| 466 | based on his earlier photo widget code. |
| 467 | |
| 468 | .SH KEYWORDS |
| 469 | photo, image |