image.html
来自「perl教程」· HTML 代码 · 共 188 行
HTML
188 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Tk::Image - Create and manipulate images</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>Tk::Image - Create and manipulate images</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#builtin_image_types">BUILT-IN IMAGE TYPES</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#keywords">KEYWORDS</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Tk::Image - Create and manipulate images</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p><em>$image</em> = <em>$widget</em>-><em>type</em>(?<em>arg arg ...</em>?)</p>
<p><em>$image</em>-><em>method</em>(?<em>arg arg ...</em>?)</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>image</strong> constructors and methods are used to create, delete, and query images.
It can take several different forms, depending on the
<em>type</em>.</p>
<p>The constructors require a <em>$widget</em> to invoke them, this is used
to locate a <strong>MainWindow</strong>. (This is because the underlying Tk code
registers the images in the data structure for the <strong>MainWindow</strong>.)</p>
<p>The legal forms are:</p>
<dl>
<dt><strong><a name="item_type"><em>$widget</em>-><em>type</em>?(?<em>name</em>?,?<em>option</em>=><em>value ...</em>)?</a></strong>
<dd>
<p>Creates a new image and returns an object.
<em>type</em> specifies the type of the image, which must be one of
the types currently defined (e.g., <strong>Bitmap</strong>).
<em>name</em> specifies the name for the image; if it is omitted then
Tk picks a name of the form <strong>image</strong><em>x</em>, where <em>x</em> is
an integer.
There may be any number of <em>option</em>=><em>value</em> pairs,
which provide configuration options for the new image.
The legal set of options is defined separately for each image
type; see below for details on the options for built-in image types.
If an image already exists by the given name then it is replaced
with the new image and any instances of that image will redisplay
with the new contents.</p>
</dd>
</li>
<dt><strong><a name="item_delete"><em>$image</em>-><strong>delete</strong></a></strong>
<dd>
<p>Deletes the image <em>$image</em> and returns an empty string.
If there are instances of the image displayed in widgets,
the image won't actually be deleted until all of the instances
are released.
However, the association between the instances and the image
manager will be dropped.
Existing instances will retain their sizes but redisplay as
empty areas.
If a deleted image is recreated (with the same <em>name</em>)
the existing instances will use the new image.</p>
</dd>
</li>
<dt><strong><a name="item_height"><em>$image</em>-><strong>height</strong></a></strong>
<dd>
<p>Returns a decimal string giving the height of image <em>name</em>
in pixels.</p>
</dd>
</li>
<dt><strong><a name="item_imageinuse"><em>$widget</em>-><strong>imageInuse</strong>( 'name' );</a></strong>
<dd>
<p>Returns a boolean value indicating whether or not the image
given by <em>name</em> is in use by any widgets.</p>
</dd>
</li>
<dt><strong><a name="item_imagenames"><em>$widget</em>-><strong>imageNames</strong></a></strong>
<dd>
<p>Returns a list containing all existing images for <em>$widget</em>'s
<strong>MainWindow</strong>.</p>
</dd>
</li>
<dt><strong><em>$image</em>-><strong>type</strong></strong>
<dd>
<p>Returns the type of <em>$image</em> (the value of the <em>type</em>
method when the image was created).</p>
</dd>
</li>
<dt><strong><a name="item_imagetypes"><em>$widget</em>-><strong>imageTypes</strong></a></strong>
<dd>
<p>Returns a list whose elements are all of the valid image types
(i.e., all of the values that may be supplied for the <em>type</em>
to create an image).</p>
</dd>
</li>
<dt><strong><a name="item_width"><em>$image</em>-><strong>width</strong></a></strong>
<dd>
<p>Returns a decimal string giving the width of image <em>name</em>
in pixels.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="builtin_image_types">BUILT-IN IMAGE TYPES</a></h1>
<p>The following image types are defined by Tk so they will be available
in any Tk application.
Individual applications or extensions may define additional types.</p>
<dl>
<dt><strong><a name="item_bitmap"><strong>Bitmap</strong></a></strong>
<dd>
<p>Each pixel in the image displays a foreground color, a background
color, or nothing.
See <a href="../../lib/Tk/Bitmap.html">the Tk::Bitmap manpage</a> for more information.</p>
</dd>
</li>
<dt><strong><a name="item_pixmap"><strong>Pixmap</strong></a></strong>
<dd>
<p><strong>Pixmap</strong> is slightly more general than <strong>Bitmap</strong>, each pixel can
be any available color or "transparent" (rendered as background color of the
widget image is displayed in). <strong>Pixmap</strong> is best used for icons and other
simple graphics with only a few colors.</p>
</dd>
<dd>
<p><strong>Pixmap</strong> is derived from Tix. See <a href="../../lib/Tk/Pixmap.html">the Tk::Pixmap manpage</a> for more information.</p>
</dd>
</li>
<dt><strong><a name="item_photo"><strong>Photo</strong></a></strong>
<dd>
<p>Displays a variety of full-color images, using dithering to
approximate colors on displays with limited color capabilities.
See <a href="../../lib/Tk/Photo.html">the Tk::Photo manpage</a> documentation for more information.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../lib/Tk/Bitmap.html">Tk::Bitmap</a>
<a href="../../lib/Tk/Pixmap.html">Tk::Pixmap</a>
<a href="../../lib/Tk/Photo.html">Tk::Photo</a></p>
<p>
</p>
<hr />
<h1><a name="keywords">KEYWORDS</a></h1>
<p>height, image, types of images, width</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?