Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>8.4 Handling Images</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node44.html#section.tools.menubars">&lt;&lt; Prev</A></TD><TD><A href="node41.html">- Up -</A></TD></TR></TABLE><DIV id="section.tools.images"><H2><A name="section.tools.images">8.4 Handling Images</A></H2><P> A convenient way to create images is given by <CODE>TkTools<SPAN class="keyword">.</SPAN>images</CODE>. It takes a list of URLs as input and returns a record of images, where the fields are atoms derived naturally from the URLs. The type and format of images is handled according to the extension of the URL. </P><P> For example, <A name="label343"></A> </P><DL class="anonymous"><DD class="code"><CODE>U=<SPAN class="string">'http://www.mozart-oz.org/home-1.1.0/doc/wp/'</SPAN>&nbsp;<BR>I={TkTools<SPAN class="keyword">.</SPAN>images&nbsp;[U<SPAN class="keyword">#</SPAN><SPAN class="string">'wp.gif'</SPAN>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U<SPAN class="keyword">#</SPAN><SPAN class="string">'queen.xbm'</SPAN>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U<SPAN class="keyword">#</SPAN><SPAN class="string">'truck-left.ppm'</SPAN>]}</CODE></DD></DL><P> binds <CODE>I</CODE> to a record with features <CODE>wp</CODE>, <CODE>queen</CODE>, and <CODE><SPAN class="string">'truck-left'</SPAN></CODE>, where the fields are the corresponding images. </P><P> First the basename of the URL is computed by taking the last fragment of the URL (that is, 'wp.gif' for example). The extension (the part following the period, 'gif' for example), determines the type and format of the image. The part of the basename that precedes the period yields the feature. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node44.html#section.tools.menubars">&lt;&lt; Prev</A></TD><TD><A href="node41.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>