1## Copyright (C) 2002-2003 Joao Cardoso.
2##
3## This program is free software; you can redistribute it and/or modify it
4## under the terms of the GNU General Public License as published by the
5## Free Software Foundation; either version 2 of the License, or (at your
6## option) any later version.
7##
8## This program is distributed in the hope that it will be useful, but
9## WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11## General Public License for more details.
12##
13## This file is part of plplot_octave.
14
15function p17(fg)
16
17  global pl_automatic_replot
18  t = pl_automatic_replot;
19  pl_automatic_replot = 0;
20
21  if(!exist('imread'))
22    warning('Example p17 requires imread from octave-forge');
23    return;
24  end
25
26  title "Click and Drag button 1 to select";
27  xlabel "Button 2 to restart and button 3 to finish";
28  ylabel "";
29  file_pgm = imread (file_in_loadpath ("Chloe.pgm"));
30  [img, map]= gray2ind (file_pgm, 255);
31  colormap(map);
32  plimage (img);
33  if (!nargin)
34    [x1, y1, x2, y2] = plrb(1);
35    % Prevent case where range is zero
36    if (x1 == x2)
37      x2 = x1+1;
38    end
39    if (y1 == y2)
40      y2 = y1+1;
41    end
42    title "Chloe";
43    xlabel "";
44    plimage (img, x1, x2, y1, y2);
45  endif
46
47  pl_automatic_replot = t;
48
49endfunction
50