Manual Pages for UNIX Darwin command on man Tk_PhotoExpand
MyWebUniversity

Manual Pages for UNIX Darwin command on man Tk_PhotoExpand

TkFindPhoto(3) Tk Library Procedures TkFindPhoto(3)

NAME

TkFindPhoto, TkPhotoPutBlock, TkPhotoPutZoomedBlock, TkPhotoGetIm-

age, TkPhotoBlank, TkPhotoExpand, TkPhotoGetSize, TkPhotoSetSize -

manipulate the image data stored in a photo image.

SYNOPSIS

##iinncclluuddee <>

TkPhotoHandle TTkkFFiinnddPPhhoottoo(interp, imageName) | void TTkkPPhhoottooPPuuttBBlloocckk(handle, blockPtr, x, y, width, height, compRule) void TTkkPPhhoottooPPuuttZZoooommeeddBBlloocckk(handle, blockPtr, x, y, width, height,zoomX, zoomY, subsampleX, subsampleY, compRule) int TTkkPPhhoottooGGeettIImmaaggee(handle, blockPtr) void TTkkPPhhoottooBBllaannkk(handle) void TTkkPPhhoottooEExxppaanndd(handle, width, height) void TTkkPPhhoottooGGeettSSiizzee(handle, widthPtr, heightPtr) void TTkkPPhhoottooSSeettSSiizzee(handle, width, height) AARRGGUUMMEENNTTSS TclInterp *interp (in) Interpreter in which image | was created. CONST char *imageName (in) Name of the photo image. TkPhotoHandle handle (in) Opaque handle identifying the photo image to be affected. TkPhotoImageBlock *blockPtr (in) Specifies the address and storage layout of image data. int x (in) Specifies the X coordinate

where the top-left corner

of the block is to be placed within the image. int y (in) Specifies the Y coordinate

where the top-left corner

of the block is to be placed within the image. int width (in) Specifies the width of the image area to be affected (for TTkkPPhhoottooPPuuttBBlloocckk) or the desired image width (for TTkkPPhhoottooEExxppaanndd and TTkkPPhhoottooSSeettSSiizzee). |

int com- |

pRule (in) | | Specifies the compositing | rule used when combining | transparent pixels in a | block of data with a photo | image. Must be one of | TKPHOTOCOMPOSITEOVERLAY | (which puts the block of | data over the top of the | existing photo image, with | the previous contents | showing through in the | transparent bits) or | TKPHOTOCOMPOSITESET |

(which discards the exist- |

ing photo image contents | in the rectangle covered | by the data block.) int height (in) Specifies the height of the image area to be

affected (for TTkkPPhhoottooPPuutt-

BBlloocckk) or the desired

image height (for TTkkPPhhoo-

ttooEExxppaanndd and TTkkPPhhoottooSSeett-

SSiizzee). int *widthPtr (out) Pointer to location in which to store the image width. int *heightPtr (out) Pointer to location in which to store the image height. int subsampleX (in) Specifies the subsampling factor in the X direction for input image data. int subsampleY (in) Specifies the subsampling factor in the Y direction for input image data. int zoomX (in) Specifies the zoom factor to be applied in the X direction to pixels being written to the photo image. int zoomY (in) Specifies the zoom factor to be applied in the Y direction to pixels being written to the photo image.

DESCRIPTION

TTkkFFiinnddPPhhoottoo returns an opaque handle that is used to identify a par-

ticular photo image to the other procedures. The parameter is the name of the image, that is, the name specified to the iimmaaggee ccrreeaattee pphhoottoo command, or assigned by that command if no name was specified.

TTkkPPhhoottooPPuuttBBlloocckk is used to supply blocks of image data to be dis-

played. The call affects an area of the image of size width x height

pixels, with its top-left corner at coordinates (x,y). All of width,

height, x, and y must be non-negative. If part of this area lies out-

side the current bounds of the image, the image will be expanded to include the area, unless the user has specified an explicit image size

with the -wwiiddtthh and/or -hheeiigghhtt widget configuration options (see

photo(n)); in that case the area is silently clipped to the image boundaries. The block parameter is a pointer to a TTkkPPhhoottooIImmaaggeeBBlloocckk structure, defined as follows: typedef struct { unsigned char *pixelPtr; int width; int height; int pitch; int pixelSize; int offset[4]; } TkPhotoImageBlock;

The pixelPtr field points to the first pixel, that is, the top-left

pixel in the block. The width and height fields specify the dimensions

of the block of pixels. The pixelSize field specifies the address dif-

ference between two horizontally adjacent pixels. Often it is 3 or 4,

but it can have any value. The pitch field specifies the address dif-

ference between two vertically adjacent pixels. The offset array con-

tains the offsets from the address of a pixel to the addresses of the

bytes containing the red, green, blue and alpha (transparency) compo-

nents. These are normally 0, 1, 2 and 3, but can have other values, e.g., for images that are stored as separate red, green and blue planes. The compRule parameter to TTkkPPhhoottooPPuuttBBlloocckk specifies a compositing rule |

that says what to do with transparent pixels. The value TKPHOTOCOM- |

POSITEOVERLAY says that the previous contents of the photo image | should show through, and the value TKPHOTOCOMPOSITESET says that the | previous contents of the photo image should be completely ignored, and | the values from the block be copied directly across. The behavior in | Tk8.3 and earlier was equivalent to having TKPHOTOCOMPOSITEOVERLAY | as a compositing rule. The value given for the width and height parameters to TTkkPPhhoottooPPuuttBBlloocckk do not have to correspond to the values specified in block. If they

are smaller, TTkkPPhhoottooPPuuttBBlloocckk extracts a sub-block from the image data

supplied. If they are larger, the data given are replicated (in a

tiled fashion) to fill the specified area. These rules operate inde-

pendently in the horizontal and vertical directions. TTkkPPhhoottooPPuuttZZoooommeeddBBlloocckk works like TTkkPPhhoottooPPuuttBBlloocckk except that the

image can be reduced or enlarged for display. The subsampleX and sub-

sampleY parameters allow the size of the image to be reduced by subsam-

pling. TTkkPPhhoottooPPuuttZZoooommeeddBBlloocckk will use only pixels from the input image whose X coordinates are multiples of subsampleX, and whose Y coordinates are multiples of subsampleY. For example, an image of

512x512 pixels can be reduced to 256x256 by setting subsampleX and sub-

sampleY to 2. The zoomX and zoomY parameters allow the image to be enlarged by pixel replication. Each pixel of the (possibly subsampled) input image will be written to a block zoomX pixels wide and zoomY pixels high of the

displayed image. Subsampling and zooming can be used together for spe-

cial effects. TTkkPPhhoottooGGeettIImmaaggee can be used to retrieve image data from a photo image. TTkkPPhhoottooGGeettIImmaaggee fills in the structure pointed to by the blockPtr parameter with values that describe the address and layout of the image data that the photo image has stored internally. The values are valid until the image is destroyed or its size is changed. TTkkPPhhoottooGGeettIImmaaggee returns 1 for compatibility with the corresponding procedure in the old photo widget. TTkkPPhhoottooBBllaannkk blanks the entire area of the photo image. Blank areas of a photo image are transparent. TTkkPPhhoottooEExxppaanndd requests that the widget's image be expanded to be at least width x height pixels in size. The width and/or height are unchanged if the user has specified an explicit image width or height

with the -wwiiddtthh and/or -hheeiigghhtt configuration options, respectively. If

the image data are being supplied in many small blocks, it is more efficient to use TTkkPPhhoottooEExxppaanndd or TTkkPPhhoottooSSeettSSiizzee at the beginning rather than allowing the image to expand in many small increments as image blocks are supplied. TTkkPPhhoottooSSeettSSiizzee specifies the size of the image, as if the user had

specified the given width and height values to the -wwiiddtthh and -hheeiigghhtt

configuration options. A value of zero for width or height does not change the image's width or height, but allows the width or height to

be changed by subsequent calls to TTkkPPhhoottooPPuuttBBlloocckk, TTkkPPhhoottooPPuuttZZoooommeedd-

BBlloocckk or TTkkPPhhoottooEExxppaanndd. TTkkPPhhoottooGGeettSSiizzee returns the dimensions of the image in *widthPtr and *heightPtr. PPOORRTTAABBIILLIITTYY In Tk 8.3 and earlier, TTkkPPhhoottooPPuuttBBlloocckk and TTkkPPhhoottooPPuuttZZoooommeeddBBlloocckk had | different signatures. If you want to compile code that uses the old | interface against 8.4 without updating your code, compile it with the |

flag -DUSECOMPOSITELESSPHOTOPUTBLOCK. Code linked using Stubs |

against older versions of Tk will continue to work. CCRREEDDIITTSS The code for the photo image type was developed by Paul Mackerras, based on his earlier photo widget code. KKEEYYWWOORRDDSS photo, image Tk 8.0 TkFindPhoto(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™