time | Calls | line |
---|
| | 1 | function pt = ptpreparehg( pt, h )
|
| | 2 | %PREPAREHG Method of PrintTemplate object that formats a Figure for output.
|
| | 3 | % Input of PrintTemplate object and a Figure to modify on.
|
| | 4 | % Figure has numerous properties modified to account for template settings.
|
| | 5 |
|
| | 6 | % Copyright 1984-2018 The MathWorks, Inc.
|
| | 7 |
|
< 0.001 | 12 | 8 | if pt.DebugMode
|
| | 9 | fprintf(getString(message('MATLAB:uistring:ptpreparehg:PreparingFigure', num2str(double(h)))));
|
| | 10 | disp(pt);
|
< 0.001 | 12 | 11 | end
|
| | 12 |
|
| | 13 | % Initialize structure which used to store objects, property and
|
| | 14 | % corresponding original values throughout the process
|
< 0.001 | 12 | 15 | oldTickLimit.objs = {};
|
< 0.001 | 12 | 16 | oldTickLimit.prop = {};
|
< 0.001 | 12 | 17 | oldTickLimit.values = {};
|
| | 18 |
|
< 0.001 | 12 | 19 | v1hgdata = [];
|
| | 20 |
|
0.003 | 12 | 21 | newStyle = printingConvertToExportStyle(pt);
|
| | 22 |
|
| | 23 | % Update Axes/Ruler Tick/Limit mode values, and store original values
|
0.162 | 12 | 24 | oldTickLimit = printingAxesTickLabelUpdate(h, newStyle, oldTickLimit);
|
< 0.001 | 12 | 25 | v1hgdata.oldTickLimit = oldTickLimit;
|
| | 26 |
|
< 0.001 | 12 | 27 | pt.v1hgdata = v1hgdata;
|
| | 28 |
|
| | 29 | % try
|
< 0.001 | 12 | 30 | if pt.VersionNumber > 1
|
| | 31 |
|
| | 32 | % Get all necessary objects to process
|
| | 33 | objCollections = printingObjectCollection(h);
|
| | 34 |
|
| | 35 | try
|
| | 36 | err = 0;
|
| | 37 |
|
| | 38 | % Initialize structure which used to store objects, property and
|
| | 39 | % corresponding original values throughout the process
|
| | 40 | old.objs = {};
|
| | 41 | old.prop = {};
|
| | 42 | old.values = {};
|
| | 43 |
|
| | 44 | % Process Font
|
| | 45 | old = printingFontUpdate(objCollections.allFont, newStyle, old);
|
| | 46 |
|
| | 47 | % Process Line
|
| | 48 | old = printingLineUpdate(objCollections.line, newStyle, old);
|
| | 49 |
|
| | 50 | if isfield(pt,'DriverColor')
|
| | 51 | if pt.DriverColor == 1 && isfield(pt, 'GrayScale') && pt.GrayScale==1
|
| | 52 | old = printingGrayscaleUpdate(objCollections, old);
|
| | 53 | end
|
| | 54 | end
|
| | 55 |
|
| | 56 | if strcmp('off', get(h,'InvertHardcopy')) && isfield(pt, 'BkColor') && ~isempty(pt.BkColor)
|
| | 57 | hgdata.bkcolor = get(h, 'Color');
|
| | 58 | if any(pt.BkColor == '[')
|
| | 59 | % use str2num to convert the string array of values into a
|
| | 60 | % double array
|
| | 61 | pt.BkColor = str2num(pt.BkColor); %#ok<ST2NM>
|
| | 62 | end
|
| | 63 | hgdata.bkcolormode = get(h, 'ColorMode');
|
| | 64 | set(h, 'Color', pt.BkColor');
|
| | 65 | end
|
| | 66 | catch ex
|
| | 67 | err = 1;
|
| | 68 | end
|
| | 69 | hgdata.old = old;
|
| | 70 | pt.v2hgdata = hgdata;
|
| | 71 |
|
| | 72 | % If there's a failure, still propagate the error up. But roll back all
|
| | 73 | % changes made to the figure FIRST.
|
| | 74 | if err
|
| | 75 | ptrestorehg( pt, h );
|
| | 76 | rethrow( ex );
|
| | 77 | end
|
< 0.001 | 12 | 78 | end
|
< 0.001 | 12 | 79 | end
|
Other subfunctions in this file are not included in this listing.