home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sources / misc / 4169 < prev    next >
Encoding:
Text File  |  1992-12-13  |  57.3 KB  |  1,650 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: cristy@eplrx7.es.duPont.com (John Cristy)
  4. Subject:  v34i030:  imagemagick - X11 image processing and display v2.2, Part02/26
  5. Message-ID: <1992Dec13.202231.7585@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: a4d4fb489fd5de30ba971d79d788ebb1
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. References: <csm-v34i028=imagemagick.141926@sparky.IMD.Sterling.COM>
  11. Date: Sun, 13 Dec 1992 20:22:31 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 1635
  14.  
  15. Submitted-by: cristy@eplrx7.es.duPont.com (John Cristy)
  16. Posting-number: Volume 34, Issue 30
  17. Archive-name: imagemagick/part02
  18. Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
  19.  
  20. #!/bin/sh
  21. # this is Part.02 (part 2 of a multipart archive)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file ImageMagick/colors.c continued
  24. #
  25. if test ! -r _shar_seq_.tmp; then
  26.     echo 'Please unpack part 1 first!'
  27.     exit 1
  28. fi
  29. (read Scheck
  30.  if test "$Scheck" != 2; then
  31.     echo Please unpack part "$Scheck" next!
  32.     exit 1
  33.  else
  34.     exit 0
  35.  fi
  36. ) < _shar_seq_.tmp || exit 1
  37. if test ! -f _shar_wnt_.tmp; then
  38.     echo 'x - still skipping ImageMagick/colors.c'
  39. else
  40. echo 'x - continuing file ImageMagick/colors.c'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/colors.c' &&
  42. %                           Software Design                                   %
  43. %                             John Cristy                                     %
  44. %                              July 1992                                      %
  45. %                                                                             %
  46. %                                                                             %
  47. %  Copyright 1992 E. I. du Pont de Nemours & Company                          %
  48. %                                                                             %
  49. %  Permission to use, copy, modify, distribute, and sell this software and    %
  50. %  its documentation for any purpose is hereby granted without fee,           %
  51. %  provided that the above Copyright notice appear in all copies and that     %
  52. %  both that Copyright notice and this permission notice appear in            %
  53. %  supporting documentation, and that the name of E. I. du Pont de Nemours    %
  54. %  & Company not be used in advertising or publicity pertaining to            %
  55. %  distribution of the software without specific, written prior               %
  56. %  permission.  E. I. du Pont de Nemours & Company makes no representations   %
  57. %  about the suitability of this software for any purpose.  It is provided    %
  58. %  "as is" without express or implied warranty.                               %
  59. %                                                                             %
  60. %  E. I. du Pont de Nemours & Company disclaims all warranties with regard    %
  61. %  to this software, including all implied warranties of merchantability      %
  62. %  and fitness, in no event shall E. I. du Pont de Nemours & Company be       %
  63. %  liable for any special, indirect or consequential damages or any           %
  64. %  damages whatsoever resulting from loss of use, data or profits, whether    %
  65. %  in an action of contract, negligence or other tortious action, arising     %
  66. %  out of or in connection with the use or performance of this software.      %
  67. %                                                                             %
  68. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  69. %
  70. %
  71. %
  72. */
  73. X
  74. /*
  75. X  Include declarations.
  76. */
  77. #include "display.h"
  78. #include "image.h"
  79. /*
  80. X  Define declarations.
  81. */
  82. #define MaxTreeDepth  8  /* Log2(MaxRGB) */
  83. #define NodesInAList  2048
  84. X
  85. /*
  86. X  Structures.
  87. */
  88. typedef struct _Node
  89. {
  90. X  struct _Node
  91. X    *child[8];
  92. X
  93. X  unsigned char
  94. X    mid_red,
  95. X    mid_green,
  96. X    mid_blue;
  97. } Node;
  98. X
  99. typedef struct _Nodes
  100. {
  101. X  Node
  102. X    nodes[NodesInAList];
  103. X
  104. X  struct _Nodes
  105. X    *next;
  106. } Nodes;
  107. X
  108. typedef struct _Cube
  109. {
  110. X  Node
  111. X    *root,
  112. X    *leaf;
  113. X
  114. X  unsigned int
  115. X    colors;
  116. X
  117. X  unsigned int
  118. X    free_nodes;
  119. X
  120. X  Node
  121. X    *node;
  122. X
  123. X  Nodes
  124. X    *node_list;
  125. } Cube;
  126. X
  127. /*
  128. X  Global variables.
  129. */
  130. static Cube
  131. X  cube;
  132. X
  133. /*
  134. X  External declarations.
  135. */
  136. extern char
  137. X  *application_name;
  138. X
  139. /*
  140. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  141. %                                                                             %
  142. %                                                                             %
  143. %                                                                             %
  144. %  I n i t i a l i z e N o d e                                                %
  145. %                                                                             %
  146. %                                                                             %
  147. %                                                                             %
  148. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  149. %
  150. %  Function InitializeNode allocates memory for a new node in the color cube
  151. %  tree and presets all fields to zero.
  152. %
  153. %  The format of the InitializeNode routine is:
  154. %
  155. %      node=InitializeNode(mid_red,mid_green,mid_blue)
  156. %
  157. %  A description of each parameter follows.
  158. %
  159. %    o mid_red: Specifies the mid point of the red axis for this node.
  160. %
  161. %    o mid_green: Specifies the mid point of the green axis for this node.
  162. %
  163. %    o mid_blue: Specifies the mid point of the blue axis for this node.
  164. %
  165. %
  166. */
  167. static Node *InitializeNode(mid_red,mid_green,mid_blue)
  168. register unsigned char
  169. X  mid_red,
  170. X  mid_green,
  171. X  mid_blue;
  172. {
  173. X  register int
  174. X    i;
  175. X
  176. X  register Node
  177. X    *node;
  178. X
  179. X  if (cube.free_nodes == 0)
  180. X    {
  181. X      register Nodes
  182. X        *nodes;
  183. X
  184. X      /*
  185. X        Allocate a new nodes of nodes.
  186. X      */
  187. X      nodes=(Nodes *) malloc(sizeof(Nodes));
  188. X      if (nodes == (Nodes *) NULL)
  189. X        return((Node *) NULL);
  190. X      nodes->next=cube.node_list;
  191. X      cube.node_list=nodes;
  192. X      cube.node=nodes->nodes;
  193. X      cube.free_nodes=NodesInAList;
  194. X    }
  195. X  cube.free_nodes--;
  196. X  node=cube.node++;
  197. X  for (i=0; i < 8; i++)
  198. X    node->child[i]=(Node *) NULL;
  199. X  node->mid_red=mid_red;
  200. X  node->mid_green=mid_green;
  201. X  node->mid_blue=mid_blue;
  202. X  return(node);
  203. }
  204. X
  205. /*
  206. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  207. %                                                                             %
  208. %                                                                             %
  209. %                                                                             %
  210. %  N u m b e r C o l o r s                                                    %
  211. %                                                                             %
  212. %                                                                             %
  213. %                                                                             %
  214. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  215. %
  216. %  Function NumberColors returns the number of unique colors in an image.
  217. %
  218. %  The format of the NumberColors routine is:
  219. %
  220. %      number_colors=NumberColors(image)
  221. %
  222. %  A description of each parameter follows.
  223. %
  224. %    o image: The address of a byte (8 bits) array of run-length
  225. %      encoded pixel data of your source image.  The sum of the
  226. %      run-length counts in the source image must be equal to or exceed
  227. %      the number of pixels.
  228. %
  229. %
  230. */
  231. unsigned int NumberColors(image)
  232. Image
  233. X  *image;
  234. {
  235. X  Nodes
  236. X    *nodes;
  237. X
  238. X  register RunlengthPacket
  239. X    *p;
  240. X
  241. X  register int
  242. X    i;
  243. X
  244. X  register Node
  245. X    *node;
  246. X
  247. X  register unsigned char
  248. X    bisect,
  249. X    id;
  250. X
  251. X  register unsigned int
  252. X    level;
  253. X
  254. X  /*
  255. X    Initialize color description tree.
  256. X  */
  257. X  cube.node_list=(Nodes *) NULL;
  258. X  cube.colors=0;
  259. X  cube.free_nodes=0;
  260. X  cube.root=InitializeNode(MaxRGB >> 1,MaxRGB >> 1,MaxRGB >> 1);
  261. X  cube.leaf=InitializeNode(0,0,0);
  262. X  if ((cube.root == (Node *) NULL) || (cube.leaf == (Node *) NULL))
  263. X    {
  264. X      Warning("unable to count colors","memory allocation failed");
  265. X      return(0);
  266. X    }
  267. X  p=image->pixels;
  268. X  for (i=0; i < image->packets; i++)
  269. X  {
  270. X    /*
  271. X      Start at the root and proceed level by level.
  272. X    */
  273. X    node=cube.root;
  274. X    for (level=1; level < MaxTreeDepth; level++)
  275. X    {
  276. X      id=(p->red >= node->mid_red ? 1 : 0) |
  277. X        (p->green >= node->mid_green ? 1 : 0) << 1 |
  278. X        (p->blue >= node->mid_blue ? 1 : 0) << 2;
  279. X      if (node->child[id] == (Node *) NULL)
  280. X        {
  281. X          bisect=(unsigned int) (1 << (MaxTreeDepth-level)) >> 1;
  282. X          node->child[id]=InitializeNode(
  283. X            node->mid_red+(id & 1 ? bisect : -bisect),
  284. X            node->mid_green+(id & 2 ? bisect : -bisect),
  285. X            node->mid_blue+(id & 4 ? bisect : -bisect));
  286. X          if (node->child[id] == (Node *) NULL)
  287. X            {
  288. X              Warning("unable to count colors","memory allocation failed");
  289. X              return(0);
  290. X            }
  291. X        }
  292. X      node=node->child[id];
  293. X    }
  294. X    id=(p->red >= node->mid_red ? 1 : 0) |
  295. X      (p->green >= node->mid_green ? 1 : 0) << 1 |
  296. X      (p->blue >= node->mid_blue ? 1 : 0) << 2;
  297. X    if (node->child[id] == (Node *) NULL)
  298. X      {
  299. X        node->child[id]=cube.leaf;
  300. X        cube.colors++;
  301. X      }
  302. X    p++;
  303. X  }
  304. X  /*
  305. X    Release color cube tree storage.
  306. X  */
  307. X  do
  308. X  {
  309. X    nodes=cube.node_list->next;
  310. X    (void) free((char *) cube.node_list);
  311. X    cube.node_list=nodes;
  312. X  }
  313. X  while (cube.node_list != (Nodes *) NULL);
  314. X  return(cube.colors);
  315. }
  316. SHAR_EOF
  317. echo 'File ImageMagick/colors.c is complete' &&
  318. chmod 0644 ImageMagick/colors.c ||
  319. echo 'restore of ImageMagick/colors.c failed'
  320. Wc_c="`wc -c < 'ImageMagick/colors.c'`"
  321. test 9232 -eq "$Wc_c" ||
  322.     echo 'ImageMagick/colors.c: original size 9232, current size' "$Wc_c"
  323. rm -f _shar_wnt_.tmp
  324. fi
  325. # ============= ImageMagick/Make.com ==============
  326. if test -f 'ImageMagick/Make.com' -a X"$1" != X"-c"; then
  327.     echo 'x - skipping ImageMagick/Make.com (File already exists)'
  328.     rm -f _shar_wnt_.tmp
  329. else
  330. > _shar_wnt_.tmp
  331. echo 'x - extracting ImageMagick/Make.com (Text)'
  332. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Make.com' &&
  333. $!
  334. $! Make ImageMagick X image utilities for VMS.
  335. $!
  336. $
  337. $define/nolog X11 decw$include:
  338. $define/nolog sys sys$library:
  339. $link_options="/nodebug/notraceback"
  340. $define/nolog lnk$library sys$library:vaxcrtl
  341. $
  342. $if ((p1.nes."").and.(p1.nes."display")) then goto SkipDisplay
  343. $write sys$output "Making Display..."
  344. $call Make display
  345. $call Make X
  346. $call Make image
  347. $call Make rotate
  348. $call Make quantize
  349. $call Make colors
  350. $call Make signature
  351. $call Make compress
  352. $call Make alien
  353. $call Make PreRvIcccm
  354. $
  355. $link'link_options' display,X,image,rotate,quantize,colors,signature, -
  356. X  compress,alien,PreRvIcccm,sys$input:/opt
  357. sys$share:decw$xlibshr.exe/share
  358. $
  359. $display:==$'f$environment("default")'display
  360. $write sys$output "..symbol DISPLAY defined."
  361. $
  362. $SkipDisplay:
  363. $if ((p1.nes."").and.(p1.nes."import")) then goto SkipImport
  364. $write sys$output "Making Import..."
  365. $call Make import
  366. $call Make X
  367. $call Make image
  368. $call Make rotate
  369. $call Make quantize
  370. $call Make colors
  371. $call Make signature
  372. $call Make compress
  373. $call Make alien
  374. $call Make PreRvIcccm
  375. $
  376. $link'link_options' import,X,image,rotate,quantize,colors,signature,compress, -
  377. X  alien,PreRvIcccm,sys$input:/opt
  378. sys$share:decw$xlibshr.exe/share
  379. $
  380. $import:==$'f$environment("default")'import
  381. $write sys$output "..symbol IMPORT defined."
  382. $SkipImport:
  383. $
  384. $if ((p1.nes."").and.(p1.nes."XtoPS")) then goto SkipXtoPS
  385. $write sys$output "Making XtoPS..."
  386. $call Make XtoPS
  387. $call Make X
  388. $call Make image
  389. $call Make rotate
  390. $call Make quantize
  391. $call Make colors
  392. $call Make signature
  393. $call Make compress
  394. $call Make PreRvIcccm
  395. $
  396. $link'link_options' XtoPS,X,image,rotate,quantize,colors,signature,compress, -
  397. X  alien,PreRvIcccm,sys$input:/opt
  398. sys$share:decw$xlibshr.exe/share
  399. $
  400. $XtoPS:== $'f$environment("default")'XtoPS
  401. $write sys$output "..symbol XTOPS defined."
  402. $
  403. $SkipXtoPS:
  404. $if ((p1.nes."").and.(p1.nes."animate")) then goto SkipAnimate
  405. $write sys$output "Making Animate..."
  406. $call Make animate
  407. $call Make X
  408. $call Make image
  409. $call Make rotate
  410. $call Make quantize
  411. $call Make colors
  412. $call Make signature
  413. $call Make compress
  414. $call Make alien
  415. $call Make PreRvIcccm
  416. $
  417. $link'link_options' animate,X,image,rotate,quantize,colors,signature, -
  418. X  compress,alien,PreRvIcccm,sys$input:/opt
  419. sys$share:decw$xlibshr.exe/share
  420. $
  421. $animate:==$'f$environment("default")'animate
  422. $write sys$output "..symbol ANIMATE defined."
  423. $
  424. $SkipAnimate:
  425. $if ((p1.nes."").and.(p1.nes."montage")) then goto SkipMontage
  426. $write sys$output "Making Montage..."
  427. $call Make montage
  428. $call Make X
  429. $call Make image
  430. $call Make rotate
  431. $call Make quantize
  432. $call Make colors
  433. $call Make compress
  434. $call Make alien
  435. $call Make PreRvIcccm
  436. $
  437. $link'link_options' montage,X,image,rotate,quantize,colors,signature, -
  438. X  compress,alien,PreRvIcccm,sys$input:/opt
  439. sys$share:decw$xlibshr.exe/share
  440. $
  441. $montage:==$'f$environment("default")'montage
  442. $write sys$output "..symbol MONTAGE defined."
  443. $
  444. $SkipMontage:
  445. $type sys$input
  446. X
  447. Use this command to specify which X server to contact:
  448. X
  449. X  $set display/create/node=node_name::
  450. X
  451. This can be done automatically from your LOGIN.COM with the following 
  452. command:
  453. X
  454. X  $if (f$trnlmn("sys$rem_node").nes."") then -
  455. X  $  set display/create/node='f$trnlmn("sys$rem_node")'
  456. $write sys$output "Making in [.utilities]"
  457. $set default [.utilities]
  458. $@make
  459. $exit
  460. $
  461. $Make: subroutine
  462. $!
  463. $! A very primitive "make" (or MMS) hack for DCL.
  464. $!
  465. $if (p1.eqs."") then exit
  466. $source_file=f$search(f$parse(p1,".c"))
  467. $if (source_file.nes."")
  468. $  then
  469. $    object_file=f$parse(source_file,,,"name")+".obj"
  470. $    object_file=f$search( object_file )
  471. $    if (object_file.nes."") 
  472. $      then
  473. $        object_time=f$file_attribute(object_file,"cdt")
  474. $        source_time=f$file_attribute(source_file,"cdt")
  475. $        if (f$cvtime(object_time).lts.f$cvtime(source_time)) then -
  476. $          object_file=""
  477. $      endif
  478. $    if (object_file.eqs."") 
  479. $      then
  480. $        write sys$output "Compiling ",p1
  481. $        cc/nodebug/optimize 'source_file'
  482. $      endif
  483. $  endif
  484. $exit
  485. $endsubroutine
  486. SHAR_EOF
  487. chmod 0644 ImageMagick/Make.com ||
  488. echo 'restore of ImageMagick/Make.com failed'
  489. Wc_c="`wc -c < 'ImageMagick/Make.com'`"
  490. test 3952 -eq "$Wc_c" ||
  491.     echo 'ImageMagick/Make.com: original size 3952, current size' "$Wc_c"
  492. rm -f _shar_wnt_.tmp
  493. fi
  494. # ============= ImageMagick/display.h ==============
  495. if test -f 'ImageMagick/display.h' -a X"$1" != X"-c"; then
  496.     echo 'x - skipping ImageMagick/display.h (File already exists)'
  497.     rm -f _shar_wnt_.tmp
  498. else
  499. > _shar_wnt_.tmp
  500. echo 'x - extracting ImageMagick/display.h (Text)'
  501. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.h' &&
  502. /*
  503. X  Include declarations
  504. */
  505. #include <stdio.h>
  506. #if defined(__STDC__) || defined(sgi) || defined(AIXV3)
  507. #include <stdlib.h>
  508. #include <unistd.h>
  509. #else
  510. #ifndef vms
  511. #include <malloc.h>
  512. #include <memory.h>
  513. #endif
  514. #endif
  515. #include <ctype.h>
  516. #include <string.h>
  517. #include <math.h>
  518. #undef index
  519. X
  520. /*
  521. X  Define declarations for the Display program.
  522. */
  523. #if __STDC__ || defined(sgi) || defined(AIXV3)
  524. #define _Declare(formal_parameters) formal_parameters
  525. #else
  526. #define const 
  527. #define _Declare(formal_parameters) ()
  528. #endif
  529. #define DownShift(x) ((int) ((x)+(1L << 15)) >> 16)
  530. #define False  0
  531. #define Max(x,y)  (((x) > (y)) ? (x) : (y))
  532. #define Min(x,y)  (((x) < (y)) ? (x) : (y))
  533. #define MinInfoSize (1 << 18)
  534. #define True  1
  535. #define UpShift(x) ((x) << 16)
  536. #define UpShifted(x) ((int) ((x)*(1L << 16)+0.5))
  537. #define Warning(message,qualifier)  \
  538. {  \
  539. X  (void) fprintf(stderr,"%s: %s",application_name,message);  \
  540. X  if (qualifier != (char *) NULL)  \
  541. X    (void) fprintf(stderr," (%s)",qualifier);  \
  542. X  (void) fprintf(stderr,".\n");  \
  543. }
  544. #ifdef vms
  545. #define pclose(file)  exit(1)
  546. #define popen(command,mode)  exit(1)
  547. #define unlink(file)  remove(file)
  548. #endif
  549. X
  550. /*
  551. X  Variable declarations.
  552. */
  553. #ifndef lint
  554. static char 
  555. X  Version[]="@(#)ImageMagick 2.2 92/12/10 cristy@dupont.com";
  556. #endif
  557. SHAR_EOF
  558. chmod 0644 ImageMagick/display.h ||
  559. echo 'restore of ImageMagick/display.h failed'
  560. Wc_c="`wc -c < 'ImageMagick/display.h'`"
  561. test 1270 -eq "$Wc_c" ||
  562.     echo 'ImageMagick/display.h: original size 1270, current size' "$Wc_c"
  563. rm -f _shar_wnt_.tmp
  564. fi
  565. # ============= ImageMagick/display.man ==============
  566. if test -f 'ImageMagick/display.man' -a X"$1" != X"-c"; then
  567.     echo 'x - skipping ImageMagick/display.man (File already exists)'
  568.     rm -f _shar_wnt_.tmp
  569. else
  570. > _shar_wnt_.tmp
  571. echo 'x - extracting ImageMagick/display.man (Text)'
  572. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.man' &&
  573. .ad l
  574. .nh
  575. .TH DISPLAY 1 "10 October 1992" "ImageMagick"
  576. .SH NAME
  577. display - display an image on any workstation running X
  578. .SH SYNOPSIS
  579. .B "display" [ \fIoptions\fP ...] \fIfile\fP
  580. [ [ \fIoptions\fP ...] \fIfile\fP ...]
  581. .SH DESCRIPTION
  582. \fIDisplay\fP is a machine architecture independent image processing
  583. and display program.  It can display an image on any workstation
  584. display running an X server.  \fIDisplay\fP first determines the
  585. hardware capabilities of the workstation.  If the number of unique
  586. colors in the image is less than or equal to the number the workstation
  587. can support, the image is displayed in an X window.  Otherwise the
  588. number of colors in the image is first reduced to match the color
  589. resolution of the workstation before it is displayed.
  590. .PP
  591. This means that a continuous-tone 24 bits-per-pixel image can display on a
  592. 8 bit pseudo-color device or monochrome device.  In most instances the
  593. reduced color image closely resembles the original.  Alternatively, a
  594. monochrome or pseudo-color image can display on a continuous-tone 24
  595. bits-per-pixel device.
  596. .SH EXAMPLES
  597. To scale an image of a cockatoo to exactly 640 pixels in width and 480
  598. pixels in height and position the window at location (200,200), use:
  599. .PP
  600. X     display -geometry 640x480\+200\+200 cockatoo.miff
  601. .PP
  602. To display an image of a cockatoo without a border centered on a
  603. backdrop, use:
  604. .PP
  605. X     display +borderwidth -backdrop cockatoo.miff
  606. .PP
  607. To tile an image of a cockatoo onto the root window, use:
  608. .PP
  609. X     display -window root cockatoo.miff
  610. .SH OPTIONS
  611. .TP 5
  612. .B "-backdrop"
  613. display the image centered on a backdrop.
  614. X
  615. This backdrop covers the entire workstation screen and is useful for
  616. hiding other X window activity while viewing the image.   The color of
  617. the backdrop is specified as the background color.  Refer to \fBX
  618. RESOURCES\fP for details.
  619. .TP 5
  620. .B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  621. preferred size and location of the clipped image.  See \fBX(1)\fP for details
  622. about the geometry specification.
  623. X
  624. Use clipping to apply image processing options to, or display, a
  625. particular area of an image.
  626. X
  627. The equivalent X resource for this option is \fBclipGeometry\fP
  628. (class \fBClipGeometry\fP).  See \fBX RESOURCES\fP for details.
  629. .TP 5
  630. .B "-colormap \fItype\fP"
  631. the type of colormap: \fIShared\fP or \fIPrivate\fP.
  632. X
  633. This option only applies when the default X server visual is
  634. \fIPseudoColor\fP or \fIGrayScale\fP.  Refer to \fB-visual\fP for more
  635. details.  By default, a shared colormap is allocated.  The image shares
  636. colors with other X clients.  Some image colors could be approximated,
  637. therefore your image may look very different than intended.  Choose
  638. \fIPrivate\fP and the image colors appear exactly as they are
  639. defined.  However, other clients may go "technicolor" when the image
  640. colormap is installed.
  641. .TP 5
  642. .B "-colors \fIvalue\fP"
  643. preferred number of colors in the image.
  644. X
  645. The actual number of colors in the image may be less than your request,
  646. but never more.  Note, this is a color reduction option.  Images with
  647. less unique colors than specified with this option will remain unchanged.
  648. Refer to \fBQuantize(9)\fP for more details.
  649. X
  650. Note, options \fB-dither\fP, \fB-colorspace\fP, and \fB-treedepth\fP affect
  651. the color reduction algorithm.
  652. .TP 5
  653. .B "-colorspace \fIvalue\fP"
  654. the type of colorspace: \fIGRAY\fP, \fIRGB\fP, \fIXYZ\fP, \fIYIQ\fP, or
  655. \fIYUV\fP.
  656. X
  657. Color reduction, by default, takes place in the RGB color space.
  658. Empirical evidence suggests that distances in color spaces such as YUV
  659. or YIQ correspond to perceptual color differences more closely
  660. than do distances in RGB space.  These color spaces may give better
  661. results when color reducing an image.  Refer to \fBQuantize(9)\fP for
  662. more details.
  663. X
  664. The \fB-colors\fP or \fB-monochrome\fP option is required for this option
  665. to take effect.
  666. .TP 5
  667. .B "-compress \fItype\fP"
  668. the type of image compression: \fIQEncoded\fP or \fIRunlengthEncoded\fP.
  669. X
  670. Use this option with \fB-write\fP to specify the the type of image
  671. compression.  See \fBMIFF(5)\fP for details.
  672. X
  673. Specify \fB\+compress\fP to store the binary image in an uncompressed format.
  674. The default is the compression type of the specified image file.
  675. .TP 5
  676. .B "-delay \fIseconds\fP"
  677. display the next image after pausing.
  678. X
  679. This option is useful when viewing several images in sequence.  Each
  680. image will display and wait the number of seconds specified before the
  681. next image is displayed.  The default is to display the image
  682. and wait until you choose to display the next image or terminate the
  683. program.
  684. .TP 5
  685. .B "-density \fI<width>x<height>
  686. vertical and horizonal density of the image.
  687. X
  688. This option specifies an image density whose interpretation changes
  689. with the type of image.  The default is 72 dots per inch in the
  690. horizonal and vertical direction for Postscript.  Text files default to
  691. 80 characters in width and 60 lines in height.  Use this option to
  692. alter the default density.
  693. .TP 5
  694. .B "-display \fIhost:display[.screen]\fP"
  695. specifies the X server to contact; see \fBX(1)\fP.
  696. .TP 5
  697. .B "-dither"
  698. apply Floyd/Steinberg error diffusion to the image.
  699. X
  700. The basic strategy of dithering is to trade intensity resolution for
  701. spatial resolution by averaging the intensities of several neighboring
  702. pixels.  Images which suffer from severe contouring when reducing colors
  703. can be improved with this option.
  704. X
  705. The \fB-colors\fP or \fB-monochrome\fP option is required
  706. for this option to take effect.
  707. .TP 5
  708. .B "-enhance"
  709. apply a digital filter to enhance a noisy image.
  710. .TP 5
  711. .B "-gamma \fIvalue\fP"
  712. level of gamma correction.
  713. X
  714. The same color image displayed on two different workstations may look
  715. different due to differences in the display monitor.  Use gamma
  716. correction to adjust for this color difference.  Reasonable values
  717. extend from 0.8 to 2.3.
  718. .TP 5
  719. .B "-geometry \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
  720. preferred size and location of the image window.  See \fBX(1)\fP for details
  721. about the geometry specification.  By default, the window size is the image
  722. size and the location is choosen by you when it is mapped.
  723. X
  724. If the specified image size is smaller than the actual image size, the
  725. image is first reduced to an integral of the specified image size with
  726. an antialias digital filter.  The image is then scaled to the exact
  727. specified image size with pixel replication.  If the specified image
  728. size is greater than the actual image size, the image is first enlarged
  729. to an integral of the specified image size with bilinear
  730. interpolation.  The image is then scaled to the exact specified image
  731. size with pixel replication.
  732. X
  733. When displaying an image on an X server, \fI<x offset>\fP and
  734. \fI<y offset>\fP is relative to the root window.  When printing an image,
  735. \fI<x offset>\fP and \fI<y offset>\fP is relative to a Postscript
  736. page.  See \fB-print\fP for more details.
  737. X
  738. The equivalent X resource for this option is \fBimageGeometry\fP
  739. (class \fBImageGeometry\fP).  See \fBX RESOURCES\fP for details.
  740. .TP 5
  741. .B "-inverse"
  742. apply color inversion to image.
  743. X
  744. The red, green, and blue intensities of an image are negated.
  745. .TP 5
  746. .B "-map \fItype\fP"
  747. display image using this Standard Colormap type.
  748. X
  749. Choose from these Standard Colormap types:
  750. X
  751. X    default
  752. X    best
  753. X    red
  754. X    green
  755. X    blue
  756. X    gray
  757. X
  758. The X server must support the Standard Colormap you choose, otherwise an
  759. error occurs.  See \fBxstdcmap(1)\fP for one way of creating Standard
  760. Colormaps.
  761. .TP 5
  762. .B "-monochrome"
  763. transform the image to black and white.
  764. X
  765. Monochrome images can benefit from error diffusion.  Use \fB-dither\fP with
  766. this option to diffuse the error.
  767. .TP 5
  768. .B "-noise"
  769. reduce the noise in an image with a noise peak elimination filter.
  770. X
  771. The principal function of noise peak elimination filter is to smooth
  772. the objects within an image without losing edge information and without
  773. creating undesired structures.  The central idea of the algorithm is to
  774. replace a pixel with its next neighbor in value within a 3 x 3 window,
  775. if this pixel has been found to be noise.  A pixel is defined as noise
  776. if and only if this pixel is a maximum or minimum within the 3 x 3 window.
  777. .TP 5
  778. .B "-normalize"
  779. tranform image to span the full range of color values.  This is a contrast
  780. enhancement technique.
  781. .TP 5
  782. .B "-print \fIfile\fP"
  783. write image as encapsulated Postscript to a file.
  784. X
  785. If \fIfile\fP already exists, you will be prompted as to whether
  786. it should be overwritten.
  787. X
  788. By default, the image is scaled and centered to fit on an 612x792 point
  789. Postscript page.  To specify a specific image size or a particular location on
  790. the Postscript page, use \fB-geometry\fP.
  791. X
  792. By default the image is output in portrait mode.  Use \fB-rotate 90\fP to
  793. display the image in landscape mode.
  794. X
  795. You can view \fIfile\fP with any Postscript compatible viewer or
  796. printer.  The image is displayed as color on viewers and printers that
  797. support color Postscript, otherwise it is displayed as grayscale.
  798. X
  799. The equivalent X resource for this option is \fBprintFilename\fP
  800. (class \fBPrintFilename\fP).  See \fBX RESOURCES\fP for details.
  801. .TP 5
  802. .B "-reflect"
  803. create a "mirror image" by reflecting the image scanlines.
  804. .TP 5
  805. .B "-rotate \fIdegrees\fP"
  806. apply Paeth image rotation to the image.
  807. .TP 5
  808. .B "-scale \fI<width factor>x<height factor>\fP"
  809. preferred size factors of the image.
  810. X
  811. This option behaves like \fB-geometry\fP except the width and height values
  812. are relative instead of absolute.  The image size is multiplied by the
  813. width and height factors to obtain the final image dimensions.  If only
  814. one factor is specified, both the width and height factors assume the
  815. value.
  816. X
  817. Factors may be fractional.  For example, a factor of 1.5 will increase the
  818. image size by one and one-half.
  819. X
  820. The equivalent X resource for this option is \fBscaleGeometry\fP
  821. (class \fBScaleGeometry\fP).  See \fBX RESOURCES\fP for details.
  822. .TP 5
  823. .B "-scene \fIvalue\fP"
  824. image scene number.
  825. .TP 5
  826. .B "-treedepth \fIvalue\fP"
  827. Normally, this integer value is zero or one.  A zero or one tells
  828. \fIdisplay\fP to choose a optimal tree depth for the color reduction
  829. algorithm.
  830. X
  831. An optimal depth generally allows the best representation of the source
  832. image with the fastest computational speed and the least amount of
  833. memory.  However, the default depth is inappropriate for some images.
  834. To assure the best representation, try values between 2 and 8 for this
  835. parameter.  Refer to \fBQuantize(9)\fP for more details.
  836. X
  837. The \fB-colors\fP or \fB-monochrome\fP option is required
  838. for this option to take effect.
  839. .TP 5
  840. .B -verbose
  841. print detailed information about the image.
  842. X
  843. This information is printed: image scene number;  image name;  image
  844. size; the image class (\fIDirectClass\fP or \fIPseudoClass\fP);  the total
  845. number of unique colors;  and the number of seconds to read and
  846. transform the image.  Refer to \fBMIFF(5)\fP for a description of
  847. the image class.
  848. X
  849. If \fB-colors\fP is also specified, the total unique colors in the image
  850. and color reduction error values are printed.  Refer to \fBQuantize(9)\fP
  851. for a description of these values.
  852. .TP 5
  853. .B "-visual \fItype\fP"
  854. display image using this visual type.
  855. X
  856. Choose from these visual classes:
  857. X
  858. X    StaticGray
  859. X    GrayScale
  860. X    StaticColor
  861. X    PseudoColor
  862. X    TrueColor
  863. X    DirectColor
  864. X    default
  865. X    \fIvisual id\fP
  866. X
  867. The X server must support the visual you choose, otherwise an error occurs.
  868. If a visual is not specified, the visual class that can display the most
  869. simultaneous colors on the default X server screen is choosen.
  870. .TP 5
  871. .B "-window \fIid\fP"
  872. set the background pixmap of this window to the image.
  873. X
  874. \fIid\fP can be a window id or name.  Specify \fBroot\fP to select X's root
  875. window as the target window.
  876. X
  877. By default the image is tiled onto the background of the target
  878. window.   If \fB-backdrop\fP or \fB-geometry\fP are specified, the
  879. image is surrounded by the background color.  Refer to \fBX
  880. RESOURCES\fP for details.
  881. X
  882. The image will not display on the root window if the image has more
  883. unique colors than the target window colormap allows.  Use
  884. \fB-colors\fP to reduce the number of colors.
  885. .TP 5
  886. .B "-write \fIfile\fP"
  887. write image to a file.
  888. X
  889. If \fIfile\fP already exists, you will be prompted as to whether
  890. it should be overwritten.
  891. X
  892. By default, the image is stored in the MIFF image format.  If the number of
  893. unique colors in the image exceed 65535, it is stored as \fIDirectClass\fP;
  894. otherwise, it is stored as \fIPseudoClass\fP format.  Refer to \fBMIFF(5)\fP
  895. for more details.
  896. X
  897. By default, the image is written in the format that it was read in as.
  898. To specify a particular image format, prefix \fIfile\fP with the image
  899. type and a colon (i.e. mtv:image) or specify the image type as the
  900. filename suffix (i.e. image.mtv).  See \fBconvert(1)\fP for a list of
  901. valid image formats.  If \fIfile\fP has the extension \fB.Z\fP, the
  902. file size is reduced using Lempel-Ziv coding with \fBcompress\fP.  If
  903. \fIfile\fP already exists, you will be prompted as to whether it should
  904. be overwritten.
  905. X
  906. Use \fB-compress\fP to specify the type of image compression.
  907. X
  908. The equivalent X resource for this option is \fBwriteFilename\fP
  909. (class \fBWriteFilename\fP).  See \fBX RESOURCES\fP for details.
  910. .PP
  911. In addition to those listed above, you can specify these standard X
  912. resources as command line options:  \fB-background\fP,
  913. \fB-bordercolor\fP, \fB-borderwidth\fP,  \fB-font\fP,
  914. \fB-foreground\fP, \fB-iconGeometry\fP, \fB-iconic\fP, \fB-name\fP, or
  915. \fB-title\fP.  See \fBX RESOURCES\fP for details.
  916. .PP
  917. Any option you specify on the command line remains in effect until it is
  918. explicitly changed by specifying the option again with a different effect.
  919. For example to display two images, the first with 32 colors, and the
  920. second with only 16 colors, use:
  921. .PP
  922. X     display -colors 32 cockatoo.miff -colors 16 macaw.miff
  923. .PP
  924. Change \fI-\fP to \fI\+\fP in any option above to reverse its effect.
  925. For example, specify \fB\+compress\fP to store the binary image in an
  926. uncompressed format.
  927. .PP
  928. \fIfile\fP specifies the image filename.  By default, the image format
  929. is determined by its magic number. To specify a particular image format, precede
  930. the filename with an image format name and a colon (i.e.
  931. mtv:image) or specify the image type as the filename suffix (i.e. image.mtv).
  932. See \fBconvert(1)\fP for a list of valid image formats.  Specify \fIfile\fP
  933. as \fI-\fP for standard input or output.  If \fIfile\fP has the
  934. extension \fB.Z\fP, the file is decoded with \fIuncompress\fP.
  935. .SH BUTTONS
  936. The effects of each button press is described below.  Three buttons are
  937. required.  If you have a two button mouse, button 1 and 3 are returned.
  938. Press ALT and button 3 to simulate button 2.
  939. .TP 5
  940. .B "1"
  941. Press and drag to select a command from a pop-up menu.  Choose from
  942. these commands:
  943. X
  944. X    Image Info
  945. X    Reflect
  946. X    Rotate Right
  947. X    Rotate Left
  948. X    Half Size
  949. X    Double Size
  950. X    Restore
  951. X    Annotate
  952. X    Composite
  953. X    Write
  954. X    Print
  955. X    Next
  956. X    Last
  957. X    Quit
  958. .TP 5
  959. .B "2"
  960. Press and drag to define a region of the image to clip.  Release the button
  961. to crop the image, or return the pointer to the location of the initial button
  962. press to cancel the cropping operation.
  963. .TP 5
  964. .B "3"
  965. Press and drag to define a region of the image to magnify.
  966. X
  967. Note, this button behaves differently for a composite MIFF image
  968. created with \fImontage\fP.  Choose a particular tile of the composite
  969. and press this button, the image represented by the tile is then
  970. displayed.  To return to the composite MIFF image, choose \fINext\fP
  971. from the command menu (refer to Button 1).  See \fBmontage(1)\fP and
  972. \fBMIFF(5)\fP for more details.
  973. X
  974. .SH KEYBOARD ACCELERATORS
  975. .TP 5
  976. .B "i"
  977. Press to display information about the image.  Press any key or button to
  978. erase the information.
  979. X
  980. This information is printed: image scene number; image name; image
  981. size; the visual class (see \fB-visual\fP); and the total number of
  982. unique colors in the image.
  983. .TP 5
  984. .B "r"
  985. Press to reflect the image scanlines.
  986. .TP 5
  987. .B "/"
  988. Press to rotate the image 90 degrees clockwise.
  989. .TP 5
  990. .B "\e"
  991. Press to rotate the image 90 degrees counter-clockwise.
  992. .TP 5
  993. .B "<"
  994. Press to half the image size.
  995. .TP 5
  996. .B ">"
  997. Press to double the image size.
  998. .TP 5
  999. .B "o"
  1000. Press to restore the image to its original size.
  1001. .TP 5
  1002. .B "a"
  1003. Press to annotate the image with text.
  1004. X
  1005. Refer to \fBIMAGE ANNOTATION\fP for more details.
  1006. .TP 5
  1007. .B "c"
  1008. Press to composite the image with another.
  1009. X
  1010. Refer to \fBIMAGE COMPOSITING\fP for more details.
  1011. .TP 5
  1012. .B "w"
  1013. Press to write the image to a file.
  1014. .TP 5
  1015. .B "p"
  1016. Press to print the image to a file.
  1017. .TP 5
  1018. .B "n"
  1019. Press to display the next image.
  1020. .TP 5
  1021. .B "l"
  1022. Press to display the last image.
  1023. .TP 5
  1024. .B "q"
  1025. Press to discard all images and exit program.
  1026. .TP 5
  1027. .B "1-9"
  1028. Press to change the level of magnification.
  1029. .SH "X RESOURCES"
  1030. \fIDisplay\fP options can appear on the command line or in your X
  1031. resource file.  Options on the command line supersede values specified
  1032. in your X resource file.  See \fBX(1)\fP for more information on X
  1033. resources.
  1034. X
  1035. All \fIdisplay\fP options have a corresponding X resource.  In addition,
  1036. \fIdisplay\fP uses the following X resources:
  1037. .TP 5
  1038. .B background (\fPclass\fB Background)
  1039. Specifies the preferred color to use for the image window background.  The
  1040. default is black.
  1041. .TP 5
  1042. .B borderColor (\fPclass\fB BorderColor)
  1043. Specifies the preferred color to use for the image window border.  The
  1044. default is white.
  1045. .TP 5
  1046. .B borderWidth (\fPclass\fB BorderWidth)
  1047. Specifies the width in pixels of the image window border.  The default is 2.
  1048. .TP 5
  1049. .B font (\fPclass\fB Font)
  1050. Specifies the name of the preferred font to use when displaying text
  1051. within the image window.  The default is \fI/g9x15\fP, \fIfixed\fP, or
  1052. \fI/g6x13\fP determined by the image window size.
  1053. .TP 5
  1054. .B font[1-9] (\fPclass\fB Font[1-9])
  1055. Specifies the name of the preferred font to use when annotating the
  1056. image window with text.  The default fonts are \fIfixed\fP,
  1057. \fIvariable\fP, \fI5x8\fP, \fI6x10\fP, \fI7x13bold\fP, \fI8x13bold\fP,
  1058. \fI9x15bold\fP, \fI10x20\fP, and \fI12x24\fP.  Refer to \fBIMAGE
  1059. ANNOTATION\fP for more details.
  1060. .TP 5
  1061. .B foreground (\fPclass\fB Foreground)
  1062. Specifies the preferred color to use for text within the image window.  The
  1063. default is white.
  1064. .TP 5
  1065. .B iconGeometry (\fPclass\fB IconGeometry)
  1066. Specifies the preferred size and position of the application when
  1067. iconified.  It is not necessarily obeyed by all window managers.
  1068. .TP 5
  1069. .B iconic (\fPclass\fB Iconic)
  1070. This resource indicates that you would prefer that the application's
  1071. windows initially not be visible as if the windows had be immediately
  1072. iconified by you.  Window managers may choose not to honor the
  1073. application's request.
  1074. .TP 5
  1075. .B magnify (\fPclass\fB Magnify)
  1076. specifies an integral factor by which the image should be enlarged.  The
  1077. default is 2.
  1078. X
  1079. This value only affects the magnification window which is invoked with
  1080. button number 1 after the image is displayed.  Refer to \fBBUTTONS\fP
  1081. for more details.
  1082. .TP 5
  1083. .B name (\fPclass\fB Name)
  1084. This resource specifies the name under which resources for the
  1085. application should be found.  This resource is useful in shell aliases to
  1086. distinguish between invocations of an application, without resorting to
  1087. creating links to alter the executable file name.  The default is the
  1088. application name.
  1089. .TP 5
  1090. .B pen[1-9] (\fPclass\fB Pen[1-9])
  1091. Specifies the color of the preferred font to use when annotating the
  1092. image window with text.  The default colors are \fIblack\fP,
  1093. \fIblue\fP, \fIgreen\fP, \fIcyan\fP, \fIgray\fP, \fIred\fP,
  1094. \fImagenta\fP, \fIyellow\fP, and \fIwhite\fP.  Refer to \fBIMAGE
  1095. ANNOTATION\fP for more details.
  1096. .TP 5
  1097. .B title (\fPclass\fB Title)
  1098. This resource specifies the title to be used for the image window.  This
  1099. information is sometimes used by a window manager to provide a
  1100. header identifying the window.  The default is the image file name.
  1101. .SH IMAGE PANNING
  1102. When an image exceeds the width or height of the X server screen,
  1103. \fIdisplay\fP maps a small panning window.  The rectangle within the
  1104. panning window shows the area that is currently displayed in the
  1105. the image window.  To "pan" about the image, press and drag the mouse
  1106. within the panning window.  The panning rectangle moves with the mouse
  1107. and the image window is updated to reflect the location of the
  1108. rectangle within the panning window.  When you have selected the area
  1109. of the image you wish to view, just release the mouse button.
  1110. X
  1111. The panning window goes away if the image becomes smaller than the
  1112. dimensions of the X server screen.
  1113. .SH IMAGE ANNOTATION
  1114. An image is annotated with text interactively.  There is no command
  1115. line argument to annotate an image.  To begin, press button 1 and
  1116. choose \fIAnnotate Image\fP from the command menu (see \fBBUTTONS\fP).
  1117. Alternatively, press \fIa\fP in the image window (see \fBKEYBOARD
  1118. ACCELERATORS\fP).  To exit immediately, press \fIESC\fP.
  1119. .PP
  1120. A small window appears showing the location of the cursor in the image
  1121. window.  You are now in \fIannotate mode\fP.  To exit immediately,
  1122. press \fIESC\fP. In \fIannotate mode\fP a button press has a different
  1123. effect than described in \fBBUTTONS\fP.  Press a button to affect this
  1124. behavior:
  1125. .TP 5
  1126. .B "1"
  1127. Press to select a location within the image window to begin entering text.
  1128. .TP 5
  1129. .B "2"
  1130. Press and drag to select a font from a pop-up menu.  Choose from
  1131. these fonts:
  1132. X
  1133. X    fixed
  1134. X    variable
  1135. X    5x8
  1136. X    6x10
  1137. X    7x13bold
  1138. X    8x13bold
  1139. X    9x15bold
  1140. X    10x20
  1141. X    12x24
  1142. X
  1143. Other fonts can be specified by setting the X resources \fBfont1\fP through
  1144. \fBfont9\fP.  Refer to \fBX RESOURCES\fP for more details.
  1145. .TP 5
  1146. .B "3"
  1147. Press and drag to select a font color from a pop-up menu.  Choose from
  1148. these font colors:
  1149. X
  1150. X    black
  1151. X    blue
  1152. X    cyan
  1153. X    green
  1154. X    gray
  1155. X    red
  1156. X    magenta
  1157. X    yellow
  1158. X    white
  1159. X
  1160. Other font colors can be specified by setting the X resources \fBpen1\fP
  1161. through \fBpen9\fP.  Refer to \fBX RESOURCES\fP for more details.
  1162. .PP
  1163. Choosing a font and its color is optional.  The default font is
  1164. \fIfixed\fP and the default color is \fIblack\fP.  However, you must
  1165. choose a location to begin entering text and press button 1.  An
  1166. underscore character will appear at the location of the cursor where
  1167. you pressed button 1.  The cursor changes to a pencil to indicate
  1168. you are in \fItext mode\fP.  To exit immediately, press \fIESC\fP.
  1169. .PP
  1170. In \fItext mode\fP, any key presses will display the character at
  1171. the location of the underscore and advance the underscore cursor.
  1172. Enter your text and once completed press \fIESC\fP to finish your image
  1173. annotation.  To correct errors press \fIBACK SPACE\fP.  To delete an
  1174. entire line of text, press \fIDELETE\fP.  Any text that exceeds the
  1175. boundaries of the image window is automatically continued onto the next
  1176. line.
  1177. .PP
  1178. Before exiting \fItext mode\fP, immediately after pressing the
  1179. \fIESC\fP key, the image is permanently updated with the text you
  1180. entered.  There is no way to `undo' your changes so be careful to
  1181. check your text before you press \fIESC\fP.
  1182. .PP
  1183. The actual color you request for the font is saved in the image.
  1184. However, the color that appears in your image window may be different.
  1185. For example, on a monochrome screen the text will appear black or white even
  1186. if you choose the color red as the font color.  However, the image saved to
  1187. a file with \fB-write\fP will be written with red lettering.  To assure
  1188. the correct color text in the final image, any \fIPseudoClass\fP image
  1189. is promoted to \fIDirectClass\fP (see \fBMIFF(5)\fP).  To
  1190. force a \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use
  1191. \fB-colors\fP.
  1192. .SH IMAGE COMPOSITING
  1193. An image composite is created interactively.  There is no command line
  1194. argument to composite an image.  To begin, press button 1 and choose
  1195. \fIComposite Image\fP from the command menu (see \fBBUTTONS\fP).
  1196. Alternatively, press \fIc\fP in the image window (see \fBKEYBOARD
  1197. ACCELERATORS\fP).
  1198. .PP
  1199. First a popup window is displayed requesting you to enter an image name.  
  1200. Press \fIRETURN\fP, enter 'X:', or type a file name.  Press \fIRETURN\fP if
  1201. you choose not to create a composite image.  When you specify \fBX:\fP
  1202. as your file name, the filename has special meaning.  It specifies an X
  1203. window by id, name, or \fBroot\fP.  If no filename is specified, the
  1204. window is selected by clicking the mouse in the desired window.  See
  1205. \fBXtoPS(1)\fP for details.
  1206. .PP
  1207. A small window appears showing the location of the cursor in the image
  1208. window.  You are now in \fIcomposite mode\fP.  To exit immediately,
  1209. press \fIESC\fP.  In \fIcomposite mode\fP a button press has a
  1210. different effect than described in \fBBUTTONS\fP.  Press a button to
  1211. affect this behavior: 
  1212. .TP 5
  1213. .B "1"
  1214. Press to select a location within \fIimage window\fP to composite your
  1215. image.
  1216. .TP 5
  1217. .B "2"
  1218. Press and drag to select a composite operation from a pop-up menu.
  1219. Choose from these composite operations:
  1220. X
  1221. X    over
  1222. X    in
  1223. X    out
  1224. X    atop
  1225. X    xor
  1226. X    plus
  1227. X    minus
  1228. X    add
  1229. X    subtract
  1230. X    difference
  1231. X    replace
  1232. .PP
  1233. The operations behaves as follows:
  1234. .TP 9
  1235. .B over
  1236. The result will be the union of the two image shapes, with \fIimage\fP
  1237. obscuring \fIimage window\fP in the region of overlap.
  1238. .TP 9
  1239. .B in
  1240. The result is simply \fIimage\fP cut by the shape of \fIimage
  1241. window\fP.  None of the image data of \fIimage window\fP will be in the
  1242. result.
  1243. .TP 9
  1244. .B out
  1245. The resulting image is \fIimage\fP with the shape of \fIimage window\fP
  1246. cut out.
  1247. .TP 9
  1248. .B atop
  1249. The result is the same shape as image \fIimage window\fP, with
  1250. \fIimage\fP obscuring \fIimage window\fP where the image shapes
  1251. overlap.  Note this differs from \fBover\fP because the portion of
  1252. \fIimage\fP outside \fIimage window\fP's shape does not appear in the
  1253. result.
  1254. .TP 9
  1255. .B xor
  1256. The result is the image data from both \fIimage\fP and \fIimage window\fP
  1257. that is outside the overlap region.  The overlap region will be blank.
  1258. .TP 9
  1259. .B plus
  1260. The result is just the sum of the image data.  Output values are
  1261. clipped to 255 (no overflow).  This operation is independent
  1262. of the alpha channels.
  1263. .TP 9
  1264. .B minus
  1265. The result of \fIimage\fP \- \fIimage window\fP, with underflow clipped
  1266. to zero.  The alpha channel is ignored (set to 255, full coverage).
  1267. .TP 9
  1268. .B add
  1269. The result of \fIimage\fP + \fIimage window\fP, with overflow wrapping
  1270. around (\fImod\fP 256).
  1271. .TP 9
  1272. .B subtract
  1273. The result of \fIimage\fP - \fIimage window\fP, with underflow wrapping
  1274. around (\fImod\fP 256).  The \fBadd\fP and \fBsubtract\fP operators can
  1275. be used to perform reversible transformations.
  1276. .TP 9
  1277. .B difference
  1278. The result of abs(\fIimage\fP \- \fIimage window\fP).  This is useful
  1279. for comparing two very similar images.
  1280. .TP 9
  1281. .B replace
  1282. The resulting image is \fIimage window\fP replaced with \fIimage\fP.
  1283. Here the alpha information is ignored.
  1284. .PP
  1285. The image compositor requires an alpha, or matte channel in the image
  1286. for some operations.  This extra channel usually defines a mask which
  1287. represents a sort of a cookie-cutter for the image.  This is the case
  1288. when alpha is 255 (full coverage) for pixels inside the shape, zero
  1289. outside, and between zero and 255 on the boundary.  If \fIimage\fP does
  1290. not have an alpha channel, it is initialized with 0 for any pixel
  1291. matching in color to pixel location (0,0), otherwise 255.
  1292. .PP
  1293. Note that alpha information for \fIimage window\fP is not retained for
  1294. colormapped X server visuals (e.g. \fIStaticColor\fP,
  1295. \fIStaticColor\fP, \fIGrayScale\fP, \fIPseudoColor\fP).  Correct
  1296. compositing behavior may require a \fITrueColor\fP or \fIDirectColor\fP
  1297. visual or a \fIStandard Colormap\fP.
  1298. .PP
  1299. Choosing a composite operator is optional.  The default operator is
  1300. \Ifover\fP.  However, you must choose a location to composite your image
  1301. and press button 1.  Press and hold button 1 before releasing and an
  1302. outline of the image will appear to help you identify your location.
  1303. .PP
  1304. Immediately after releasing button 1, \fIimage window\fP is
  1305. permanently updated with your composited image.  There is no way to
  1306. `undo' your changes.  Be careful when choosing your location.
  1307. .PP
  1308. The actual colors of the composite image is saved.  However, the color
  1309. that appears in \fIimage window\fP may be different.  For example, on a
  1310. monochrome screen \fIimage window\fP will appear black or white even
  1311. though your composited image may have many colors.  If the image is
  1312. saved to a file it is written with the correct colors.  To assure the
  1313. correct colors are saved in the final image, any \fIPseudoClass\fP
  1314. image is promoted to \fIDirectClass\fP (see \fBMIFF(5)\fP).  To force a
  1315. \fIPseudoClass\fP image to remain \fIPseudoClass\fP, use \fB-colors\fP.
  1316. .SH ENVIRONMENT
  1317. .TP 5
  1318. .B DISPLAY
  1319. To get the default host, display number, and screen.
  1320. .SH SEE ALSO
  1321. import(1), mogrify(1), convert(1), Quantize(9), MIFF(5), X(1), xstdcmap(1),
  1322. more(1), compress(1),
  1323. .SH COPYRIGHT
  1324. Copyright 1992 E. I. du Pont de Nemours & Company
  1325. .PP
  1326. Permission to use, copy, modify, distribute, and sell this software and
  1327. its documentation for any purpose is hereby granted without fee,
  1328. provided that the above copyright notice appear in all copies and that
  1329. both that copyright notice and this permission notice appear in
  1330. supporting documentation, and that the name of E. I. du Pont de Nemours
  1331. & Company not be used in advertising or publicity pertaining to
  1332. distribution of the software without specific, written prior
  1333. permission.  E. I. du Pont de Nemours & Company makes no representations
  1334. about the suitability of this software for any purpose.  It is provided
  1335. "as is" without express or implied warranty.
  1336. .PP
  1337. E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1338. to this software, including all implied warranties of merchantability
  1339. and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1340. liable for any special, indirect or consequential damages or any
  1341. damages whatsoever resulting from loss of use, data or profits, whether
  1342. in an action of contract, negligence or other tortious action, arising
  1343. out of or in connection with the use or performance of this software.
  1344. .SH ACKNOWLEDGEMENTS
  1345. The MIT X Consortium for making network transparent graphics a reality.
  1346. .PP
  1347. Rod Bogart and John W. Peterson, University of Utah.  Image
  1348. compositing is loosely based on \fIrlecomp\fP of the Utah Raster
  1349. Toolkit.
  1350. .PP
  1351. Michael Halle, Spatial Imaging Group at MIT, for the initial
  1352. implementation of Alan Paeth's image rotation algorithm.
  1353. .PP
  1354. David Pensak, E. I. du Pont de Nemours & Company, for providing a
  1355. computing environment that made this program possible.
  1356. .PP
  1357. Paul Raveling, USC Information Sciences Institute, for the original
  1358. idea of using space subdivision for the color reduction algorithm.
  1359. .SH AUTHORS
  1360. John Cristy, E.I. du Pont de Nemours & Company Incorporated
  1361. SHAR_EOF
  1362. chmod 0644 ImageMagick/display.man ||
  1363. echo 'restore of ImageMagick/display.man failed'
  1364. Wc_c="`wc -c < 'ImageMagick/display.man'`"
  1365. test 30521 -eq "$Wc_c" ||
  1366.     echo 'ImageMagick/display.man: original size 30521, current size' "$Wc_c"
  1367. rm -f _shar_wnt_.tmp
  1368. fi
  1369. # ============= ImageMagick/xtp/Makefile ==============
  1370. if test ! -d 'ImageMagick/xtp'; then
  1371.     echo 'x - creating directory ImageMagick/xtp'
  1372.     mkdir 'ImageMagick/xtp'
  1373. fi
  1374. if test -f 'ImageMagick/xtp/Makefile' -a X"$1" != X"-c"; then
  1375.     echo 'x - skipping ImageMagick/xtp/Makefile (File already exists)'
  1376.     rm -f _shar_wnt_.tmp
  1377. else
  1378. > _shar_wnt_.tmp
  1379. echo 'x - extracting ImageMagick/xtp/Makefile (Text)'
  1380. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/Makefile' &&
  1381. #
  1382. #  Generic makefile for display, animate, montage, XtoPS, and import for
  1383. #  computers that do not have xmkmf.
  1384. #
  1385. #  Copyright 1992 E. I. du Pont de Nemours & Company
  1386. #
  1387. #  Permission to use, copy, modify, distribute, and sell this software and
  1388. #  its documentation for any purpose is hereby granted without fee,
  1389. #  provided that the above Copyright notice appear in all copies and that
  1390. #  both that Copyright notice and this permission notice appear in
  1391. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  1392. #  & Company not be used in advertising or publicity pertaining to
  1393. #  distribution of the software without specific, written prior
  1394. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  1395. #  about the suitability of this software for any purpose.  It is provided
  1396. #  "as is" without express or implied warranty.
  1397. #
  1398. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1399. #  to this software, including all implied warranties of merchantability
  1400. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1401. #  liable for any special, indirect or consequential damages or any
  1402. #  damages whatsoever resulting from loss of use, data or profits, whether
  1403. #  in an action of contract, negligence or other tortious action, arising
  1404. #  out of or in connection with the use or performance of this software.
  1405. #
  1406. X
  1407. CC= cc -O
  1408. DESTDIR= /usr/local/bin
  1409. INSTALL = install -c
  1410. RM= /bin/rm -f
  1411. #SYS_LIBRARIES= -lnsl
  1412. X
  1413. XXTPObjects= xtp.o network.o regular.o
  1414. X
  1415. PROGRAMS= xtp 
  1416. X
  1417. all: $(PROGRAMS)
  1418. X
  1419. xtp:     $(XTPObjects)
  1420. X    $(RM) $@
  1421. X    $(CC) -o $@ $(XTPObjects) $(SYS_LIBRARIES)
  1422. X
  1423. clean::
  1424. X    $(RM) xtp
  1425. X
  1426. install:: xtp
  1427. X    $(INSTALL) xtp $(DESTDIR)
  1428. X
  1429. clean::
  1430. X    $(RM) *.ln *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut
  1431. SHAR_EOF
  1432. chmod 0644 ImageMagick/xtp/Makefile ||
  1433. echo 'restore of ImageMagick/xtp/Makefile failed'
  1434. Wc_c="`wc -c < 'ImageMagick/xtp/Makefile'`"
  1435. test 1752 -eq "$Wc_c" ||
  1436.     echo 'ImageMagick/xtp/Makefile: original size 1752, current size' "$Wc_c"
  1437. rm -f _shar_wnt_.tmp
  1438. fi
  1439. # ============= ImageMagick/xtp/Imakefile ==============
  1440. if test -f 'ImageMagick/xtp/Imakefile' -a X"$1" != X"-c"; then
  1441.     echo 'x - skipping ImageMagick/xtp/Imakefile (File already exists)'
  1442.     rm -f _shar_wnt_.tmp
  1443. else
  1444. > _shar_wnt_.tmp
  1445. echo 'x - extracting ImageMagick/xtp/Imakefile (Text)'
  1446. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/Imakefile' &&
  1447. #
  1448. #  Imakefile for xtp.
  1449. #
  1450. #  Copyright 1992 E. I. du Pont de Nemours & Company
  1451. #
  1452. #  Permission to use, copy, modify, distribute, and sell this software and
  1453. #  its documentation for any purpose is hereby granted without fee,
  1454. #  provided that the above Copyright notice appear in all copies and that
  1455. #  both that Copyright notice and this permission notice appear in
  1456. #  supporting documentation, and that the name of E. I. du Pont de Nemours
  1457. #  & Company not be used in advertising or publicity pertaining to
  1458. #  distribution of the software without specific, written prior
  1459. #  permission.  E. I. du Pont de Nemours & Company makes no representations
  1460. #  about the suitability of this software for any purpose.  It is provided
  1461. #  "as is" without express or implied warranty.
  1462. #
  1463. #  E. I. du Pont de Nemours & Company disclaims all warranties with regard
  1464. #  to this software, including all implied warranties of merchantability
  1465. #  and fitness, in no event shall E. I. du Pont de Nemours & Company be
  1466. #  liable for any special, indirect or consequential damages or any
  1467. #  damages whatsoever resulting from loss of use, data or profits, whether
  1468. #  in an action of contract, negligence or other tortious action, arising
  1469. #  out of or in connection with the use or performance of this software.
  1470. #
  1471. X
  1472. #include "../Magick.tmpl"
  1473. X
  1474. XXTPObjects= xtp.o network.o regular.o
  1475. X
  1476. PROGRAMS= xtp
  1477. X
  1478. AllTarget($(PROGRAMS))
  1479. X
  1480. NormalProgramTarget(xtp,$(XTPObjects), , , )
  1481. InstallProgram(xtp,$(LOCALDIR))
  1482. InstallManPage(xtp,$(MANDIR))
  1483. SHAR_EOF
  1484. chmod 0644 ImageMagick/xtp/Imakefile ||
  1485. echo 'restore of ImageMagick/xtp/Imakefile failed'
  1486. Wc_c="`wc -c < 'ImageMagick/xtp/Imakefile'`"
  1487. test 1497 -eq "$Wc_c" ||
  1488.     echo 'ImageMagick/xtp/Imakefile: original size 1497, current size' "$Wc_c"
  1489. rm -f _shar_wnt_.tmp
  1490. fi
  1491. # ============= ImageMagick/xtp/xtp.h ==============
  1492. if test -f 'ImageMagick/xtp/xtp.h' -a X"$1" != X"-c"; then
  1493.     echo 'x - skipping ImageMagick/xtp/xtp.h (File already exists)'
  1494.     rm -f _shar_wnt_.tmp
  1495. else
  1496. > _shar_wnt_.tmp
  1497. echo 'x - extracting ImageMagick/xtp/xtp.h (Text)'
  1498. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/xtp.h' &&
  1499. /*
  1500. X  Include declarations
  1501. */
  1502. #include <stdio.h>
  1503. #if __STDC__ || defined(sgi) || defined(AIXV3)
  1504. #include <stdlib.h>
  1505. #else
  1506. #ifndef vms
  1507. #include <malloc.h>
  1508. #include <memory.h>
  1509. X
  1510. extern long
  1511. X  strtol(),
  1512. X  time();
  1513. #endif
  1514. #endif
  1515. #include <ctype.h>
  1516. #include <math.h>
  1517. #include <string.h>
  1518. X
  1519. /*
  1520. X  Define declarations for the Display program.
  1521. */
  1522. #if __STDC__ || defined(sgi) || defined(AIXV3)
  1523. #define _Declare(formal_parameters) formal_parameters
  1524. #else
  1525. #define const 
  1526. #define _Declare(formal_parameters) ()
  1527. #endif
  1528. #define False  0
  1529. #define True  1
  1530. #define Warning(message,qualifier)  \
  1531. {  \
  1532. X  (void) fprintf(stderr,"%s: %s",application_name,message);  \
  1533. X  if (qualifier != (char *) NULL)  \
  1534. X    (void) fprintf(stderr," (%s)",qualifier);  \
  1535. X  (void) fprintf(stderr,".\n");  \
  1536. }
  1537. X
  1538. #ifndef lint
  1539. static char 
  1540. X  Version[]="@(#)ImageMagick 2.1 92/10/10 cristy@dupont.com";
  1541. #endif
  1542. SHAR_EOF
  1543. chmod 0644 ImageMagick/xtp/xtp.h ||
  1544. echo 'restore of ImageMagick/xtp/xtp.h failed'
  1545. Wc_c="`wc -c < 'ImageMagick/xtp/xtp.h'`"
  1546. test 861 -eq "$Wc_c" ||
  1547.     echo 'ImageMagick/xtp/xtp.h: original size 861, current size' "$Wc_c"
  1548. rm -f _shar_wnt_.tmp
  1549. fi
  1550. # ============= ImageMagick/xtp/README ==============
  1551. if test -f 'ImageMagick/xtp/README' -a X"$1" != X"-c"; then
  1552.     echo 'x - skipping ImageMagick/xtp/README (File already exists)'
  1553.     rm -f _shar_wnt_.tmp
  1554. else
  1555. > _shar_wnt_.tmp
  1556. echo 'x - extracting ImageMagick/xtp/README (Text)'
  1557. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/README' &&
  1558. XXtp is a utility for retrieving, listing, or printing files from a
  1559. remote network site.  Xtp performs most of the same functions as the
  1560. ftp program, but does not require any interactive commands.  You simply
  1561. specify the file transfer task on the command line and xtp performs the
  1562. transfer automatically.
  1563. X
  1564. To retrieve file contrib/ImageMagick.tar.Z from host export.lcs.mit.edu, 
  1565. use:
  1566. X
  1567. X  xtp -binary -retrieve ImageMagick.tar.Z export.lcs.mit.edu contrib
  1568. X
  1569. XXtp requires 4.3 BSD compatibilities.  I have successfully executed it on
  1570. a SUN, DEC Ultrix, MIPS, IBM RS/6000, and Ardent Titan.
  1571. X
  1572. The author is cristy@dupont.com.  Comments, suggestions, etc, are
  1573. welcome, but be kind.
  1574. X
  1575. ---
  1576. X
  1577. Copyright 1990 E. I. Dupont de Nemours & Company
  1578. X
  1579. Permission to use, copy, modify, distribute, and sell this software and
  1580. its documentation for any purpose is hereby granted without fee,
  1581. provided that the above copyright notice appear in all copies and that
  1582. both that copyright notice and this permission notice appear in
  1583. supporting documentation, and that the name of E. I. Dupont de Nemours
  1584. & Company not be used in advertising or publicity pertaining to
  1585. distribution of the software without specific, written prior
  1586. permission.  E. I. Dupont de Nemours & Company makes no representations
  1587. about the suitability of this software for any purpose.  It is provided
  1588. "as is" without express or implied warranty.
  1589. X
  1590. E. I. Dupont de Nemours & Company disclaims all warranties with regard
  1591. to this software, including all implied warranties of merchantability
  1592. and fitness, in no event shall E. I. Dupont de Nemours & Company be
  1593. liable for any special, indirect or consequential damages or any
  1594. damages whatsoever resulting from loss of use, data or profits, whether
  1595. in an action of contract, negligence or other tortious action, arising
  1596. out of or in connection with the use or performance of this software.
  1597. X
  1598. SHAR_EOF
  1599. chmod 0644 ImageMagick/xtp/README ||
  1600. echo 'restore of ImageMagick/xtp/README failed'
  1601. Wc_c="`wc -c < 'ImageMagick/xtp/README'`"
  1602. test 1876 -eq "$Wc_c" ||
  1603.     echo 'ImageMagick/xtp/README: original size 1876, current size' "$Wc_c"
  1604. rm -f _shar_wnt_.tmp
  1605. fi
  1606. # ============= ImageMagick/xtp/regular.c ==============
  1607. if test -f 'ImageMagick/xtp/regular.c' -a X"$1" != X"-c"; then
  1608.     echo 'x - skipping ImageMagick/xtp/regular.c (File already exists)'
  1609.     rm -f _shar_wnt_.tmp
  1610. else
  1611. > _shar_wnt_.tmp
  1612. echo 'x - extracting ImageMagick/xtp/regular.c (Text)'
  1613. sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/xtp/regular.c' &&
  1614. /*
  1615. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1616. %                                                                             %
  1617. %                                                                             %
  1618. %                                                                             %
  1619. %             RRRR   EEEEE   GGGG  U   U  L       AAA   RRRR                  %
  1620. %             R   R  E      G      U   U  L      A   A  R   R                 %
  1621. %             RRRR   EEE    G  GG  U   U  L      AAAAA  RRRR                  %
  1622. %             R R    E      G   G  U   U  L      A   A  R R                   %
  1623. %             R  R   EEEEE   GGGG   UUU   LLLLL  A   A  R  R                  %
  1624. %                                                                             %
  1625. %                                                                             %
  1626. %                     Regular Expression Interpreter.                         %
  1627. %                                                                             %
  1628. %                                                                             %
  1629. %                                                                             %
  1630. %                           Software Design                                   %
  1631. %                             John Cristy                                     %
  1632. %                              July 1992                                      %
  1633. %                                                                             %
  1634. %                                                                             %
  1635. %  Copyright 1992 E. I. Dupont de Nemours & Company                           %
  1636. %                                                                             %
  1637. %  Permission to use, copy, modify, distribute, and sell this software and    %
  1638. %  its documentation for any purpose is hereby granted without fee,           %
  1639. %  provided that the above Copyright notice appear in all copies and that     %
  1640. %  both that Copyright notice and this permission notice appear in            %
  1641. %  supporting documentation, and that the name of E. I. Dupont de Nemours     %
  1642. SHAR_EOF
  1643. true || echo 'restore of ImageMagick/xtp/regular.c failed'
  1644. fi
  1645. echo 'End of  part 2'
  1646. echo 'File ImageMagick/xtp/regular.c is continued in part 3'
  1647. echo 3 > _shar_seq_.tmp
  1648. exit 0
  1649. exit 0 # Just in case...
  1650.