70 lines
3.2 KiB
Raw Normal View History

1998-04-30 07:04:33 -04:00
<HTML><HEAD><TITLE>STk procedure - make-image manual page</TITLE></HEAD>
1998-04-10 06:59:06 -04:00
<BODY bgcolor = #c3ffc3>
<H2><IMG ALIGN=BOTTOM SRC="./Img/ManPageGreen.gif"> create-image, find-image, change-image, free-image </H2>
<I>an easier way to manipulate Tk images
</I><P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
<H3><A NAME="M2">PACKAGE</A></H3>
<H3><A NAME="M3">SYNOPSIS</A></H3>
1998-04-30 07:04:33 -04:00
(<B>make-image</B> key <I>create image ?options?</I>)<BR>
1998-04-10 06:59:06 -04:00
(<B>find-image</B> key)<BR>
(<B>change-image</B> key <I>create image options</I>)<BR>
(<B>free-image</B> key)<BR>
1998-04-30 07:04:33 -04:00
<B>make-image</B> is a STk procedure which simplifies Tk images
1998-04-10 06:59:06 -04:00
creation by providing a homogeneous way to create an image,
independently of its coding format. The first argument of
1998-04-30 07:04:33 -04:00
<B>make-image</B> is a string which identifies the image; if an image
1998-04-10 06:59:06 -04:00
with this key has been already loaded in memory, it will not be loaded
1998-04-30 07:04:33 -04:00
again and <B>make-image</B> will return it. If no option is given,
1998-04-10 06:59:06 -04:00
the identifying image key is taken as a file name (the file is searched
using the variable <B>*image-path*</B>, which must contain a set of
prefix pathnames to prepend to the given filename).
1998-04-30 07:04:33 -04:00
If options are passed to the <B>make-image</B> procedure they must follow
1998-04-10 06:59:06 -04:00
the convention of the options passed in <B><A HREF=../Help/./image.n.html>image create</A></B> just after the
image format. If the image cannot be created, this procedure returns <B>#f</B>.
Hereafter is a simple usage of this procedure:
<PRE>(require &quot;image&quot;)
(require &quot;pixmap&quot;)
1998-04-30 07:04:33 -04:00
(define img1 (make-image &quot;a pixmap&quot; :file &quot;exit.xpm&quot;))
(define img2 (make-image &quot;a bitmap&quot; :file &quot;default.xbm&quot;))
(define img3 (make-image &quot;a pixmap&quot;))
(define img4 (make-image &quot;x.xpm&quot;))</PRE>
1998-04-10 06:59:06 -04:00
In this case, <I>img3</I> is identical to <I>img1</I> since they use the same key.
<I>Img4</I> is the image associated to the file &quot;x.xpm&quot; found according to
the *image-path* varaiable.
<B>find-image</B> returns the image associated to the given <I>key</I> or
<B>#f</B> if this image has not been loaded yet.
<B>change-image</B> changes the content of an image previously created with
1998-04-30 07:04:33 -04:00
<B>make-image</B>. Options are the identical to <B>make-image</B>
1998-04-10 06:59:06 -04:00
<PRE>(button '.b1 :image img1)
(button '.b2 :image img2)
(button '.b3 :image img1) ; .b3 content is identical to .b1
(pack .b1 .b2 .b3)
(change-image &quot;a pixmap&quot; :file &quot;default.xbm&quot;)</PRE>
After the execution of <B>change-image</B>, both <I>.b1</I> and <I>.b3</I>
graphical contents are changed.
<B>delete-image</B> removes the image with the given key of the cache.
The memory used by this image is returned to the system. See the
discussion about how this image is displayed in <B><A HREF=../Help/./image.n.html>image delete</A></B>.
<H3><A NAME="M5">SEE ALSO</A></H3>
<B><A HREF="./bitmap.n.html">bitmap</A></B>, <B><A HREF="./image.n.html">image</A></B>, <B><A HREF="./jpeg.n.html">jpeg</A></B>, <B><A HREF="./photo.n.html">photo</A></B>, <B><A HREF="./pixmap.n.html">pixmap</A></B>
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif"><P>
<A HREF=./STk-hlp.html><IMG ALIGN=BOTTOM SRC="./Img/RefBookGreen.gif"> Back to the <B>STk</B> main page</A>