/usr/share/plplot_octave/plimage.m is in octave-plplot 5.9.9-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ## Copyright (C) 2000-2003 Joao Cardoso.
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2 of the License, or (at your
## option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## This file is part of plplot_octave.
## plimage(img, xi, xe, yi, ye)
##
## Plot an image, assuming that it is in octave image format, where each
## matrix element is an index in the colormap.
## if xi, xe, yi and ye exists, and are smaller than the image dimension
## in pixels, than only that portion of the image will be shown.
## No smoothing will be performed!
## Preliminary! see p17.m
##
## ex:
## [img, map] = loadimage("default.img"); # "lena.img" can also be used
## colormap(map);
## plimage(img);
function plimage(img, x1, x2, y1, y2)
global __pl
strm = __pl_init;
[nr, nc] = size(img);
if (nargin == 1)
xi = yi = 1;
xf = nc;
yf = nr;
elseif (nargin == 5)
if (x1 < 1 || x1 > nc || x2 < 1 || x2 > nc ||
y1 < 1 || y1 > nr || y1 < 1 || y2 > nr)
usage "plimage";
return;
else
xi = min([x1, x2]);
xf = max([x1, x2]);
yi = min([y1, y2]);
yf = max([y1, y2]);
endif
else
usage "plimage";
return;
endif
__pl_plenv(xi, xf, yi, yf, 1, -1);
pplimage (fliplr(img'),
1, nc, 1, nr,
0, 0,
xi, xf, yi, yf);
pllab(tdeblank(__pl.xlabel(strm,:)),
tdeblank(__pl.ylabel(strm,:)),
tdeblank(__pl.tlabel(strm,:)));
plflush;pleop;
__pl.items(strm) = 1; # for now!
endfunction
|