-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from openep/hotfix/v1.0.01
Hotfix/v1.0.01
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function rgb = colorspec2rgb(c) | ||
% COLORSPEC2RGB converts a colorspec to truecolor. | ||
% Usage: | ||
% rgb = colorspec2rgb(c) | ||
% Where: | ||
% c is a color - either rgb or any of the letters in 'rgbwcmyk' | ||
% | ||
% COLORSPEC2RGB converts a character colorspec into a truecolor rgb | ||
% representation. If c is not a character then it is returned as rgb - so | ||
% that it will not affect index or truecolor variables that are input. | ||
% | ||
% Author: Nick Linton (2011) | ||
% Modifications - | ||
|
||
|
||
rgbspec = [1 0 0;0 1 0;0 0 1;1 1 1;0 1 1;1 0 1;1 1 0;0 0 0]; | ||
cspec = 'rgbwcmyk'; | ||
|
||
% Deal with string color specifications. | ||
if ischar(c), | ||
k = find(cspec==c(1)); | ||
if isempty(k) | ||
error('COLORSPEC2RGB: Unknown color string.'); | ||
end | ||
if k~=3 || length(c)==1, | ||
rgb = rgbspec(k,:); | ||
elseif length(c)>2, | ||
if strcmpi(c(1:3),'bla') | ||
rgb = [0 0 0]; | ||
elseif strcmpi(c(1:3),'blu') | ||
rgb = [0 0 1]; | ||
else | ||
error('COLORSPEC2RGB: Unknown color string.'); | ||
end | ||
end | ||
elseif isreal(c) && size(c,2)==3 | ||
rgb = c; | ||
else | ||
error('COLORSPEC2RGB: Unknown color format.'); | ||
end | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|