Home > data-vis > supporting_functions > export_fig > using_hg2.m

using_hg2

PURPOSE ^

USING_HG2 Determine if the HG2 graphics engine is used

SYNOPSIS ^

function tf = using_hg2(fig)

DESCRIPTION ^

USING_HG2 Determine if the HG2 graphics engine is used

   tf = using_hg2(fig)

IN:
   fig - handle to the figure in question.

OUT:
   tf - boolean indicating whether the HG2 graphics engine is being used
        (true) or not (false).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %USING_HG2 Determine if the HG2 graphics engine is used
0002 %
0003 %   tf = using_hg2(fig)
0004 %
0005 %IN:
0006 %   fig - handle to the figure in question.
0007 %
0008 %OUT:
0009 %   tf - boolean indicating whether the HG2 graphics engine is being used
0010 %        (true) or not (false).
0011 
0012 % 19/06/2015 - Suppress warning in R2015b; cache result for improved performance
0013 % 06/06/2016 - Fixed issue #156 (bad return value in R2016b)
0014 
0015 function tf = using_hg2(fig)
0016     persistent tf_cached
0017     if isempty(tf_cached)
0018         try
0019             if nargin < 1,  fig = figure('visible','off');  end
0020             oldWarn = warning('off','MATLAB:graphicsversion:GraphicsVersionRemoval');
0021             try
0022                 % This generates a [supressed] warning in R2015b:
0023                 tf = ~graphicsversion(fig, 'handlegraphics');
0024             catch
0025                 tf = ~verLessThan('matlab','8.4');  % =R2014b
0026             end
0027             warning(oldWarn);
0028         catch
0029             tf = false;
0030         end
0031         if nargin < 1,  delete(fig);  end
0032         tf_cached = tf;
0033     else
0034         tf = tf_cached;
0035     end
0036 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005