home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / x / x11r6-ch / xpm-3.4 / xpm-3 / xpm-3.4c / FAQ < prev    next >
Text File  |  1994-06-06  |  10KB  |  217 lines

  1. /*
  2.  * Copyright (C) 1989-94 GROUPE BULL
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  5.  * of this software and associated documentation files (the "Software"), to
  6.  * deal in the Software without restriction, including without limitation the
  7.  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8.  * sell copies of the Software, and to permit persons to whom the Software is
  9.  * furnished to do so, subject to the following conditions:
  10.  *
  11.  * The above copyright notice and this permission notice shall be included in
  12.  * all copies or substantial portions of the Software.
  13.  *
  14.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17.  * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  18.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20.  *
  21.  * Except as contained in this notice, the name of GROUPE BULL shall not be
  22.  * used in advertising or otherwise to promote the sale, use or other dealings
  23.  * in this Software without prior written authorization from GROUPE BULL.
  24.  */
  25.  
  26.                 The XPM
  27.             Frequently Asked Questions
  28.  
  29. This article contains the answers to some Frequently Asked Questions about the
  30. XPM format and/or library. If you don't find the answer to your problem here,
  31. then you can mail either to lehors@sophia.inria.fr or to the mailing list
  32. xpm-talk@sophia.inria.fr.
  33.  
  34.                                Contents
  35.  
  36. 1. How do I convert my images to or from XPM ?
  37. 2. Why are my XPM files said to be invalid ?
  38. 3. Why does my program core dumps using XPM ?
  39. 4. Why does my program core dumps using XPM with a widget ?
  40. 5. What exactly triggers the creation of a mask when using XPM ?
  41. 6. How should I use the mask ?
  42. 7. Is there a string to pixmap converter somewhere ?
  43. 8. How can I edit XPM icons ?
  44. 9. Is there a colection of icons somewhere ?
  45.  
  46. ----------------------------------------------------------------------
  47. 1. How do I convert my images to or from XPM ?
  48. ----------------------------------------------------------------------
  49.  
  50.   Netpbm is surely the best image conversion package that I know of. It defines
  51.   formats for color, gray and monochrom images and provides a set of filters.
  52.   Thus a GIF image can be converted to XPM with something like:
  53.  
  54.   $ giftoppm youricon.gif | ppmtoxpm > youricon.xpm
  55.  
  56. ----------------------------------------------------------------------
  57. 2. Why are my XPM files said to be invalid ?
  58. ----------------------------------------------------------------------
  59.  
  60.   There are three official versions of the XPM format. The XPM library since
  61.   version 3.3 can read all them but writes out only XPM 3. Also the small
  62.   program called sxpm which is part of the XPM library package can be used to
  63.   automatically translate XPM 1 and 2 files to XPM 3 with a command such as:
  64.  
  65.   $ sxpm -nod yourxpm1or2file -o yourxpm3file
  66.  
  67.   Also, the XPM format defines "None" to be the color name meaning
  68.   "transparent", but IXI used to hack the XPM library in its early days to
  69.   handle transparency as "#Transparent". This makes IXI format not compatible
  70.   with the official XPM format, and so not readable neither by the official XPM
  71.   library nor any of the programs built on top of it.
  72.  
  73.   The only solutions are either to stick on IXI programs which can deal with
  74.   their format or convert your files to the standard XPM format. This can be
  75.   done simply by changing "#Transparent" to "None".
  76.  
  77. ----------------------------------------------------------------------
  78. 3. Why does my program core dumps using XPM ?
  79. ----------------------------------------------------------------------
  80.  
  81.   Be sure the XpmAttributes structure you pass by reference as a valid
  82.   valuemask. You can give NULL instead if you don't want to use an
  83.   XpmAttributes but if you do you MUST initialize its valuemask component to
  84.   some valid value, at least 0, otherwise unpredictable errors can occur.
  85.  
  86.   So instead of doing something like:
  87.  
  88.       XpmAttributes attrib;
  89.  
  90.       XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib);
  91.  
  92.   you should do:
  93.  
  94.       XpmAttributes attrib;
  95.  
  96.       attrib.valuemask = 0;
  97.       XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib);
  98.  
  99. ----------------------------------------------------------------------
  100. 4. Why does my program core dumps using XPM with a widget ?
  101. ----------------------------------------------------------------------
  102.  
  103.   o First the XPM library is Xlib level, so don't pass your widget as a
  104.     Drawable parameter. A Drawable is either a Window or a Pixmap. The widget's
  105.     window can do the job but:
  106.  
  107.   o Then a widget only gets a Window when realized, so passing XtWindow(widget)
  108.     with a not yet realized widget is wrong. Either realize you widget first or
  109.     use another window. Since the Drawable parameter is only used to specify
  110.     the screen to which the pixmap must be created on, most of the time the
  111.     default root window is just fine.
  112.  
  113. ----------------------------------------------------------------------
  114. 5. What exactly triggers the creation of a mask when using XPM ?
  115. ----------------------------------------------------------------------
  116.  
  117.   Basically a mask is created if "None" is used as one of the color of the
  118.   pixmap. Be aware that this is not only true if it is used in the XPM of the
  119.   pixmap since the colors can be overriden at load time. So a mask is created
  120.   if the "None" color is used at load time, coming either from the XPM
  121.   definition or the color overriding.
  122.  
  123. ----------------------------------------------------------------------
  124. 6. How should I use the mask ?
  125. ----------------------------------------------------------------------
  126.  
  127.   There are basically two ways of using the mask:
  128.  
  129.   o Use the mask as a shapemask with the X11 Nonrectangular Saphe Window
  130.     Extension. Typically this is what should be done when the icon is used in a
  131.     desktop.
  132.  
  133.   o Use the mask as a clipmask in the GC you pass to XCopyArea when drawing the
  134.     pixmap. So the "transparent" pixels being not actually drawn will get the
  135.     underlying pixels colors.
  136.  
  137. ----------------------------------------------------------------------
  138. 7. Is there a string to pixmap converter for Motif ?
  139. ----------------------------------------------------------------------
  140.  
  141.   Not yet, but Motif 2.0 will support XPM pixmap as well as XBM bitmaps.
  142.  
  143. ----------------------------------------------------------------------
  144. 8. How can I edit XPM icons ?
  145. ----------------------------------------------------------------------
  146.  
  147.   As listed below several editors either commercial or not are supporting the
  148.   XPM format. However, pixmap is the one I would recommend since it is freely
  149.   available and, being fully dedicated to XPM, it allows to edit all the
  150.   special things, such as the symbolic color names, which makes XPM different
  151.   from all the other image formats. Pixmap can always be found by ftp from
  152.   ftp.x.org (contrib) and avahi.inria.fr (pub/pixmap).
  153.  
  154.                                 XPM Icon Editors
  155.                                 ================
  156.  
  157.   Program         Source/Author           Platforms       SA      XPM     cost
  158.   ----------------------------------------------------------------------------
  159.   pixmap          Lionel Mallet           source          yes      3       NC
  160.      * version 2 soon to be available
  161.      * current version doesn't work on 24-plane displays
  162.  
  163.   pixt            J. Michael Flanery      source          yes      1       NC
  164.      * doesn't work on 24-plane displays
  165.  
  166.   X.desktop       IXI                     DECstation      no       3      N/A
  167.                                         ?
  168.      * current version doesn't work on 24-plane displays
  169.  
  170.   olpixmap        USL                     Sun             ?        ?       ?
  171.                                         SVR4.2, UnixWare
  172.  
  173.   xfedor          Daniel Dardailler       source          yes      3       NC
  174.      * doesn't work on 24-plane displays
  175.      * only uses XLIB
  176.  
  177.   SCOpaint        SCO/Wing Eng            ODT             yes     2.8     N/A
  178.      * included with the ODT package
  179.  
  180.   pme.icn         Icon Project            source          yes      3       NC
  181.      * written in the Icon language
  182.  
  183.   PixEditT        Free Widget Foundation  source          yes      3       NC
  184.      * there is currently no support for editing the colormap
  185.  
  186.   xscribble       ?                       source          yes      ?       NC
  187.      * requires the FWF
  188.  
  189.   vueicon         Hewlett-Packard         HP              yes      3      N/A
  190.      * included with Vue3.0
  191.  
  192.   iconedit V3     SunSoft                 Sparc/Sun3      yes      2      N/A
  193.  
  194.   Pixmap Editor   ICS                     ?               yes      ?       ?
  195.      * this is a Widget, not a complete program
  196.  
  197.   ezX             Sunrise Software        ?               ?        ?      N/A
  198.  
  199.   SA - Stand Alone program
  200.   NC - No Charge (i.e. free); most programs are copyrighted.
  201.   XPM - XPM format supported
  202.   source - built from source code; likely works on all standard X platforms
  203.   N/A - icon editor is normally distributed with other software
  204.  
  205.  
  206.   Send updates, additions, corrections, etc. to 
  207.      dsmith@ann-arbor.applicon.slb.com (or dsmith@aaaca1.sinet.slb.com)
  208.  
  209. ----------------------------------------------------------------------
  210. 9. Is there a collection of icons somewhere ?
  211. ----------------------------------------------------------------------
  212.  
  213.   At least there is one freely available: Anthony's X Icon Library. You can
  214.   found it on several ftp servers. It contains only small icons (less than
  215.   about 100x100 pixels in size) which are stored in groups in a logical
  216.   way. Color icons are stored in XPM format and Black & White icons in XBM.
  217.