Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 2169

mozart-1.4.0-1mdv2010.0.i586.rpm

<HTML><HEAD><TITLE>Tk Library Procedures - Tk_FindPhoto manual page</TITLE></HEAD><BODY>
<H3><A NAME="M2">NAME</A></H3>
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.
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tk.h&gt;</B><BR>
<B>#include &lt;tkPhoto.h&gt;</B><BR>
Tk_PhotoHandle<BR>
<B>Tk_FindPhoto</B>(<I>interp, imageName</I>)<BR>
void<BR>
<B>Tk_PhotoPutBlock</B>(<I>handle, blockPtr, x, y, width, height</I>)<BR>
void<BR>
<B>Tk_PhotoPutZoomedBlock</B>(<I>handle, blockPtr, x, y, width, height,<BR>
zoomX, zoomY, subsampleX, subsampleY</I>)<BR>
int<BR>
<B>Tk_PhotoGetImage</B>(<I>handle, blockPtr</I>)<BR>
void<BR>
<B>Tk_PhotoBlank</B>(<I>handle</I>)<BR>
void<BR>
<B>Tk_PhotoExpand</B>(<I>handle, width, height</I>)<BR>
void<BR>
<B>Tk_PhotoGetSize</B>(<I>handle, widthPtr, heightPtr</I>)<BR>
void<BR>
<B>Tk_PhotoSetSize</B>(<I>handle, width, height</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL>
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter in which image was created.
<P><DT>char <B>*imageName</B> (in)<DD>
Name of the photo image.
<P><DT>Tk_PhotoHandle <B>handle</B> (in)<DD>
Opaque handle identifying the photo image to be affected.
<P><DT>Tk_PhotoImageBlock <B>*blockPtr</B> (in)<DD>
Specifies the address and storage layout of image data.
<P><DT>int <B>x</B> (in)<DD>
Specifies the X coordinate where the top-left corner of the block is
to be placed within the image.
<P><DT>int <B>y</B> (in)<DD>
Specifies the Y coordinate where the top-left corner of the block is
to be placed within the image.
<P><DT>int <B>width</B> (in)<DD>
Specifies the width of the image area to be affected (for
<B>Tk_PhotoPutBlock</B>) or the desired image width (for
<B>Tk_PhotoExpand</B> and <B>Tk_PhotoSetSize</B>).
<P><DT>int <B>height</B> (in)<DD>
Specifies the height of the image area to be affected (for
<B>Tk_PhotoPutBlock</B>) or the desired image height (for
<B>Tk_PhotoExpand</B> and <B>Tk_PhotoSetSize</B>).
<P><DT>int <B>*widthPtr</B> (out)<DD>
Pointer to location in which to store the image width.
<P><DT>int <B>*heightPtr</B> (out)<DD>
Pointer to location in which to store the image height.
<P><DT>int <B>subsampleX</B> (in)<DD>
Specifies the subsampling factor in the X direction for input
image data.
<P><DT>int <B>subsampleY</B> (in)<DD>
Specifies the subsampling factor in the Y direction for input
image data.
<P><DT>int <B>zoomX</B> (in)<DD>
Specifies the zoom factor to be applied in the X direction to pixels
being written to the photo image.
<P><DT>int <B>zoomY</B> (in)<DD>
Specifies the zoom factor to be applied in the Y direction to pixels
being written to the photo image.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tk_FindPhoto</B> 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 <B>image create
photo</B> command, or assigned by that command if no name was specified.
<P>
<B>Tk_PhotoPutBlock</B> is used to supply blocks of image data to be
displayed.  The call affects an area of the image of size
<I>width</I> x <I>height</I> pixels, with its top-left corner at
coordinates (<I>x</I>,<I>y</I>).  All of <I>width</I>, <I>height</I>,
<I>x</I>, and <I>y</I> 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
<B>-width</B> and/or <B>-height</B> widget configuration options
(see photo(n)); in that
case the area is silently clipped to the image boundaries.
<P>
The <I>block</I> parameter is a pointer to a
<B>Tk_PhotoImageBlock</B> structure, defined as follows:
<PRE>typedef struct {
	unsigned char *<I>pixelPtr</I>;
	int <I>width</I>;
	int <I>height</I>;
	int <I>pitch</I>;
	int <I>pixelSize</I>;
	int <I>offset[3]</I>;
} Tk_PhotoImageBlock;</PRE>
The <I>pixelPtr</I> field points to the first pixel, that is, the
top-left pixel in the block.
The <I>width</I> and <I>height</I> fields specify the dimensions of the
block of pixels.  The <I>pixelSize</I> field specifies the address
difference between two horizontally adjacent pixels.  Often it is 3
or 4, but it can have any value.  The <I>pitch</I> field specifies the
address difference between two vertically adjacent pixels.  The
<I>offset</I> array contains the offsets from the address of a pixel
to the addresses of the bytes containing the red, green and blue
components.  These are normally 0, 1 and 2, but can have other values,
e.g., for images that are stored as separate red, green and blue
planes.
<P>
The value given for the <I>width</I> and <I>height</I> parameters to
<B>Tk_PhotoPutBlock</B> do not have to correspond to the values specified
in <I>block</I>.  If they are smaller, <B>Tk_PhotoPutBlock</B> 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.
<P>
<B>Tk_PhotoPutZoomedBlock</B> works like <B>Tk_PhotoPutBlock</B> except that
the image can be reduced or enlarged for display.  The
<I>subsampleX</I> and <I>subsampleY</I> parameters allow the size of the
image to be reduced by subsampling.
<B>Tk_PhotoPutZoomedBlock</B> will use only pixels from the input image
whose X coordinates are multiples of <I>subsampleX</I>, and whose Y
coordinates are multiples of <I>subsampleY</I>.  For example, an image
of 512x512 pixels can be reduced to 256x256 by setting
<I>subsampleX</I> and <I>subsampleY</I> to 2.
<P>
The <I>zoomX</I> and <I>zoomY</I> parameters allow the image to be
enlarged by pixel replication.  Each pixel of the (possibly subsampled)
input image will be written to a block <I>zoomX</I> pixels wide and
<I>zoomY</I> pixels high of the displayed image.  Subsampling and
zooming can be used together for special effects.
<P>
<B>Tk_PhotoGetImage</B> can be used to retrieve image data from a photo
image.  <B>Tk_PhotoGetImage</B> fills
in the structure pointed to by the <I>blockPtr</I> 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.
<B>Tk_PhotoGetImage</B> returns 1 for compatibility with the
corresponding procedure in the old photo widget.
<P>
<B>Tk_PhotoBlank</B> blanks the entire area of the
photo image.  Blank areas of a photo image are transparent.
<P>
<B>Tk_PhotoExpand</B> requests that the widget's image be expanded to be
at least <I>width</I> x <I>height</I> pixels in size.  The width and/or
height are unchanged if the user has specified an explicit image width
or height with the <B>-width</B> and/or <B>-height</B> configuration
options, respectively.
If the image data
are being supplied in many small blocks, it is more efficient to use
<B>Tk_PhotoExpand</B> or <B>Tk_PhotoSetSize</B> at the beginning rather than
allowing the image to expand in many small increments as image blocks
are supplied.
<P>
<B>Tk_PhotoSetSize</B> specifies the size of the image, as if the user
had specified the given <I>width</I> and <I>height</I> values to the
<B>-width</B> and <B>-height</B> configuration options.  A value of
zero for <I>width</I> or <I>height</I> does not change the image's width
or height, but allows the width or height to be changed by subsequent
calls to <B>Tk_PhotoPutBlock</B>, <B>Tk_PhotoPutZoomedBlock</B> or
<B>Tk_PhotoExpand</B>.
<P>
<B>Tk_PhotoGetSize</B> returns the dimensions of the image in
*<I>widthPtr</I> and *<I>heightPtr</I>.

<H3><A NAME="M6">CREDITS</A></H3>
The code for the photo image type was developed by Paul Mackerras,
based on his earlier photo widget code.

<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/P.htm#photo">photo</A>, <A href="../Keywords/I.htm#image">image</A>
<HR><PRE>
<A HREF="../copyright.htm">Copyright</A> &#169; 1994 The Australian National University
<A HREF="../copyright.htm">Copyright</A> &#169; 1994-1996 Sun Microsystems, Inc.
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>