time | calls | line |
---|
| | 1 | function adjustbackground( state, fig )
|
| | 2 | %ADJUSTBACKGROUND Modify figure to save printer toner.
|
| | 3 | % This undocumented helper function is for internal use.
|
| | 4 |
|
| | 5 | % ADJUSTBACKGROUND(STATE,FIG) modifies the color of graphics objects to
|
| | 6 | % print them on a white background (thus saving printer toner). STATE is
|
| | 7 | % either 'save' to set up colors for a white background or 'restore'. If
|
| | 8 | % the Color property of FIG is 'none', nothing is done.
|
| | 9 | %
|
| | 10 | % ADJUSTBACKGROUND(STATE) operates on the current figure.
|
| | 11 | %
|
| | 12 | % See also CONTRASTCOLORS, PRINT.
|
| | 13 |
|
| | 14 | % When printing your Figure window, it is not usually desirable to draw
|
| | 15 | % using the background color of the Figure and Axes. Dark backgrounds
|
| | 16 | % look good on screen but tend to over-saturate the output page.
|
| | 17 | % ADJUSTBACKGROUND will Change the Color, MarkerFaceColor,
|
| | 18 | % MarkerEdgeColor, FaceColor, and EdgeColor property values of all
|
| | 19 | % objects and the X, Y, and Z Colors of all Axes to black if the Figure
|
| | 20 | % and Axes are not already white. ADJUSTBACKGROUND will also restore the
|
| | 21 | % original colors of the objects with the correct input argument.
|
| | 22 |
|
| | 23 | % Copyright 1984-2014 The MathWorks, Inc.
|
| | 24 |
|
| 12 | 25 | persistent SaveTonerOriginalColors;
|
| | 26 |
|
| 12 | 27 | if nargin == 0 ...
|
| | 28 | || ~ischar( state ) ...
|
| | 29 | || ~(strcmp(state, 'save') || strcmp(state, 'restore'))
|
| | 30 | error(message('MATLAB:adjustbackground:NeedsMoreInfo'))
|
| 12 | 31 | elseif nargin ==1
|
| | 32 | fig = gcf;
|
| | 33 | end
|
| | 34 |
|
| 12 | 35 | NONE = [NaN NaN 0];
|
| 12 | 36 | FLAT = [NaN 0 NaN];
|
| 12 | 37 | BLACK = [0 0 0];
|
| 12 | 38 | WHITE = [1 1 1];
|
| | 39 |
|
| 12 | 40 | usingMATLABClasses = ~useOriginalHGPrinting(fig);
|
| 12 | 41 | if usingMATLABClasses
|
| 12 | 42 | findobjFcn = @findobjinternal;
|
| | 43 | else
|
| | 44 | findobjFcn = @findobj;
|
| | 45 | end
|
| | 46 |
|
| | 47 | % some handy indices for storage of colors within the axes
|
| 12 | 48 | AXESCOLOR_IDX = 1;
|
| 12 | 49 | AXESXCOLOR_IDX = 4; % used for Axes XColor and "other" Color
|
| 12 | 50 | AXESYCOLOR_IDX = 7; % used for Axes YColor and "other" EdgeColor
|
| 12 | 51 | AXESZCOLOR_IDX = 10; % used for Axes ZColor and "other" TextColor
|
| 12 | 52 | AXESCORECOLOREND_IDX = 12; % colors up to, but not including, grid colors
|
| 12 | 53 | GRIDCOLOR_IDX = 13;
|
| 12 | 54 | MINORGRIDCOLOR_IDX = 16;
|
| 12 | 55 | AXESCOLOR_COUNT = 18; % how many axes color values are we tracking/storing
|
| | 56 |
|
| | 57 | % indices for the storage of some axes mode properties
|
| 12 | 58 | XCOLORMODE_IDX = 1;
|
| 12 | 59 | YCOLORMODE_IDX = 2;
|
| 12 | 60 | ZCOLORMODE_IDX = 3;
|
| 12 | 61 | GRIDCOLORMODE_IDX = 4;
|
| 12 | 62 | MINORGRIDCOLORMODE_IDX = 5;
|
| 12 | 63 | AXESMODE_COUNT = 5; % how many axes modes are we tracking/storing
|
| | 64 |
|
| 12 | 65 | if strcmp( state, 'save' )
|
| | 66 |
|
| | 67 | % need to remember if using MATLAB classes
|
| 6 | 68 | storage.HGUsingMATLABClasses = usingMATLABClasses;
|
| 6 | 69 | origFigColor = get(fig,'color');
|
| 6 | 70 | saveOrigFigColor = get(fig,'color');
|
| | 71 |
|
0.01 | 6 | 72 | if isequal( get(fig,'color'), 'none')
|
| | 73 | saveOrigFigColor = [NaN NaN NaN];
|
| | 74 | end
|
| | 75 |
|
| 6 | 76 | origFigWhite = 0;
|
| 6 | 77 | if isequal(WHITE, saveOrigFigColor)
|
| | 78 | origFigWhite = 1;
|
| | 79 | end
|
| | 80 |
|
| | 81 | %Initialize all counts
|
| 6 | 82 | count.color = 0;
|
| 6 | 83 | count.facecolor = 0;
|
| 6 | 84 | count.edgecolor = 0;
|
| 6 | 85 | count.markeredgecolor = 0;
|
| 6 | 86 | count.markerfacecolor = 0;
|
| | 87 |
|
| 6 | 88 | if ~storage.HGUsingMATLABClasses
|
| | 89 | allAxes = findobjFcn(fig,'type','axes','-or','type','legend','-or','type','colorbar');
|
| | 90 | storage.colorbars = []; % colorbar is an axes, handled by axes code
|
| 6 | 91 | else
|
| | 92 | % colorbar is its own object, needs its own handling
|
0.25 | 6 | 93 | allAxes = findobjFcn(fig,'type','axes','-or','type','legend');
|
0.18 | 6 | 94 | allColorbar = findobjFcn(fig,'type','colorbar');
|
| | 95 | % one entry for each colorbar
|
| | 96 | % 1st element for the object
|
| | 97 | % next entry for color
|
| 6 | 98 | ncolorbars = length(allColorbar);
|
| 6 | 99 | storage.colorbars = repmat({[] zeros(1,1)}, ncolorbars, 1);
|
| | 100 | % store current values of colorbar Color and ColorMode
|
| 6 | 101 | for cbidx = 1:length(allColorbar)
|
| | 102 | cb = allColorbar(cbidx);
|
| | 103 | cbcolor = color2matrix(get(cb,'Color'));
|
| | 104 | storage.colorbars(cbidx,:) = {cb cbcolor};
|
| | 105 | if isequal(cbcolor, origFigColor)
|
| | 106 | setGraphicsProperty(cb, 'color' ,WHITE, ...
|
| | 107 | storage.HGUsingMATLABClasses);
|
| | 108 | elseif isequal(cbcolor, WHITE)
|
| | 109 | setGraphicsProperty(cb, 'color' ,BLACK, ...
|
| | 110 | storage.HGUsingMATLABClasses);
|
| | 111 | end
|
| | 112 | end
|
| 6 | 113 | end
|
| | 114 |
|
| | 115 | % Remove any axes objects which don't have a Color property
|
| | 116 | % since there is nothing to do for these objects anyway.
|
| 6 | 117 | for axnum = length(allAxes):-1:1
|
| 72 | 118 | if ~isprop(allAxes(axnum), 'Color');
|
| | 119 | allAxes(axnum) = [];
|
| | 120 | end
|
| 72 | 121 | end
|
| | 122 |
|
| 6 | 123 | naxes = length(allAxes);
|
| 6 | 124 | for axnum = 1:naxes
|
| 72 | 125 | a = allAxes(axnum);
|
| 72 | 126 | origAxesColor = get(a,'color');
|
0.13 | 72 | 127 | chil = allchild(a);
|
| 72 | 128 | axesVisible = strcmp(get(a,'visible'), 'on');
|
| | 129 |
|
| | 130 | % Exclude Axes labels from child because they are handled as a special
|
| | 131 | % case below since they lie outside of the axes.
|
| 72 | 132 | if ~isempty(chil)
|
2.22 | 72 | 133 | excludedH = get(a, {'xlabel';'ylabel';'zlabel';'title'});
|
0.01 | 72 | 134 | excludedH = cat(1, excludedH{:})'; % turn cell array into row vector
|
| 72 | 135 | for hLabel = excludedH
|
0.07 | 288 | 136 | chil(double(chil) == double(hLabel)) = []; % remove excluded handles
|
| 288 | 137 | end
|
| 72 | 138 | end
|
| | 139 |
|
| | 140 | %Early exit criteria
|
| 72 | 141 | if isempty(chil) || (axesVisible && isequal(origAxesColor,WHITE)) ...
|
| | 142 | || ((~axesVisible || strcmp(origAxesColor,'none')) && origFigWhite)
|
| | 143 |
|
| | 144 | % Do nothing
|
| | 145 | else
|
| | 146 | %Objects properties that are W will goto K to stay contrasting and those
|
| | 147 | % that match the ultimate background color goto W to stay invisible.
|
| | 148 | if ~axesVisible || strcmp(origAxesColor,'none')
|
| | 149 | bkgrndColor = origFigColor;
|
| | 150 | else
|
| | 151 | bkgrndColor = origAxesColor;
|
| | 152 | end
|
| | 153 |
|
| | 154 | count.color = count.color + length(findobjFcn(chil,'color',WHITE,'Visible','on'));
|
| | 155 | count.facecolor = count.facecolor + length(findobjFcn(chil,'facecolor',WHITE,'Visible','on'));
|
| | 156 | count.edgecolor = count.edgecolor + length(findobjFcn(chil,'edgecolor', WHITE,'Visible','on'));
|
| | 157 | count.markeredgecolor = count.markeredgecolor + length(findobjFcn(chil,'markeredgecolor',WHITE,'Visible','on'));
|
| | 158 | count.markerfacecolor = count.markerfacecolor + length(findobjFcn(chil,'markerfacecolor',WHITE,'Visible','on'));
|
| | 159 |
|
| | 160 | count.color = count.color + length(findobjFcn(chil,'color', bkgrndColor,'Visible','on'));
|
| | 161 | count.facecolor = count.facecolor + length(findobjFcn(chil,'facecolor', bkgrndColor,'Visible','on'));
|
| | 162 | count.edgecolor = count.edgecolor + length(findobjFcn(chil,'edgecolor', bkgrndColor,'Visible','on'));
|
| | 163 | count.markeredgecolor = count.markeredgecolor + length(findobjFcn(chil,'markeredgecolor', bkgrndColor,'Visible','on'));
|
| | 164 | count.markerfacecolor = count.markerfacecolor + length(findobjFcn(chil,'markerfacecolor', bkgrndColor,'Visible','on'));
|
| | 165 | end
|
| | 166 |
|
| | 167 | %Handle special case
|
| | 168 | %The Axes labels and title are outside the bounds of the
|
| | 169 | %Axes and therefore contrastness needs to be checked with
|
| | 170 | %the Figure.
|
0.01 | 72 | 171 | if ~origFigWhite && isprop(a, 'XLabel') && isprop(a, 'YLabel') ...
|
| | 172 | && isprop(a, 'ZLabel') && isprop(a, 'Title')
|
| | 173 | %Determine the number of labels which are white so that they
|
| | 174 | %can be changed to black before printing
|
0.14 | 72 | 175 | count.color = count.color + length( findobjFcn( ...
|
| | 176 | [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], ...
|
| | 177 | '-depth', 0, 'color', WHITE ,'Visible','on')' );
|
| | 178 | %Determine the number of labels which are the same color as the figure window
|
| | 179 | %so that they can be changed to white before printing
|
0.06 | 72 | 180 | count.color = count.color + length( findobjFcn( ...
|
| | 181 | [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], ...
|
| | 182 | '-depth', 0, 'color', origFigColor ,'Visible','on')' );
|
| 72 | 183 | end
|
| | 184 |
|
| 72 | 185 | end
|
| | 186 |
|
| | 187 | %Initialize counts based on color we now know we have to change
|
| | 188 | % 1st entry is the figure, followed by color matrix
|
| 6 | 189 | storage.figure = {fig saveOrigFigColor};
|
| | 190 |
|
| | 191 | % one entry for each axes to store color info
|
| | 192 | % 1st element for the object
|
| | 193 | % next AXESCOLOR_COUNT for various colors
|
0.01 | 6 | 194 | storage.axes = repmat({[] zeros(1,AXESCOLOR_COUNT)}, naxes, 1);
|
| | 195 | % AXESMODE_COUNT entries to hold various color modes, one row for each
|
| | 196 | % axes
|
0.02 | 6 | 197 | storage.axesModes = repmat({''}, naxes, AXESMODE_COUNT);
|
| | 198 |
|
| | 199 |
|
| | 200 | % various other objects need to have their colors adjusted
|
| | 201 | % 1st element for the object
|
| | 202 | % 2nd holds color data
|
| 6 | 203 | storage.color = repmat({[] zeros(1,3)}, count.color, 1);
|
| 6 | 204 | storage.facecolor = repmat({[] zeros(1,3)}, count.facecolor, 1);
|
| 6 | 205 | storage.edgecolor = repmat({[] zeros(1,3)}, count.edgecolor, 1);
|
| 6 | 206 | storage.markeredgecolor = repmat({[] zeros(1,3)}, count.markeredgecolor, 1);
|
| 6 | 207 | storage.markerfacecolor = repmat({[] zeros(1,3)}, count.markerfacecolor, 1);
|
| | 208 |
|
| | 209 | % the turnMe structure will hold the info on what we want to change the
|
| | 210 | % colors to
|
| 6 | 211 | turnMe.color = repmat({[] zeros(1,3)}, count.color, 1);
|
| 6 | 212 | turnMe.facecolor = repmat({[] zeros(1,3)}, count.facecolor, 1);
|
| 6 | 213 | turnMe.edgecolor = repmat({[] zeros(1,3)}, count.edgecolor, 1);
|
| 6 | 214 | turnMe.markeredgecolor = repmat({[] zeros(1,3)}, count.markeredgecolor, 1);
|
| 6 | 215 | turnMe.markerfacecolor = repmat({[] zeros(1,3)}, count.markerfacecolor, 1);
|
| | 216 |
|
| | 217 | % keep track of the "next" entry in the various arrays to use
|
| 6 | 218 | idx.color = 1;
|
| 6 | 219 | idx.facecolor = 1;
|
| 6 | 220 | idx.edgecolor = 1;
|
| 6 | 221 | idx.markeredgecolor = 1;
|
| 6 | 222 | idx.markerfacecolor = 1;
|
| | 223 |
|
| 6 | 224 | for axnum = 1:naxes
|
| 72 | 225 | a = allAxes(axnum);
|
0.10 | 72 | 226 | chil = allchild(a);
|
0.17 | 72 | 227 | thisBaselineParent = findall(a,'-property', 'BaseLine', 'ShowBaseline', 'on');
|
| 72 | 228 | if ~isempty(thisBaselineParent) && length(thisBaselineParent) > 1
|
| 24 | 229 | thisBaselineParent = thisBaselineParent(1); % there's really only one
|
| 24 | 230 | end
|
| 72 | 231 | if ~isempty(thisBaselineParent)
|
| 24 | 232 | theBaseline = get(thisBaselineParent, 'BaseLine');
|
| 24 | 233 | if ~isempty(theBaseline)
|
| 24 | 234 | chil(end+1,1) = theBaseline; %#ok<AGROW>
|
| 24 | 235 | end
|
| 24 | 236 | end
|
| | 237 |
|
| | 238 |
|
| | 239 | % Exclude Axes labels from child because they are handled as a special
|
| | 240 | % case below since they lie outside of the axes.
|
| 72 | 241 | if ~isempty(chil)
|
0.10 | 72 | 242 | excludedH = get(a, {'xlabel';'ylabel';'zlabel';'title'});
|
0.01 | 72 | 243 | excludedH = cat(1, excludedH{:})'; % turn cell array into row vector
|
| 72 | 244 | for hLabel = excludedH
|
0.05 | 288 | 245 | chil(double(chil) == double(hLabel)) = []; % remove excluded handles
|
| 288 | 246 | end
|
| 72 | 247 | end
|
| | 248 |
|
| | 249 | % initialize to prevent unexpected "undefined variable" errors
|
| 72 | 250 | axc = [];
|
| 72 | 251 | ayc = [];
|
| 72 | 252 | azc = [];
|
| 72 | 253 | axesVisible = strcmp(get(a,'visible'), 'on');
|
| 72 | 254 | origAxesColor = get(a,'color');
|
| 72 | 255 | if isprop(a, 'XColor') && isprop(a, 'YColor') && isprop(a, 'ZColor')
|
0.01 | 72 | 256 | axc = get(a,'XColor');
|
| 72 | 257 | ayc = get(a,'YColor');
|
| 72 | 258 | azc = get(a,'ZColor');
|
| 72 | 259 | if storage.HGUsingMATLABClasses
|
| 72 | 260 | axcm = get(a,'XColorMode');
|
| 72 | 261 | aycm = get(a,'YColorMode');
|
| 72 | 262 | azcm = get(a,'ZColorMode');
|
| 72 | 263 | end
|
| | 264 | elseif isprop(a, 'EdgeColor') && isprop(a, 'TextColor')
|
| | 265 | % This may be a legend or another object which doesn't have
|
| | 266 | % X/Y/Z Colors. Save the Edge & Text colors instead.
|
| | 267 | axc = get(a, 'Color');
|
| | 268 | ayc = get(a, 'EdgeColor');
|
| | 269 | azc = get(a, 'TextColor');
|
| | 270 | if storage.HGUsingMATLABClasses
|
| | 271 | axcm = get(a, 'ColorMode');
|
| | 272 | aycm = get(a, 'EdgeColorMode');
|
| | 273 | azcm = get(a, 'TextColorMode');
|
| | 274 | end
|
| | 275 | end
|
| | 276 |
|
| | 277 | % if there weren't any colors to store, don't try to store them
|
| 72 | 278 | if ~isempty([axc ayc azc])
|
0.01 | 72 | 279 | aXYZc = [color2matrix(axc) color2matrix(ayc) color2matrix(azc)];
|
| 72 | 280 | storage.axes{axnum, 1} = a;
|
| 72 | 281 | storage.axes{axnum, 2}(1:AXESCORECOLOREND_IDX) = [color2matrix(origAxesColor) aXYZc];
|
| 72 | 282 | if storage.HGUsingMATLABClasses
|
| 72 | 283 | storage.axesModes(axnum,XCOLORMODE_IDX:ZCOLORMODE_IDX) = {axcm aycm azcm};
|
| 72 | 284 | end
|
| 72 | 285 | end
|
| | 286 |
|
| 72 | 287 | if isa(a, 'matlab.graphics.axis.Axes')
|
| | 288 | % store grid color info
|
| 72 | 289 | storage.axes{axnum, 2}(GRIDCOLOR_IDX:GRIDCOLOR_IDX + 2) = color2matrix(a.GridColor);
|
| 72 | 290 | storage.axes{axnum, 2}(MINORGRIDCOLOR_IDX:MINORGRIDCOLOR_IDX + 2) = color2matrix(a.MinorGridColor);
|
| 72 | 291 | storage.axesModes{axnum, GRIDCOLORMODE_IDX} = a.GridColorMode;
|
| 72 | 292 | storage.axesModes{axnum, MINORGRIDCOLORMODE_IDX} = a.MinorGridColorMode;
|
| 72 | 293 | end
|
| | 294 |
|
| | 295 |
|
| 72 | 296 | if ~axesVisible || strcmp(origAxesColor,'none')
|
| | 297 | bkgrndColor = origFigColor;
|
| 72 | 298 | else
|
| 72 | 299 | bkgrndColor = origAxesColor;
|
| 72 | 300 | end
|
| | 301 |
|
| | 302 | %Early exit criteria
|
| 72 | 303 | if (axesVisible && isequal(origAxesColor,WHITE)) ...
|
| | 304 | || ((~axesVisible || strcmp(origAxesColor,'none')) && origFigWhite)
|
| | 305 |
|
| | 306 | % Do nothing
|
| | 307 | else
|
| | 308 | %Objects properties that are W will goto K to stay contrasting and those
|
| | 309 | % that match the ultimate background color goto W to stay invisible.
|
| | 310 |
|
| | 311 | if (~strcmp(origAxesColor, 'none'))
|
| | 312 | setGraphicsProperty(a, 'color', WHITE, ...
|
| | 313 | storage.HGUsingMATLABClasses)
|
| | 314 | end
|
| | 315 |
|
| | 316 | for obj = findobjFcn(chil,'color',WHITE,'Visible','on')'
|
| | 317 | storage.color(idx.color,:) = {obj WHITE};
|
| | 318 | turnMe.color(idx.color,:) = {obj BLACK};
|
| | 319 | idx.color = idx.color + 1;
|
| | 320 | end
|
| | 321 |
|
| | 322 | for obj = findobjFcn(chil,'color', bkgrndColor,'Visible','on')'
|
| | 323 | storage.color(idx.color,:) = {obj bkgrndColor};
|
| | 324 | turnMe.color(idx.color,:) = {obj WHITE};
|
| | 325 | idx.color = idx.color + 1;
|
| | 326 | end
|
| | 327 |
|
| | 328 | %Face and Edge colors need to be considered together
|
| | 329 | for obj = findobjFcn(chil,'type','surface','-or', ...
|
| | 330 | 'type','patch', '-or', ...
|
| | 331 | 'type','rectangle', '-or', ...
|
| | 332 | 'type','area', '-or', ...
|
| | 333 | 'type','bar', '-or', ...
|
| | 334 | 'type','ellipseshape', ...
|
| | 335 | 'Visible','on')';
|
| | 336 | fc = get(obj,'facecolor');
|
| | 337 | ec = get(obj,'edgecolor');
|
| | 338 | if isequal( fc, bkgrndColor )
|
| | 339 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 340 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, WHITE, storage, turnMe, idx );
|
| | 341 | else [storage, turnMe, idx] = setfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
|
| | 342 | end
|
| | 343 |
|
| | 344 | elseif isequal( fc, WHITE )
|
| | 345 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, BLACK, BLACK, storage, turnMe, idx );
|
| | 346 | elseif isequal( ec, 'none' ), [storage, turnMe, idx] = setfaceedge( obj, BLACK, NaN, storage, turnMe, idx );
|
| | 347 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 348 | end
|
| | 349 |
|
| | 350 | elseif isequal( fc, BLACK )
|
| | 351 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 352 | elseif isequal( ec, 'flat' ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
|
| | 353 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 354 | end
|
| | 355 |
|
| | 356 | elseif isequal( fc, 'none' )
|
| | 357 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 358 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
|
| | 359 | end
|
| | 360 |
|
| | 361 | else %Face is 'flat' or RGB triplet
|
| | 362 | if isequal( ec, WHITE ) || isequal( ec, bkgrndColor )
|
| | 363 | [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 364 | end
|
| | 365 |
|
| | 366 | end
|
| | 367 | end %face and edgecolor loop
|
| | 368 |
|
| | 369 | %Marker Face and Edge colors also need to be considered together
|
| | 370 | for obj = findobjFcn(chil,'type','line', '-or', ...
|
| | 371 | '-isa', 'hg2sample.ScopeLineAnimator', '-or', ...
|
| | 372 | '-isa', 'hg2sample.ScopeStairAnimator', '-or', ...
|
| | 373 | '-isa', 'matlab.graphics.animation.ScopeLineAnimator', '-or', ...
|
| | 374 | '-isa', 'matlab.graphics.animation.ScopeStairAnimator', '-or', ...
|
| | 375 | 'type','surface', '-or', ...
|
| | 376 | 'type','patch', '-or', ...
|
| | 377 | 'type', 'errorbar', '-or', ...
|
| | 378 | 'type', 'quiver', '-or', ...
|
| | 379 | 'type', 'scatter', '-or', ...
|
| | 380 | 'type', 'stair', '-or', ...
|
| | 381 | 'type', 'stem', ...
|
| | 382 | 'Visible','on')';
|
| | 383 | fc = get(obj,'markerfacecolor');
|
| | 384 | ec = get(obj,'markeredgecolor');
|
| | 385 | if isequal( fc, bkgrndColor )
|
| | 386 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 387 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, WHITE, storage, turnMe, idx );
|
| | 388 | else [storage, turnMe, idx] = setmfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
|
| | 389 | end
|
| | 390 |
|
| | 391 | elseif isequal( fc, WHITE )
|
| | 392 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, BLACK, BLACK, storage, turnMe, idx );
|
| | 393 | elseif isequal( ec, 'none' ), [storage, turnMe, idx] = setmfaceedge( obj, BLACK, NaN, storage, turnMe, idx );
|
| | 394 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 395 | end
|
| | 396 |
|
| | 397 | elseif isequal( fc, BLACK )
|
| | 398 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 399 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
|
| | 400 | end
|
| | 401 |
|
| | 402 | elseif isequal( fc, 'none' )
|
| | 403 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 404 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
|
| | 405 | end
|
| | 406 |
|
| | 407 | else %Face is RGB triplet
|
| | 408 | if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
|
| | 409 | elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
|
| | 410 | end
|
| | 411 |
|
| | 412 | end
|
| | 413 | end %marker face and edge color loop
|
| | 414 | end
|
| | 415 |
|
| | 416 | %Handle special case #2
|
| | 417 | %The Axes labels and title are outside the bounds of the
|
| | 418 | %Axes and therefore contrastness needs to be checked with
|
| | 419 | %the Figure.
|
| 72 | 420 | if ~origFigWhite && isprop(a, 'XLabel') && isprop(a, 'YLabel') ...
|
| | 421 | && isprop(a, 'ZLabel') && isprop(a, 'Title')
|
| | 422 | %The labels that are white need to be set to black before printing.
|
| | 423 | %After printing they need to be set back to their original color, white.
|
0.14 | 72 | 424 | for obj = findobjFcn( [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], '-depth', 0, 'color', WHITE ,'Visible','on')'
|
| | 425 | storage.color(idx.color,:) = {obj WHITE};
|
| | 426 | turnMe.color(idx.color,:) = {obj BLACK};
|
| | 427 | idx.color = idx.color + 1;
|
| | 428 | end
|
| | 429 |
|
| | 430 | %The labels that are the same color as the Figure Window need to be
|
| | 431 | %set to white before printing. These labels don't appear on screen
|
| | 432 | %and should not appear on the printout.
|
0.11 | 72 | 433 | for obj = findobjFcn( [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], '-depth', 0, 'color', origFigColor ,'Visible','on')'
|
| | 434 | storage.color(idx.color,:) = {obj origFigColor};
|
| | 435 | turnMe.color(idx.color,:) = {obj WHITE};
|
| | 436 | idx.color = idx.color + 1;
|
| | 437 | end
|
| 72 | 438 | end
|
| | 439 |
|
| 72 | 440 | end %for each Axes
|
| | 441 |
|
| | 442 | %Sets color for printing
|
| 6 | 443 | for k = 1:count.color
|
| | 444 | if ~islight(turnMe.color{k,1})
|
| | 445 | setGraphicsProperty(turnMe.color{k,1}, 'color', ...
|
| | 446 | turnMe.color{k,2,:}, storage.HGUsingMATLABClasses);
|
| | 447 | end
|
| | 448 | end
|
| | 449 |
|
| | 450 | % Adjust the axes object's XColor, YColor, and ZColor
|
| | 451 | % as well as the GridColor and MinorGridColor
|
| | 452 | % When setting axis color, make sure label isn't affected.
|
| | 453 | % This needs to occur after the label colors are set otherwise in
|
| | 454 | % some cases the axis color will reset the label color incorrectly.
|
| | 455 |
|
| | 456 | % A FOR loop is necessary so that all WHITEBG subplots are updated
|
| | 457 | % correctly.
|
| | 458 |
|
| 6 | 459 | for axnum = 1:naxes
|
| 72 | 460 | a = allAxes(axnum);
|
| 72 | 461 | if isprop(a, 'XColor') && isprop(a, 'YColor') && ...
|
| | 462 | isprop(a, 'ZColor') && isprop(a, 'XLabel') && ...
|
| | 463 | isprop(a, 'YLabel') && isprop(a, 'ZLabel')
|
| 72 | 464 | axc = get(a,'xcolor');
|
| 72 | 465 | ayc = get(a,'ycolor');
|
0.02 | 72 | 466 | azc = get(a,'zcolor');
|
| | 467 |
|
0.03 | 72 | 468 | labelH = get(a,'xlabel');
|
| 72 | 469 | labelColor = get(labelH,'color');
|
| 72 | 470 | if (isequal(axc,origFigColor))
|
| | 471 | setGraphicsProperty(a, 'xcolor', WHITE, ...
|
| | 472 | storage.HGUsingMATLABClasses)
|
| 72 | 473 | elseif (isequal(axc,WHITE))
|
| | 474 | setGraphicsProperty(a, 'xcolor', BLACK, ...
|
| | 475 | storage.HGUsingMATLABClasses)
|
| | 476 | end
|
| 72 | 477 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 478 | storage.HGUsingMATLABClasses)
|
| | 479 |
|
0.02 | 72 | 480 | labelH = get(a,'ylabel');
|
| 72 | 481 | labelColor = get(labelH,'color');
|
| 72 | 482 | if (isequal(ayc,origFigColor))
|
| | 483 | setGraphicsProperty(a, 'ycolor' ,WHITE, ...
|
| | 484 | storage.HGUsingMATLABClasses)
|
| 72 | 485 | elseif (isequal(ayc,WHITE))
|
| | 486 | setGraphicsProperty(a, 'ycolor' ,BLACK, ...
|
| | 487 | storage.HGUsingMATLABClasses)
|
| | 488 | end
|
| 72 | 489 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 490 | storage.HGUsingMATLABClasses)
|
| | 491 |
|
0.03 | 72 | 492 | labelH = get(a,'zlabel');
|
| 72 | 493 | if ~isempty( labelH )
|
| 72 | 494 | labelColor = get(labelH,'color');
|
| 72 | 495 | if (isequal(azc,origFigColor))
|
| | 496 | setGraphicsProperty(a, 'zcolor', WHITE, ...
|
| | 497 | storage.HGUsingMATLABClasses)
|
| 72 | 498 | elseif (isequal(azc,WHITE))
|
| | 499 | setGraphicsProperty(a, 'zcolor', BLACK, ...
|
| | 500 | storage.HGUsingMATLABClasses)
|
| | 501 | end
|
| 72 | 502 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 503 | storage.HGUsingMATLABClasses)
|
| 72 | 504 | end
|
| | 505 | elseif isprop(a, 'TextColor') && isprop(a, 'EdgeColor')
|
| | 506 | textColor = get(a, 'TextColor');
|
| | 507 | if (isequal(textColor, origFigColor))
|
| | 508 | setGraphicsProperty(a, 'TextColor', WHITE, ...
|
| | 509 | storage.HGUsingMATLABClasses)
|
| | 510 | elseif (isequal(textColor, WHITE))
|
| | 511 | setGraphicsProperty(a, 'TextColor', BLACK, ...
|
| | 512 | storage.HGUsingMATLABClasses)
|
| | 513 | end
|
| | 514 |
|
| | 515 | edgeColor = get(a, 'EdgeColor');
|
| | 516 | if (isequal(edgeColor, origFigColor))
|
| | 517 | setGraphicsProperty(a, 'EdgeColor', WHITE, ...
|
| | 518 | storage.HGUsingMATLABClasses)
|
| | 519 | elseif (isequal(edgeColor, WHITE))
|
| | 520 | setGraphicsProperty(a, 'EdgeColor', BLACK, ...
|
| | 521 | storage.HGUsingMATLABClasses)
|
| | 522 | end
|
| | 523 | end
|
| | 524 |
|
| 72 | 525 | if isa(a, 'matlab.graphics.axis.Axes')
|
| 72 | 526 | gridc = a.GridColor;
|
| 72 | 527 | minorgridc = a.MinorGridColor;
|
| 72 | 528 | if (isequal(gridc,bkgrndColor))
|
| | 529 | a.GridColor = WHITE;
|
| 72 | 530 | elseif (isequal(gridc,WHITE))
|
| | 531 | a.GridColor = BLACK;
|
| | 532 | end
|
| 72 | 533 | if (isequal(minorgridc,bkgrndColor))
|
| | 534 | a.MinorGridColor = WHITE;
|
| 72 | 535 | elseif (isequal(minorgridc,WHITE))
|
| | 536 | a.MinorGridColor = BLACK;
|
| | 537 | end
|
| 72 | 538 | end
|
| 72 | 539 | end
|
| | 540 |
|
| | 541 | %Face and Edge color matrices may not be fully filled out
|
| 6 | 542 | used = [];
|
| 6 | 543 | if count.facecolor > 0
|
| | 544 | used = 1 : count.facecolor;
|
| | 545 | used(cellfun('isempty', turnMe.facecolor(:,1))) = [];
|
| | 546 | end
|
| 6 | 547 | if ~isempty( used )
|
| | 548 | storage.facecolor(used(end)+1:end,:) = [];
|
| | 549 | for k = used
|
| | 550 | setGraphicsProperty(turnMe.facecolor{k,1}, 'facecolor', ...
|
| | 551 | turnMe.facecolor{k,2}, storage.HGUsingMATLABClasses);
|
| | 552 | end
|
| 6 | 553 | else
|
0.01 | 6 | 554 | storage.facecolor = {};
|
| 6 | 555 | end
|
| | 556 |
|
| 6 | 557 | used = [];
|
| 6 | 558 | if count.edgecolor > 0
|
| | 559 | used = 1 : count.edgecolor;
|
| | 560 | used(cellfun('isempty', turnMe.edgecolor(:,1))) = [];
|
| | 561 | end
|
| 6 | 562 | if ~isempty( used )
|
| | 563 | storage.edgecolor(used(end)+1:end,:) = [];
|
| | 564 | for k = used
|
| | 565 | setGraphicsProperty(turnMe.edgecolor{k,1}, 'edgecolor', ...
|
| | 566 | turnMe.edgecolor{k,2}, storage.HGUsingMATLABClasses);
|
| | 567 | end
|
| 6 | 568 | else
|
| 6 | 569 | storage.edgecolor = {};
|
| 6 | 570 | end
|
| | 571 |
|
| | 572 | %Marker Face and Edge color matrices may not be fully filled out
|
| 6 | 573 | used = [];
|
| 6 | 574 | if count.markerfacecolor > 0
|
| | 575 | used = 1 : count.markerfacecolor;
|
| | 576 | used(cellfun('isempty', turnMe.markerfacecolor(:,1))) = [];
|
| | 577 | end
|
| 6 | 578 | if ~isempty( used )
|
| | 579 | storage.markerfacecolor(used(end)+1:end,:) = [];
|
| | 580 | for k = used
|
| | 581 | setGraphicsProperty(turnMe.markerfacecolor{k,1}, ...
|
| | 582 | 'markerfacecolor', turnMe.markerfacecolor{k,2}, ...
|
| | 583 | storage.HGUsingMATLABClasses);
|
| | 584 | end
|
| 6 | 585 | else
|
| 6 | 586 | storage.markerfacecolor = {};
|
| 6 | 587 | end
|
| | 588 |
|
| 6 | 589 | used = [];
|
| 6 | 590 | if count.markeredgecolor > 0
|
| | 591 | used = 1 : count.markeredgecolor;
|
| | 592 | used(cellfun('isempty', turnMe.markeredgecolor(:,1))) = [];
|
| | 593 | end
|
| 6 | 594 | if ~isempty( used )
|
| | 595 | storage.markeredgecolor(used(end)+1:end,:) = [];
|
| | 596 | for k = used
|
| | 597 | setGraphicsProperty(turnMe.markeredgecolor{k,1}, ...
|
| | 598 | 'markeredgecolor', turnMe.markeredgecolor{k,2}, ...
|
| | 599 | storage.HGUsingMATLABClasses);
|
| | 600 | end
|
| 6 | 601 | else
|
| 6 | 602 | storage.markeredgecolor = {};
|
| 6 | 603 | end
|
| | 604 |
|
| | 605 | % It might become important that this is LAST
|
| 6 | 606 | setGraphicsProperty(fig, 'color', WHITE, storage.HGUsingMATLABClasses);
|
| | 607 |
|
| 6 | 608 | SaveTonerOriginalColors = [storage SaveTonerOriginalColors];
|
| | 609 |
|
| 6 | 610 | else % Restore colors
|
| | 611 |
|
| 6 | 612 | storage = SaveTonerOriginalColors(1);
|
| 6 | 613 | SaveTonerOriginalColors = SaveTonerOriginalColors(2:end);
|
| 6 | 614 | origFig = storage.figure{1};
|
| 6 | 615 | if storage.HGUsingMATLABClasses ~= ~useOriginalHGPrinting(origFig)
|
| | 616 | error(message('MATLAB:adjustbackground:InconsistentClasses'))
|
| | 617 | end
|
| 6 | 618 | origFigColor = storage.figure{2};
|
| 6 | 619 | if (sum(isnan(origFigColor)) == 3)
|
| | 620 | origFigColor = 'none';
|
| | 621 | end
|
| 6 | 622 | setGraphicsProperty(origFig, 'color', origFigColor, ...
|
| | 623 | storage.HGUsingMATLABClasses);
|
| | 624 |
|
| 6 | 625 | for k = 1:size(storage.axes,1)
|
0.01 | 72 | 626 | if isempty(storage.axes{k})
|
| | 627 | continue; % nothing to do
|
| | 628 | end
|
| 72 | 629 | a = storage.axes{k,1};
|
0.01 | 72 | 630 | setGraphicsProperty(a, 'color', matrix2color(storage.axes{k,2}(AXESCOLOR_IDX:AXESCOLOR_IDX+2)), ...
|
| | 631 | storage.HGUsingMATLABClasses)
|
| | 632 |
|
0.01 | 72 | 633 | if isprop(a, 'XLabel') && isprop(a, 'YLabel') ...
|
| | 634 | && isprop(a, 'ZLabel')
|
| | 635 | %When setting axis color, make sure label isn't affected.
|
1.15 | 72 | 636 | labelH = get(a,'xlabel');
|
0.02 | 72 | 637 | labelColor = get(labelH,'color');
|
| 72 | 638 | setGraphicsProperty(a, 'xcolor', matrix2color(storage.axes{k,2}(AXESXCOLOR_IDX:AXESXCOLOR_IDX+2)), ...
|
| | 639 | storage.HGUsingMATLABClasses)
|
| | 640 |
|
| 72 | 641 | if storage.HGUsingMATLABClasses
|
0.03 | 72 | 642 | setGraphicsProperty(a, 'XColorMode', storage.axesModes{k,XCOLORMODE_IDX}, ...
|
| | 643 | storage.HGUsingMATLABClasses)
|
| 72 | 644 | end
|
| | 645 |
|
0.01 | 72 | 646 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 647 | storage.HGUsingMATLABClasses)
|
| | 648 |
|
0.02 | 72 | 649 | labelH = get(a,'ylabel');
|
| 72 | 650 | labelColor = get(labelH,'color');
|
| 72 | 651 | setGraphicsProperty(a, 'ycolor', matrix2color(storage.axes{k,2}(AXESYCOLOR_IDX:AXESYCOLOR_IDX+2)), ...
|
| | 652 | storage.HGUsingMATLABClasses)
|
| | 653 |
|
| 72 | 654 | if storage.HGUsingMATLABClasses
|
| 72 | 655 | setGraphicsProperty(a, 'YColorMode', storage.axesModes{k,YCOLORMODE_IDX}, ...
|
| | 656 | storage.HGUsingMATLABClasses)
|
| 72 | 657 | end
|
| | 658 |
|
| 72 | 659 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 660 | storage.HGUsingMATLABClasses)
|
| | 661 |
|
0.01 | 72 | 662 | if ~isempty( get(a,'zlabel') )
|
0.01 | 72 | 663 | labelH = get(a,'zlabel');
|
| 72 | 664 | labelColor = get(labelH,'color');
|
| 72 | 665 | setGraphicsProperty(a, 'zcolor', matrix2color(storage.axes{k,2}(AXESZCOLOR_IDX:AXESZCOLOR_IDX+2)), ...
|
| | 666 | storage.HGUsingMATLABClasses)
|
| | 667 |
|
| 72 | 668 | if storage.HGUsingMATLABClasses
|
0.05 | 72 | 669 | setGraphicsProperty(a, 'ZColorMode', storage.axesModes{k,ZCOLORMODE_IDX}, ...
|
| | 670 | storage.HGUsingMATLABClasses)
|
| 72 | 671 | end
|
| | 672 |
|
| 72 | 673 | setGraphicsProperty(labelH, 'color', labelColor, ...
|
| | 674 | storage.HGUsingMATLABClasses)
|
| 72 | 675 | end
|
| | 676 | elseif isprop(a, 'TextColor') && isprop(a, 'EdgeColor')
|
| | 677 | setGraphicsProperty(a, 'Color', matrix2color(storage.axes{k,2}(AXESXCOLOR_IDX:AXESXCOLOR_IDX+2)), ...
|
| | 678 | storage.HGUsingMATLABClasses)
|
| | 679 | setGraphicsProperty(a, 'EdgeColor', matrix2color(storage.axes{k,2}(AXESYCOLOR_IDX:AXESYCOLOR_IDX+2)), ...
|
| | 680 | storage.HGUsingMATLABClasses)
|
| | 681 | setGraphicsProperty(a, 'TextColor', matrix2color(storage.axes{k,2}(AXESZCOLOR_IDX:AXESZCOLOR_IDX+2)), ...
|
| | 682 | storage.HGUsingMATLABClasses)
|
| | 683 | end
|
| | 684 |
|
| 72 | 685 | if isa(a, 'matlab.graphics.axis.Axes')
|
| 72 | 686 | a.GridColor = matrix2color(storage.axes{k,2}(GRIDCOLOR_IDX:GRIDCOLOR_IDX+2));
|
| 72 | 687 | a.MinorGridColor = matrix2color(storage.axes{k,2}(MINORGRIDCOLOR_IDX:MINORGRIDCOLOR_IDX+2));
|
| 72 | 688 | a.GridColorMode = storage.axesModes{k,GRIDCOLORMODE_IDX};
|
| 72 | 689 | a.MinorGridColorMode = storage.axesModes{k,MINORGRIDCOLORMODE_IDX};
|
| 72 | 690 | end
|
| 72 | 691 | end
|
| | 692 |
|
| 6 | 693 | for k = 1:size(storage.color,1)
|
| | 694 | obj = storage.color{k,1};
|
| | 695 | setGraphicsProperty(obj, 'color', ...
|
| | 696 | matrix2color(storage.color{k,2}), storage.HGUsingMATLABClasses)
|
| | 697 | end
|
| | 698 |
|
| 6 | 699 | for k = 1:size(storage.facecolor,1)
|
| | 700 | obj = storage.facecolor{k,1};
|
| | 701 | setGraphicsProperty(obj, 'facecolor', ...
|
| | 702 | matrix2color(storage.facecolor{k,2}), ...
|
| | 703 | storage.HGUsingMATLABClasses)
|
| | 704 | end
|
| | 705 |
|
| 6 | 706 | for k = 1:size(storage.edgecolor,1)
|
| | 707 | obj = storage.edgecolor{k,1};
|
| | 708 | setGraphicsProperty(obj, 'edgecolor', ...
|
| | 709 | matrix2color(storage.edgecolor{k,2}), ...
|
| | 710 | storage.HGUsingMATLABClasses)
|
| | 711 | end
|
| | 712 |
|
| 6 | 713 | for k = 1:size(storage.markeredgecolor,1)
|
| | 714 | obj = storage.markeredgecolor{k,1};
|
| | 715 | setGraphicsProperty(obj, 'markeredgecolor', ...
|
| | 716 | matrix2color(storage.markeredgecolor{k,2}), ...
|
| | 717 | storage.HGUsingMATLABClasses)
|
| | 718 | end
|
| | 719 |
|
| 6 | 720 | for k = 1:size(storage.markerfacecolor,1)
|
| | 721 | obj = storage.markerfacecolor{k,1};
|
| | 722 | setGraphicsProperty(obj, 'markerfacecolor', ...
|
| | 723 | matrix2color(storage.markerfacecolor{k,2}), ...
|
| | 724 | storage.HGUsingMATLABClasses)
|
| | 725 | end
|
| | 726 |
|
| 6 | 727 | if storage.HGUsingMATLABClasses
|
| | 728 | % restore colorbar color
|
| 6 | 729 | for k = 1:size(storage.colorbars, 1)
|
| | 730 | obj = storage.colorbars{k,1};
|
| | 731 | setGraphicsProperty(obj, 'Color' , ...
|
| | 732 | matrix2color(storage.colorbars{k,2}), ...
|
| | 733 | storage.HGUsingMATLABClasses);
|
| | 734 | end
|
| 6 | 735 | end
|
| | 736 |
|
| 6 | 737 | end
|
| | 738 |
|
| | 739 | %%%%%%%% nested functions
|
| | 740 | %-------------------
|
| | 741 | function [storage, turnMe, idx] = setfaceedge( obj, newFace, newEdge, storage, turnMe, idx )
|
| | 742 | %SETFACEEDGE Set both FaceColor and EdgeColor and update structures
|
| | 743 |
|
| | 744 | if ~isnan(newFace)
|
| | 745 | storage.facecolor(idx.facecolor,:) = {obj color2matrix(get(obj,'facecolor')) };
|
| | 746 | turnMe.facecolor(idx.facecolor,:) = {obj newFace};
|
| | 747 | idx.facecolor = idx.facecolor + 1;
|
| | 748 | end
|
| | 749 |
|
| | 750 | if ~isnan(newEdge)
|
| | 751 | storage.edgecolor(idx.edgecolor,:) = {obj color2matrix(get(obj,'edgecolor')) };
|
| | 752 | turnMe.edgecolor(idx.edgecolor,:) = {obj newEdge};
|
| | 753 | idx.edgecolor = idx.edgecolor + 1;
|
| | 754 | end
|
| | 755 | end
|
| | 756 |
|
| | 757 | %-------------------
|
| | 758 | function [storage, turnMe, idx] = setmfaceedge( obj, newFace, newEdge, storage, turnMe, idx )
|
| | 759 | %SETMFACEEDGE Set both MarkerFaceColor and MarkerEdgeColor and update structures
|
| | 760 |
|
| | 761 | if ~isnan(newFace)
|
| | 762 | storage.markerfacecolor(idx.markerfacecolor,:) = {obj color2matrix(get(obj,'markerfacecolor')) };
|
| | 763 | turnMe.markerfacecolor(idx.markerfacecolor,:) = {obj newFace};
|
| | 764 | idx.markerfacecolor = idx.markerfacecolor + 1;
|
| | 765 | end
|
| | 766 |
|
| | 767 | if ~isnan(newEdge)
|
| | 768 | storage.markeredgecolor(idx.markeredgecolor,:) = {obj color2matrix(get(obj,'markeredgecolor')) };
|
| | 769 | turnMe.markeredgecolor(idx.markeredgecolor,:) = {obj newEdge};
|
| | 770 | idx.markeredgecolor = idx.markeredgecolor + 1;
|
| | 771 | end
|
| | 772 | end
|
| | 773 |
|
| | 774 | %-------------------
|
| | 775 | function color = color2matrix( color )
|
| | 776 | %COLOR2MATRIX Return a 1x3 for any color, including strings 'flat' and 'none'
|
| | 777 |
|
| | 778 | if isequal(color, 'none' )
|
| | 779 | color = NONE;
|
| | 780 |
|
| | 781 | elseif isequal(color, 'flat' )
|
| | 782 | color = FLAT;
|
| | 783 |
|
| | 784 | end
|
| | 785 | end
|
| | 786 |
|
| | 787 | %-------------------
|
| | 788 | function color = matrix2color( color )
|
| | 789 | %MATRIX2COLOR Return a Color-spec for any a 1x3, possibly encoded for 'flat' and 'none'.
|
| | 790 |
|
| | 791 | if isequal(isnan(color), isnan(NONE) )
|
| | 792 | color = 'none';
|
| | 793 |
|
| | 794 | elseif isequal(isnan(color), isnan(FLAT) )
|
| | 795 | color = 'flat';
|
| | 796 |
|
| | 797 | end
|
| | 798 | end
|
| | 799 |
|
| | 800 | %%%%%%%% end nested functions
|
| 12 | 801 | end
|
Other subfunctions in this file are not included in this listing.