Tk_FindPhoto
NAMESYNOPSIS
ARGUMENTS
DESCRIPTION
PORTABILITY
CREDITS
KEYWORDS
___________________________
NAME
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.
SYNOPSIS
#include <tk.h>
Tk_PhotoHandle
Tk_FindPhoto(interp, imageName)
int
│
Tk_PhotoPutBlock(interp, handle, blockPtr, x, y,
width, height,compRule) │
int
│
Tk_PhotoPutZoomedBlock(interp, handle, blockPtr, x,
y, width, height,zoomX, zoomY, subsampleX, subsampleY,
compRule) │
int
Tk_PhotoGetImage(handle, blockPtr)
void
Tk_PhotoBlank(handle)
int
│
Tk_PhotoExpand(interp, handle, width, height)
│
void
Tk_PhotoGetSize(handle, widthPtr, heightPtr)
int
│
Tk_PhotoSetSize(interp. handle, width, height)
│
ARGUMENTS
Tcl_Interp *interp (in) |
Interpreter in which image was created and in which error reporting is to be done. | ||
const char *imageName (in) |
Name of the photo image. | ||
Tk_PhotoHandle handle (in) |
Opaque handle identifying the photo image to be affected. | ||
Tk_PhotoImageBlock *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 Tk_PhotoPutBlock) or the desired image width (for Tk_PhotoExpand and Tk_PhotoSetSize). | ||
int compRule (in) |
Specifies the compositing rule used when combining transparent pixels in a block of data with a photo image. Must be one of TK_PHOTO_COMPOSITE_OVERLAY (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 TK_PHOTO_COMPOSITE_SET (which discards the existing 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 Tk_PhotoPutBlock) or the desired image height (for Tk_PhotoExpand and Tk_PhotoSetSize). | ||
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
Tk_FindPhoto returns an opaque handle that is used to identify a particular photo image to the other procedures. The parameter is the name of the image, that is, the name specified to the image create photo command, or assigned by that command if no name was specified.
Tk_PhotoPutBlock is used to supply blocks of image data to be displayed. 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 outside 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 −width and/or −height 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 Tk_PhotoImageBlock structure, defined as follows:
typedef struct {
unsigned char *pixelPtr;
int width;
int height;
int pitch;
int pixelSize;
int offset[4];
} Tk_PhotoImageBlock;
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 difference between two horizontally adjacent pixels. Often it is 3 or 4, but it can have any value. The pitch field specifies the address difference between two vertically adjacent pixels. The offset array contains the offsets from the address of a pixel to the addresses of the bytes containing the red, green, blue and alpha (transparency) components. 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 Tk_PhotoPutBlock specifies a compositing rule that says what to do with transparent pixels. The value TK_PHOTO_COMPOSITE_OVERLAY says that the previous contents of the photo image should show through, and the value TK_PHOTO_COMPOSITE_SET 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 TK_PHOTO_COMPOSITE_OVERLAY as a compositing rule.
The value given for the width and height parameters to Tk_PhotoPutBlock do not have to correspond to the values specified in block. If they are smaller, Tk_PhotoPutBlock 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 independently in the horizontal and vertical directions.
Tk_PhotoPutBlock normally returns TCL_OK, though if it cannot allocate │ sufficient memory to hold the resulting image, TCL_ERROR is returned │ instead and, if the interp argument is non-NULL, an error message is │ placed in the interpreter’s result.
Tk_PhotoPutZoomedBlock works like Tk_PhotoPutBlock except that the image can be reduced or enlarged for display. The subsampleX and subsampleY parameters allow the size of the image to be reduced by subsampling. Tk_PhotoPutZoomedBlock 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 subsampleY 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 special effects.
Tk_PhotoGetImage can be used to retrieve image data from a photo image. Tk_PhotoGetImage 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. Tk_PhotoGetImage returns 1 for compatibility with the corresponding procedure in the old photo widget.
Tk_PhotoBlank blanks the entire area of the photo image. Blank areas of a photo image are transparent.
Tk_PhotoExpand 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 −width and/or −height configuration options, respectively. If the image data are being supplied in many small blocks, it is more efficient to use Tk_PhotoExpand or Tk_PhotoSetSize at the beginning rather than allowing the image to expand in many small increments as image blocks are supplied.
Tk_PhotoExpand normally returns TCL_OK, though if it cannot allocate │ sufficient memory to hold the resulting image, TCL_ERROR is returned │ instead and, if the interp argument is non-NULL, an error message is │ placed in the interpreter’s result.
Tk_PhotoSetSize specifies the size of the image, as if the user had specified the given width and height values to the −width and −height 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 Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock or Tk_PhotoExpand.
Tk_PhotoSetSize normally returns TCL_OK, though if it cannot allocate │ sufficient memory to hold the resulting image, TCL_ERROR is returned │ instead and, if the interp argument is non-NULL, an error message is │ placed in the interpreter’s result.
Tk_PhotoGetSize returns the dimensions of the image in *widthPtr and *heightPtr.
PORTABILITY
In Tk 8.3 and earlier, Tk_PhotoPutBlock and Tk_PhotoPutZoomedBlock 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 -DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK. Code linked using Stubs against older versions of Tk will continue to work.
In Tk 8.4, Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock, Tk_PhotoExpand and │ Tk_PhotoSetSize did not take an interp argument or return any result │ code. If insufficient memory was available for an image, Tk would │ panic. This behaviour is still supported if you compile your extension │ with the additional flag -DUSE_PANIC_ON_PHOTO_ALLOC_FAILURE. Code │ linked using Stubs against older versions of Tk will continue to work.
CREDITS
The code for the photo image type was developed by Paul Mackerras, based on his earlier photo widget code.
KEYWORDS
photo, image
More Linux Commands
manpages/glColor3i.3gl.html
glColor3i(3gl) - set the current color - Linux manual page
The GL stores both a current single-valued color index and a current four-valued RGBA color. glColor sets a new four-valued RGBA color. glColor has two major va
manpages/logind.conf.5.html
logind.conf(5) Login manager configuration file (Man Page)
This file configures various parameters of the systemd login manager, systemd-logind.service(8). OPTIONS All options are configured in the [Login] section: NAut
manpages/pychecker.1.html
pychecker(1) - program to check python scripts for common mi
This manual page documents briefly the pychecker command. It was written for the Debian GNU/Linux distribution because the original program does not have a manu
manpages/ldap_search_ext.3.html
ldap_search_ext(3) - Perform an LDAP search operation.......
These routines are used to perform LDAP search operations. The ldap_search_ext_s() routine does the search synchronously (i.e., not returning until the operatio
manpages/ber_get_stringb.3.html
ber_get_stringb(3) - OpenLDAP LBER simplified Basic Encoding
These routines provide a subroutine interface to a simplified implementation of the Basic Encoding Rules of ASN.1. The version of BER these routines support is
manpages/glPixelTransferf.3gl.html
glPixelTransferf(3gl) - set pixel transfer modes (Man Page)
glPixelTransfer sets pixel transfer modes that affect the operation of subsequent glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyT
manpages/ldap_parse_extended_result.3.html
ldap_parse_extended_result(3) - Parsing results (Man Page)
These routines are used to extract information from a result message. They will operate on the first result message in a chain of search results (skipping past
manpages/FcPatternBuild.3.html
FcPatternBuild(3) - Create patterns from arguments (ManPage)
Builds a pattern using a list of objects, types and values. Each value to be entered in the pattern is specified with three arguments: 1. Object name, a string
manpages/chat.8.html
chat(8) - Automated conversational script with a modem......
The chat program defines a conversational exchange between the computer and the modem. Its primary purpose is to establish the connection between the Point-to-P
manpages/git-fetch.1.html
git-fetch(1) - Download objects and refs from another reposi
Fetch branches and/or tags (collectively, refs) from one or more other repositories, along with the objects necessary to complete their histories. Remote-tracki
manpages/ctan.3.html
ctan(3) - complex tangent function - Linux manual page......
The complex tangent function is defined as: ctan(z) = csin(z) / ccos(z) VERSIONS These functions first appeared in glibc in version 2.1. CONFORMING TO C99. SEE
manpages/systemd-delta.1.html
systemd-delta(1) Find overridden configuration files........
systemd-delta may be used to identify and compare configuration files that override other configuration files. Files in /etc have highest priority, files in /ru
