Location: BG_crossbridge_TRPN @ 4e8b0e008b26 / Land_model_matlab / release / export_fig / using_hg2.m

Author:
Shelley Fong <sfon036@UoA.auckland.ac.nz>
Date:
2022-06-10 15:16:24+12:00
Desc:
Move dSL to environment
Permanent Source URI:
https://models.physiomeproject.org/workspace/7fb/rawfile/4e8b0e008b26cf300baf7a4c9f34903e8cfffaa8/Land_model_matlab/release/export_fig/using_hg2.m

%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).

% 19/06/2015 - Suppress warning in R2015b; cache result for improved performance

function tf = using_hg2(fig)
    persistent tf_cached
    if isempty(tf_cached)
        try
            if nargin < 1,  fig = figure('visible','off');  end
            oldWarn = warning('off','MATLAB:graphicsversion:GraphicsVersionRemoval');
            try
                % This generates a [supressed] warning in R2015b:
                tf = ~graphicsversion(fig, 'handlegraphics');
            catch
                tf = verLessThan('matlab','8.4');  % =R2014b
            end
            warning(oldWarn);
        catch
            tf = false;
        end
        if nargin < 1,  delete(fig);  end
        tf_cached = tf;
    else
        tf = tf_cached;
    end
end