This is a static copy of a profile reportHome
savtoner (80 calls, 2.820 sec)
Generated 05-Aug-2011 13:00:37 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/graphics/savtoner.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
75 | chil = allchild(a); | 304 | 1.060 s | 37.6% |  |
455 | labelH = get(a,'xlabel'); | 304 | 0.601 s | 21.3% |  |
312 | for obj = findobjFcn( [get(a,'... | 304 | 0.087 s | 3.1% |  |
303 | for obj = findobjFcn( [get(a,'... | 304 | 0.087 s | 3.1% |  |
129 | count.color = count.color + le... | 304 | 0.077 s | 2.7% |  |
All other lines | | | 0.907 s | 32.2% |  |
Totals | | | 2.820 s | 100% | |
Children (called functions)
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 567 |
Non-code lines (comments, blank lines) | 236 |
Code lines (lines that can run) | 331 |
Code lines that did run | 191 |
Code lines that did not run | 140 |
Coverage (did run/can run) | 57.70 % |
Function listing
time calls line
1 function savtoner( state, fig )
2 %SAVTONER Modify figure to save printer toner.
3 % SAVTONER(STATE,FIG) modifies the color of graphics objects to print
4 % them on a white background (thus saving printer toner). STATE is
5 % either 'save' to set up colors for a white background or 'restore'.
6 % If the Color property of FIG is 'none', nothing is done.
7 %
8 % SAVTONER(STATE) operates on the current figure.
9 %
10 % See also NODITHER, PRINT.
11
12 % When printing your Figure window, it is not usually dersirable
13 % to draw using the background color of the Figure and Axes. Dark
14 % backgrounds look good on screen but tend to over-saturate the
15 % output page. SAVTONER will Change the Color, MarkerFaceColor,
16 % MarkerEdgeColor, FaceColor, and EdgeColor property values of all
17 % objects and the X, Y, and Z Colors of all Axes to black if the
18 % Figure and Axes are not already white. SAVTONER will also restore
19 % the original colors of the objects with the correct input argument.
20
21 % Copyright 1984-2009 The MathWorks, Inc.
22 % $Revision: 1.46.4.7 $ $Date: 2009/07/03 14:31:11 $
23
80 24 persistent SaveTonerOriginalColors;
25
80 26 if nargin == 0 ...
27 || ~ischar( state ) ...
28 || ~(strcmp(state, 'save') || strcmp(state, 'restore'))
29 error('MATLAB:savtoner:NeedsMoreInfo', 'SAVTONER needs to know if it should ''save'' or ''restore''')
80 30 elseif nargin ==1
31 fig = gcf;
32 end
33
80 34 NONE = [NaN NaN 0];
80 35 FLAT = [NaN 0 NaN];
80 36 BLACK = [0 0 0];
80 37 WHITE = [1 1 1];
38
80 39 usingMATLABClasses = feature('HGUsingMATLABClasses');
80 40 if usingMATLABClasses
41 findobjFcn = @findobjinternal;
80 42 else
80 43 findobjFcn = @findobj;
80 44 end
45
80 46 if strcmp( state, 'save' )
47
48 % need to remember if using MATLAB classes
40 49 storage.HGUsingMATLABClasses = usingMATLABClasses;
50
40 51 origFigColor = get(fig,'color');
40 52 saveOrigFigColor = get(fig,'color');
53
40 54 if isequal( get(fig,'color'), 'none')
55 saveOrigFigColor = [NaN NaN NaN];
56 end
57
40 58 origFigWhite = 0;
40 59 if isequal(WHITE, saveOrigFigColor)
60 origFigWhite = 1;
61 end
62
63 %Initialize all counts
40 64 count.color = 0;
40 65 count.facecolor = 0;
40 66 count.edgecolor = 0;
40 67 count.markeredgecolor = 0;
40 68 count.markerfacecolor = 0;
69
0.05 40 70 allAxes = findobjFcn(fig,'type','axes');
40 71 naxes = length(allAxes);
40 72 for axnum = 1:naxes
0.01 304 73 a = allAxes(axnum);
304 74 origAxesColor = get(a,'color');
1.06 304 75 chil = allchild(a);
0.01 304 76 axesVisible = strcmp(get(a,'visible'), 'on');
77
78 % Exclude Axes labels from chil because they are handled as a special
79 % case below since they lie outside of the axes.
304 80 if ~isempty(chil)
0.01 304 81 excludedH = get(a, {'xlabel';'ylabel';'zlabel';'title'});
0.01 304 82 excludedH = cat(1, excludedH{:})'; % turn cell array into row vector
304 83 for hLabel = excludedH
0.02 1216 84 chil(double(chil) == double(hLabel)) = []; % remove excluded handles
1216 85 end
0.03 304 86 end
87
88 %Early exit criteria
304 89 if isempty(chil) || (axesVisible && isequal(origAxesColor,WHITE)) ...
90 || ((~axesVisible || strcmp(origAxesColor,'none')) && origFigWhite)
91
92 % Do nothing
40 93 else
94 %Objects properties that are W will goto K to stay contrasting and those
95 % that match the ultimate background color goto W to stay invisible.
40 96 if ~axesVisible || strcmp(origAxesColor,'none')
40 97 bkgrndColor = origFigColor;
98 else
99 bkgrndColor = origAxesColor;
100 end
101
0.02 40 102 count.color = count.color + length(findobjFcn(chil,'color',WHITE,'Visible','on'));
0.01 40 103 count.facecolor = count.facecolor + length(findobjFcn(chil,'facecolor',WHITE,'Visible','on'));
0.02 40 104 count.edgecolor = count.edgecolor + length(findobjFcn(chil,'edgecolor', WHITE,'Visible','on'));
0.01 40 105 count.markeredgecolor = count.markeredgecolor + length(findobjFcn(chil,'markeredgecolor',WHITE,'Visible','on'));
40 106 count.markerfacecolor = count.markerfacecolor + length(findobjFcn(chil,'markerfacecolor',WHITE,'Visible','on'));
107
0.01 40 108 count.color = count.color + length(findobjFcn(chil,'color', bkgrndColor,'Visible','on'));
0.01 40 109 count.facecolor = count.facecolor + length(findobjFcn(chil,'facecolor', bkgrndColor,'Visible','on'));
40 110 count.edgecolor = count.edgecolor + length(findobjFcn(chil,'edgecolor', bkgrndColor,'Visible','on'));
0.01 40 111 count.markeredgecolor = count.markeredgecolor + length(findobjFcn(chil,'markeredgecolor', bkgrndColor,'Visible','on'));
0.02 40 112 count.markerfacecolor = count.markerfacecolor + length(findobjFcn(chil,'markerfacecolor', bkgrndColor,'Visible','on'));
113
114
0.01 40 115 end
116
117 %Handle special case
118 %The Axes labels and title are outside the bounds of the
119 %Axes and therefore contrastness needs to be checked with
120 %the Figure.
304 121 if ~origFigWhite
122 %Determine the number of labels which are white so that they
123 %can be changed to black before printing
0.07 304 124 count.color = count.color + length( findobjFcn( ...
125 [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], ...
126 '-depth', 0, 'color', WHITE ,'Visible','on')' );
127 %Determine the number of labels which are the same color as the figure window
128 %so that they can be changed to white before printing
0.08 304 129 count.color = count.color + length( findobjFcn( ...
130 [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], ...
131 '-depth', 0, 'color', origFigColor ,'Visible','on')' );
304 132 end
133
304 134 end
135
136 %Initialize counts based on color we now know we have to change
137 % 1st entry is the figure, followed by color matrix
40 138 storage.figure = {fig saveOrigFigColor};
139
140 % one entry for each axes
141 % 1st element for the object
142 % next 12 for various colors
0.01 40 143 storage.axes = repmat({[] zeros(1,12)}, naxes, 1);
144
145 % various other objects need to have their colors adjusted
146 % 1st element for the object
147 % 2nd holds color data
40 148 storage.color = repmat({[] zeros(1,3)}, count.color, 1);
40 149 storage.facecolor = repmat({[] zeros(1,3)}, count.facecolor, 1);
0.01 40 150 storage.edgecolor = repmat({[] zeros(1,3)}, count.edgecolor, 1);
40 151 storage.markeredgecolor = repmat({[] zeros(1,3)}, count.markeredgecolor, 1);
40 152 storage.markerfacecolor = repmat({[] zeros(1,3)}, count.markerfacecolor, 1);
153
154 % the turnMe structure will hold the info on what we want to change the
155 % colors to
40 156 turnMe.color = repmat({[] zeros(1,3)}, count.color, 1);
0.01 40 157 turnMe.facecolor = repmat({[] zeros(1,3)}, count.facecolor, 1);
40 158 turnMe.edgecolor = repmat({[] zeros(1,3)}, count.edgecolor, 1);
40 159 turnMe.markeredgecolor = repmat({[] zeros(1,3)}, count.markeredgecolor, 1);
40 160 turnMe.markerfacecolor = repmat({[] zeros(1,3)}, count.markerfacecolor, 1);
161
162 % keep track of the "next" entry in the various arrays to use
40 163 idx.color = 1;
40 164 idx.facecolor = 1;
40 165 idx.edgecolor = 1;
40 166 idx.markeredgecolor = 1;
40 167 idx.markerfacecolor = 1;
168
40 169 for axnum = 1:naxes
304 170 a = allAxes(axnum);
0.04 304 171 chil = allchild(a);
172
173 % Exclude Axes labels from chil because they are handled as a special
174 % case below since they lie outside of the axes.
304 175 if ~isempty(chil)
0.01 304 176 excludedH = get(a, {'xlabel';'ylabel';'zlabel';'title'});
304 177 excludedH = cat(1, excludedH{:})'; % turn cell array into row vector
304 178 for hLabel = excludedH
0.01 1216 179 chil(double(chil) == double(hLabel)) = []; % remove excluded handles
1216 180 end
0.01 304 181 end
182
0.01 304 183 axesVisible = strcmp(get(a,'visible'), 'on');
0.01 304 184 origAxesColor = get(a,'color');
0.01 304 185 axc = get(a,'xcolor');
304 186 ayc = get(a,'ycolor');
0.01 304 187 azc = get(a,'zcolor');
0.01 304 188 aXYZc = [axc ayc azc];
304 189 if ~axesVisible || strcmp(origAxesColor,'none')
40 190 bkgrndColor = origFigColor;
264 191 else
264 192 bkgrndColor = origAxesColor;
264 193 end
194
0.01 304 195 storage.axes(axnum,:) = {a [color2matrix(origAxesColor) aXYZc]};
196
197 %Early exit criteria
304 198 if (axesVisible && isequal(origAxesColor,WHITE)) ...
199 || ((~axesVisible || strcmp(origAxesColor,'none')) && origFigWhite)
200
201 % Do nothing
40 202 else
203 %Objects properties that are W will goto K to stay contrasting and those
204 % that match the ultimate background color goto W to stay invisible.
205
40 206 if (~strcmp(origAxesColor, 'none'))
0.02 40 207 LocalSet(a,'color',WHITE)
40 208 end
209
40 210 for obj = findobjFcn(chil,'color',WHITE,'Visible','on')'
211 storage.color(idx.color,:) = {obj WHITE};
212 turnMe.color(idx.color,:) = {obj BLACK};
213 idx.color = idx.color + 1;
214 end
215
0.01 40 216 for obj = findobjFcn(chil,'color', bkgrndColor,'Visible','on')'
217 storage.color(idx.color,:) = {obj bkgrndColor};
218 turnMe.color(idx.color,:) = {obj WHITE};
219 idx.color = idx.color + 1;
220 end
221
222 %Face and Edge colors need to be considered together
0.01 40 223 for obj = [findobjFcn(chil,'type','surface','Visible','on') ; ...
224 findobjFcn(chil,'type','patch','Visible','on') ; ...
225 findobjFcn(chil,'type','rectangle','Visible','on')]';
226 fc = get(obj,'facecolor');
227 ec = get(obj,'edgecolor');
228 if isequal( fc, bkgrndColor )
229 if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
230 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, WHITE, storage, turnMe, idx );
231 else [storage, turnMe, idx] = setfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
232 end
233
234 elseif isequal( fc, WHITE )
235 if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, BLACK, BLACK, storage, turnMe, idx );
236 elseif isequal( ec, 'none' ), [storage, turnMe, idx] = setfaceedge( obj, BLACK, NaN, storage, turnMe, idx );
237 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
238 end
239
240 elseif isequal( fc, BLACK )
241 if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
242 elseif isequal( ec, 'flat' ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
243 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
244 end
245
246 elseif isequal( fc, 'none' )
247 if isequal( ec, WHITE ), [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
248 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
249 end
250
251 else %Face is 'flat' or RGB triplet
252 if isequal( ec, WHITE ) || isequal( ec, bkgrndColor )
253 [storage, turnMe, idx] = setfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
254 end
255
256 end
257 end %face and edgecolor loop
258
259 %Marker Face and Edge colors also need to be considered together
0.02 40 260 for obj = [ findobjFcn(chil,'type','line','Visible','on') ; ...
261 findobjFcn(chil,'type','surface','Visible','on') ; ...
262 findobjFcn(chil,'type','patch','Visible','on') ]'
263 fc = get(obj,'markerfacecolor');
264 ec = get(obj,'markeredgecolor');
265 if isequal( fc, bkgrndColor )
266 if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
267 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, WHITE, storage, turnMe, idx );
268 else [storage, turnMe, idx] = setmfaceedge( obj, WHITE, NaN, storage, turnMe, idx );
269 end
270
271 elseif isequal( fc, WHITE )
272 if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, BLACK, BLACK, storage, turnMe, idx );
273 elseif isequal( ec, 'none' ), [storage, turnMe, idx] = setmfaceedge( obj, BLACK, NaN, storage, turnMe, idx );
274 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
275 end
276
277 elseif isequal( fc, BLACK )
278 if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
279 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, WHITE, BLACK, storage, turnMe, idx );
280 end
281
282 elseif isequal( fc, 'none' )
283 if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
284 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
285 end
286
287 else %Face is RGB triplet
288 if isequal( ec, WHITE ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, BLACK, storage, turnMe, idx );
289 elseif isequal( ec, bkgrndColor ), [storage, turnMe, idx] = setmfaceedge( obj, NaN, WHITE, storage, turnMe, idx );
290 end
291
292 end
293 end %marker face and edge color loop
40 294 end
295
296 %Handle special case #2
297 %The Axes labels and title are outside the bounds of the
298 %Axes and therefore contrastness needs to be checked with
299 %the Figure.
304 300 if ~origFigWhite
301 %The labels that are white need to be set to black before printing.
302 %After printing they need to be set back to their original color, white.
0.09 304 303 for obj = findobjFcn( [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], '-depth', 0, 'color', WHITE ,'Visible','on')'
304 storage.color(idx.color,:) = {obj WHITE};
305 turnMe.color(idx.color,:) = {obj BLACK};
306 idx.color = idx.color + 1;
307 end
308
309 %The labels that are the same color as the Figure Window need to be
310 %set to white before printing. These labels don't appear on screen
311 %and should not appear on the printout.
0.09 304 312 for obj = findobjFcn( [get(a,'xlabel') get(a,'ylabel') get(a,'zlabel') get(a,'title') ], '-depth', 0, 'color', origFigColor ,'Visible','on')'
313 storage.color(idx.color,:) = {obj origFigColor};
314 turnMe.color(idx.color,:) = {obj WHITE};
315 idx.color = idx.color + 1;
316 end
304 317 end
318
304 319 end %for each Axes
320
321 %Sets the axes labels color for printing
322
40 323 for k = 1:count.color
324 if ~strcmp( 'light', get(turnMe.color{k,1}, 'type') )
325 LocalSet(turnMe.color{k,1},'color',turnMe.color{k,2,:});
326 end
327 end
328
329
330 % Adjust the axes object's XColor, YColor, and ZColor
331 % When setting axis color, make sure label isn't affected.
332 % This needs to occur after the label colors are set otherwise in
333 % some cases the axis color will reset the label color incorrectly.
334
335 % A FOR loop is necessary so that all WHITEBG subplots are updated
336 % correctly.
337
40 338 for axnum = 1:naxes
304 339 a = allAxes(axnum);
340
0.01 304 341 axc = get(a,'xcolor');
0.01 304 342 ayc = get(a,'ycolor');
0.01 304 343 azc = get(a,'zcolor');
344
304 345 labelH = get(a,'xlabel');
0.01 304 346 labelColor = get(labelH,'color');
304 347 if (isequal(axc,origFigColor))
348 LocalSet(a,'xcolor',WHITE)
304 349 elseif (isequal(axc,WHITE))
350 LocalSet(a,'xcolor',BLACK)
351 end
0.02 304 352 LocalSet( labelH, 'color', labelColor )
353
304 354 labelH = get(a,'ylabel');
0.01 304 355 labelColor = get(labelH,'color');
304 356 if (isequal(ayc,origFigColor))
357 LocalSet(a,'ycolor',WHITE)
304 358 elseif (isequal(ayc,WHITE))
359 LocalSet(a,'ycolor',BLACK)
360 end
0.02 304 361 LocalSet( labelH, 'color', labelColor )
362
0.01 304 363 labelH = get(a,'zlabel');
0.02 304 364 labelColor = get(labelH,'color');
304 365 if (isequal(azc,origFigColor))
366 LocalSet(a,'zcolor',WHITE)
304 367 elseif (isequal(azc,WHITE))
368 LocalSet(a,'zcolor',BLACK)
369 end
304 370 LocalSet( labelH, 'color', labelColor )
304 371 end
372
373 %Face and Edge color matrices may not be fully filled out
0.01 40 374 used = [];
40 375 if count.facecolor > 0
376 used = 1 : count.facecolor;
377 used(cellfun('isempty', turnMe.facecolor(:,1))) = [];
378 end
40 379 if ~isempty( used )
380 storage.facecolor(used(end)+1:end,:) = [];
381 for k = used
382 LocalSet(turnMe.facecolor{k,1},'facecolor',turnMe.facecolor{k,2});
383 end
40 384 else
40 385 storage.facecolor = {};
40 386 end
387
0.01 40 388 used = [];
40 389 if count.edgecolor > 0
390 used = 1 : count.edgecolor;
391 used(cellfun('isempty', turnMe.edgecolor(:,1))) = [];
392 end
40 393 if ~isempty( used )
394 storage.edgecolor(used(end)+1:end,:) = [];
395 for k = used
396 LocalSet(turnMe.edgecolor{k,1},'edgecolor',turnMe.edgecolor{k,2});
397 end
40 398 else
40 399 storage.edgecolor = {};
40 400 end
401
402 %Marker Face and Edge color matrices may not be fully filled out
40 403 used = [];
40 404 if count.markerfacecolor > 0
405 used = 1 : count.markerfacecolor;
406 used(cellfun('isempty', turnMe.markerfacecolor(:,1))) = [];
407 end
40 408 if ~isempty( used )
409 storage.markerfacecolor(used(end)+1:end,:) = [];
410 for k = used
411 LocalSet(turnMe.markerfacecolor{k,1},'markerfacecolor',turnMe.markerfacecolor{k,2});
412 end
40 413 else
40 414 storage.markerfacecolor = {};
40 415 end
416
40 417 used = [];
40 418 if count.markeredgecolor > 0
419 used = 1 : count.markeredgecolor;
420 used(cellfun('isempty', turnMe.markeredgecolor(:,1))) = [];
421 end
40 422 if ~isempty( used )
423 storage.markeredgecolor(used(end)+1:end,:) = [];
424 for k = used
425 LocalSet(turnMe.markeredgecolor{k,1},'markeredgecolor',turnMe.markeredgecolor{k,2});
426 end
40 427 else
40 428 storage.markeredgecolor = {};
40 429 end
430
431 % It might become important that this is LAST
0.01 40 432 LocalSet(fig,'color',WHITE);
433
40 434 SaveTonerOriginalColors = [storage SaveTonerOriginalColors];
435
40 436 else % Restore colors
437
40 438 storage = SaveTonerOriginalColors(1);
40 439 SaveTonerOriginalColors = SaveTonerOriginalColors(2:end);
40 440 if storage.HGUsingMATLABClasses ~= feature('HGUsingMATLABClasses')
441 error('MATLAB:savtoner:InconsistentClasses', 'The state of HGUsingMATLABClasses for SAVTONER ''restore'' is not the same as when SAVTONER ''save'' was run; unable to continue.')
442 end
40 443 origFig = storage.figure{1};
40 444 origFigColor = storage.figure{2};
40 445 if (sum(isnan(origFigColor)) == 3)
446 origFigColor = 'none';
447 end
40 448 LocalSet(origFig,'color',origFigColor);
449
40 450 for k = 1:size(storage.axes,1)
304 451 a = storage.axes{k,1};
0.04 304 452 LocalSet(a,'color',matrix2color(storage.axes{k,2}(1:3)))
453
454 %When setting axis color, make sure label isn't affected.
0.60 304 455 labelH = get(a,'xlabel');
304 456 labelColor = get(labelH,'color');
0.02 304 457 LocalSet(a,'xcolor',storage.axes{k,2}(4:6))
304 458 LocalSet( labelH, 'color', labelColor )
459
304 460 labelH = get(a,'ylabel');
0.01 304 461 labelColor = get(labelH,'color');
304 462 LocalSet(a,'ycolor',storage.axes{k,2}(7:9))
0.02 304 463 LocalSet( labelH, 'color', labelColor )
464
304 465 labelH = get(a,'zlabel');
0.01 304 466 labelColor = get(labelH,'color');
304 467 LocalSet(a,'zcolor',storage.axes{k,2}(10:12))
0.03 304 468 LocalSet( labelH, 'color', labelColor )
304 469 end
470
40 471 for k = 1:size(storage.color,1)
472 obj = storage.color{k,1};
473 LocalSet(obj,'color',matrix2color(storage.color{k,2}))
474 end
475
40 476 for k = 1:size(storage.facecolor,1)
477 obj = storage.facecolor{k,1};
478 LocalSet(obj,'facecolor',matrix2color(storage.facecolor{k,2}))
479 end
480
40 481 for k = 1:size(storage.edgecolor,1)
482 obj = storage.edgecolor{k,1};
483 LocalSet(obj,'edgecolor',matrix2color(storage.edgecolor{k,2}))
484 end
485
40 486 for k = 1:size(storage.markeredgecolor,1)
487 obj = storage.markeredgecolor{k,1};
488 LocalSet(obj,'markeredgecolor',matrix2color(storage.markeredgecolor{k,2}))
489 end
490
40 491 for k = 1:size(storage.markerfacecolor,1)
492 obj = storage.markerfacecolor{k,1};
493 LocalSet(obj,'markerfacecolor',matrix2color(storage.markerfacecolor{k,2}))
494 end
40 495 end
496
497 %%%%%%%% nested functions
498 %-------------------
499 function [storage, turnMe, idx] = setfaceedge( obj, newFace, newEdge, storage, turnMe, idx )
500 %SETFACEEDGE Set both FaceColor and EdgeColor and update structures
501
502 if ~isnan(newFace)
503 storage.facecolor(idx.facecolor,:) = {obj color2matrix(get(obj,'facecolor')) };
504 turnMe.facecolor(idx.facecolor,:) = {obj newFace};
505 idx.facecolor = idx.facecolor + 1;
506 end
507
508 if ~isnan(newEdge)
509 storage.edgecolor(idx.edgecolor,:) = {obj color2matrix(get(obj,'edgecolor')) };
510 turnMe.edgecolor(idx.edgecolor,:) = {obj newEdge};
511 idx.edgecolor = idx.edgecolor + 1;
512 end
513 end
514
515 %-------------------
516 function [storage, turnMe, idx] = setmfaceedge( obj, newFace, newEdge, storage, turnMe, idx )
517 %SETMFACEEDGE Set both MarkerFaceColor and MarkerEdgeColor and update structures
518
519 if ~isnan(newFace)
520 storage.markerfacecolor(idx.markerfacecolor,:) = {obj color2matrix(get(obj,'markerfacecolor')) };
521 turnMe.markerfacecolor(idx.markerfacecolor,:) = {obj newFace};
522 idx.markerfacecolor = idx.markerfacecolor + 1;
523 end
524
525 if ~isnan(newEdge)
526 storage.markeredgecolor(idx.markeredgecolor,:) = {obj color2matrix(get(obj,'markeredgecolor')) };
527 turnMe.markeredgecolor(idx.markeredgecolor,:) = {obj newEdge};
528 idx.markeredgecolor = idx.markeredgecolor + 1;
529 end
530 end
531
532 %-------------------
533 function color = color2matrix( color )
534 %COLOR2MATRIX Return a 1x3 for any color, including strings 'flat' and 'none'
535
536 if isequal(color, 'none' )
537 color = NONE;
538
539 elseif isequal(color, 'flat' )
540 color = FLAT;
541
542 end
543 end
544
545 %-------------------
546 function color = matrix2color( color )
547 %MATRIX2COLOR Return a Color-spec for any a 1x3, possibly encoded for 'flat' and 'none'.
548
549 if isequal(isnan(color), isnan(NONE) )
550 color = 'none';
551
552 elseif isequal(isnan(color), isnan(FLAT) )
553 color = 'flat';
554
555 end
556 end
557
558
559 function LocalSet(obj, propName, val)
560 if ~storage.HGUsingMATLABClasses || isfigure(obj)
561 set(obj, propName, val);
562 else
563 set(obj, [propName '_I'], val);
564 end
565 end
566 %%%%%%%% end nested functions
80 567 end
Other subfunctions in this file are not included in this listing.