# HG changeset patch # User Carnë Draug # Date 1350074300 -7200 # Node ID 7a0a202fedfe33e7743da277028e30ab1f66d541 # Parent 3ae8c1ee7365ecf889234eca8301500e794e71c3 iscolormap: new function for image diff -r 3ae8c1ee7365 -r 7a0a202fedfe NEWS --- a/NEWS Fri Oct 12 11:46:06 2012 -0400 +++ b/NEWS Fri Oct 12 22:38:20 2012 +0200 @@ -93,10 +93,11 @@ ** Other new functions added in 3.8.0: - betaincinv erfcinv polyeig shrinkfaces - cmpermute findfigs splinefit - cmunique fminsearch tetramesh - colorcube lines rgbplot + betaincinv erfcinv lines rgbplot + cmpermute findfigs polyeig shrinkfaces + cmunique fminsearch splinefit + colorcube iscolormap tetramesh + ** Deprecated functions. The following functions were deprecated in Octave 3.4 and have been diff -r 3ae8c1ee7365 -r 7a0a202fedfe doc/interpreter/image.txi --- a/doc/interpreter/image.txi Fri Oct 12 11:46:06 2012 -0400 +++ b/doc/interpreter/image.txi Fri Oct 12 22:38:20 2012 +0200 @@ -117,6 +117,8 @@ an RGB color. The color map must be of class @code{double} with values between 0 and 1. +@DOCSTRING(iscolormap) + @DOCSTRING(gray2ind) @DOCSTRING(ind2gray) diff -r 3ae8c1ee7365 -r 7a0a202fedfe scripts/image/iscolormap.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/image/iscolormap.m Fri Oct 12 22:38:20 2012 +0200 @@ -0,0 +1,45 @@ +## Copyright (C) 2012 Carnë Draug +## +## This file is part of Octave. +## +## Octave 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 3 of the License, or (at +## your option) any later version. +## +## Octave 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. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} iscolormap (@var{cm}) +## Return true if @var{cm} is a colormap. +## +## A colormap is an @var{n} row by 3 column matrix. The columns contain red, +## green, and blue intensities respectively. All entries should be between 0 +## and 1 inclusive. +## +## @seealso{colormap, rgbplot} +## @end deftypefn + +## Author: Carnë Draug + +function retval = iscolormap (cm) + + if (nargin != 1) + print_usage; + endif + + retval = (ismatrix (cm) && isreal (cm) && isnumeric (cm) && + columns(cm) == 3 && ndims (cm) == 2 && isa (cm, "double") && + min (cm(:)) >= 0 && max (cm(:)) <= 1); + +endfunction + +%!assert (iscolormap (jet (64))) +%!assert (iscolormap (magic (4)), false) diff -r 3ae8c1ee7365 -r 7a0a202fedfe scripts/image/module.mk --- a/scripts/image/module.mk Fri Oct 12 11:46:06 2012 -0400 +++ b/scripts/image/module.mk Fri Oct 12 22:38:20 2012 +0200 @@ -18,6 +18,7 @@ image/hot.m \ image/hsv.m \ image/hsv2rgb.m \ + image/iscolormap.m \ image/image.m \ image/imagesc.m \ image/imfinfo.m \