comparison scripts/image/private/__imwrite__.m @ 19833:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children e9f89866074c
comparison
equal deleted inserted replaced
19832:a1acca0c2216 19833:9fc020886ae9
78 options.delaytime(1:size (img, 4)) = options.delaytime; 78 options.delaytime(1:size (img, 4)) = options.delaytime;
79 elseif (size (img, 4) != numel (options.delaytime)) 79 elseif (size (img, 4) != numel (options.delaytime))
80 error ("imwrite: value for %s must either be a scalar or the number of frames", 80 error ("imwrite: value for %s must either be a scalar or the number of frames",
81 param_list{idx}); 81 param_list{idx});
82 endif 82 endif
83 if (any (options.delaytime(:) < 0) || any (options.delaytime(:) > 65535)) 83 if (any (options.delaytime(:) < 0)
84 || any (options.delaytime(:) > 65535))
84 error ("imwrite: value for %s must be between 0 and 655.35 seconds", 85 error ("imwrite: value for %s must be between 0 and 655.35 seconds",
85 param_list{idx}); 86 param_list{idx});
86 endif 87 endif
87 88
88 case "disposalmethod" 89 case "disposalmethod"
94 elseif (! iscell (options.disposalmethod)) 95 elseif (! iscell (options.disposalmethod))
95 options.disposalmethod = {options.disposalmethod}; 96 options.disposalmethod = {options.disposalmethod};
96 endif 97 endif
97 options.disposalmethod = tolower (options.disposalmethod); 98 options.disposalmethod = tolower (options.disposalmethod);
98 matches = ismember (options.disposalmethod, 99 matches = ismember (options.disposalmethod,
99 {"donotspecify", "leaveinplace", "restorebg", "restoreprevious"}); 100 {"donotspecify", "leaveinplace", ...
101 "restorebg", "restoreprevious"});
100 if (any (! matches)) 102 if (any (! matches))
101 error ("imwrite: unknow method %s for option %s", 103 error ("imwrite: unknow method %s for option %s",
102 options.disposalmethod{find (! matches, 1)}, 104 options.disposalmethod{find (! matches, 1)},
103 param_list{idx}); 105 param_list{idx});
104 endif 106 endif
105 if (isscalar (options.disposalmethod)) 107 if (isscalar (options.disposalmethod))
106 options.disposalmethod = repmat (options.disposalmethod, 1, size (img, 4)); 108 options.disposalmethod = repmat (options.disposalmethod, ...
109 1, size (img, 4));
107 elseif (numel (options.disposalmethod) != size (img, 4)) 110 elseif (numel (options.disposalmethod) != size (img, 4))
108 error ("imwrite: if value %s is a cell array must have same length as number of frames", 111 error ("imwrite: if value %s is a cell array must have same length as number of frames",
109 param_list{idx}); 112 param_list{idx});
110 endif 113 endif
111 114