annotate scripts/image/image_viewer.m @ 10846:a4f482e66b65

Grammarcheck more of the documentation. Use @noindent macro appropriately. Limit line length to 80 characters.
author Rik <octave@nomad.inbox5.com>
date Sun, 01 Aug 2010 20:22:17 -0700
parents 693e22af08ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
16f53d29049f update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9072
diff changeset
1 ## Copyright (C) 2006, 2007, 2008, 2009 S�ren Hauberg
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
2 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
4 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6944
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6944
diff changeset
8 ## your option) any later version.
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
9 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
14 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6944
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6944
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
18
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {[@var{fcn}, @var{default_zoom}] =} image_viewer (@var{fcn}, @var{default_zoom})
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
21 ## Change the program or function used for viewing images and return the
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
22 ## previous values.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
23 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
24 ## When the @code{image} or @code{imshow} function is called it will
9072
bd8e388043c4 Cleanup documentation for signal.texi, image.texi, audio.texi
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
25 ## launch an external program to display the image. The default behavior
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
26 ## is to use gnuplot if the installed version supports image viewing,
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
27 ## and otherwise try the programs @code{display}, @code{xv}, and
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
28 ## @code{xloadimage}. Using this function it is possible to change that
9072
bd8e388043c4 Cleanup documentation for signal.texi, image.texi, audio.texi
Rik <rdrider0-list@yahoo.com>
parents: 9051
diff changeset
29 ## behavior.
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
30 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
31 ## When called with one input argument images will be displayed by saving
8347
fa78cb8d8a5c corrections for typos
Brian Gough<bjg@network-theory.co.uk>
parents: 7017
diff changeset
32 ## the image to a file and the system command @var{command} will be called
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
33 ## to view the image. The @var{command} must be a string containing
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
34 ## @code{%s} and possibly @code{%f}. The @code{%s} will be replaced by
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
35 ## the filename of the image, and the @code{%f} will (if present) be
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
36 ## replaced by the zoom factor given to the @code{image} function.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
37 ## For example,
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
38 ##
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
39 ## @example
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
40 ## image_viewer ("eog %s");
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
41 ## @end example
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
42 ##
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
43 ## @noindent
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
44 ## changes the image viewer to the @code{eog} program.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
45 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
46 ## With two input arguments, images will be displayed by calling
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
47 ## the function @var{function_handle}. For example,
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
48 ##
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
49 ## @example
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
50 ## image_viewer (data, @@my_image_viewer);
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
51 ## @end example
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
52 ##
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
53 ## @noindent
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
54 ## sets the image viewer function to @code{my_image_viewer}. The image
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
55 ## viewer function is called with
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
56 ##
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
57 ## @example
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
58 ## my_image_viewer (@var{x}, @var{y}, @var{im}, @var{zoom}, @var{data})
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
59 ## @end example
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
60 ##
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
61 ## @noindent
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
62 ## where @var{x} and @var{y} are the axis of the image, @var{im} is the image
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
63 ## variable, and @var{data} is extra user-supplied data to be passed to
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
64 ## the viewer function.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
65 ##
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
66 ## With three input arguments it is possible to change the zooming.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
67 ## Some programs (like @code{xloadimage}) require the zoom factor to be
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
68 ## between 0 and 100, and not 0 and 1 like Octave assumes. This is
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
69 ## solved by setting the third argument to 100.
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
70 ##
6944
96714c92a278 [project @ 2007-10-02 16:53:00 by jwe]
jwe
parents: 6257
diff changeset
71 ## @seealso{image, imshow}
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
72 ## @end deftypefn
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
73
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
74 function [ocmd, ofcn, ozoom] = image_viewer (cmd, fcn, zoom)
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
75
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
76 persistent view_cmd;
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
77 persistent view_fcn;
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
78 persistent view_zoom = 1;
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
79
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
80 if (isempty (view_fcn))
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
81 if (isempty (view_cmd)
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
82 && compare_versions (__gnuplot_version__ (), "4.0", ">"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6165
diff changeset
83 view_fcn = "gnuplot_internal";
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
84 else
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
85 view_fcn = @__img_via_file__;
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
86 endif
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
87 endif
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
88
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
89 if (nargin > 3)
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
90 print_usage ();
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
91 endif
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
92
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
93 if (nargout > 0)
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
94 ocmd = view_cmd;
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
95 ofcn = view_fcn;
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
96 ozoom = view_zoom;
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
97 endif
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
98
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
99 if (nargin > 0)
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
100
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
101 if (nargin < 3)
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
102 zoom = 1;
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
103 if (nargin < 2)
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
104 fcn = [];
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
105 endif
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
106 endif
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
107
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
108 view_cmd = cmd;
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
109 view_fcn = fcn;
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
110 view_zoom = zoom;
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
111
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
112 if (nargin > 1)
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
113 if (isa (fcn, "function_handle"))
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
114 view_fcn = fcn;
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
115 else
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
116 error ("image_viewer: expecting second argument to be a function handle");
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
117 endif
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
118 endif
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
119
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
120 if (nargin > 2)
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
121 if (isnumeric (zoom) && isscalar (zoom) && isreal (zoom))
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
122 view_zoom = zoom;
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
123 else
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 9899
diff changeset
124 error ("image_viewer: expecting third argument to be a real scalar");
6165
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
125 endif
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
126 endif
ea26b8fda4d7 [project @ 2006-11-14 23:32:28 by jwe]
jwe
parents: 6164
diff changeset
127
6164
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
128 endif
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
129
d90b16110095 [project @ 2006-11-14 21:08:00 by jwe]
jwe
parents:
diff changeset
130 endfunction
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
131
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
132 ## Display an image by saving it to a file in PPM format and launching
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
133 ## @var{command}.
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
134 ##
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
135 ## The @var{command} must be a format string containing @code{%s} and
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
136 ## possibly @code{%f}. The @code{%s} will be replaced by the filename
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
137 ## of the image, and the @code{%f} will be replaced by @var{zoom}. The
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
138 ## @var{x} and @var{y} arguments are ignored.
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
139
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
140 function __img_via_file__ (x, y, im, zoom, command)
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
141
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
142 ppm_name = tmpnam ();
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
143 saveimage (ppm_name, im, "ppm");
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
144
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
145 rm = sprintf ("rm -f \"%s\"", ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
146
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
147 if (isempty (command))
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
148 ## Different image viewer commands.
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
149 xv = sprintf ("xv -raw -expand %f \"%s\"", zoom, ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
150 xloadimage = sprintf ("xloadimage -zoom %f \"%s\"", zoom*100, ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
151 im_display = sprintf ("display -resize %f%% \"%s\"", zoom*100, ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
152
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
153 ## Need to let the shell clean up the tmp file because we are putting
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
154 ## the viewer in the background.
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
155 status = system (sprintf ("( %s || %s || %s && %s ) > /dev/null 2>&1 &",
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
156 im_display, xv, xloadimage, rm));
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
157 else
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
158 ## Does the command support zooming?
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
159 if (findstr (command, "%f"))
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
160 command = sprintf (command, zoom, ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
161 else
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
162 command = sprintf (command, ppm_name);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
163 endif
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
164 status = system (sprintf ("( %s && %s) > /dev/null 2>&1 &", command, rm));
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
165 endif
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
166
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
167 ## Did the system call fail?
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
168 if (status != 0)
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10433
diff changeset
169 error ("image_viewer: the image viewing command failed");
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
170 endif
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
171
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
172 endfunction