Code covered by the BSD License  

Highlights from
blurFigure - blurs and prevents interaction on a figure window

5.0

5.0 | 3 ratings Rate this file 19 Downloads (last 30 days) File Size: 5.38 KB File ID: #30666
image thumbnail

blurFigure - blurs and prevents interaction on a figure window

by

 

07 Mar 2011 (Updated )

blurs a specified figure window and prevents interaction with it until the figure is un-blurred

| Watch this File

File Information
Description

Syntax:
     hFigBlur = blurFigure(hFig, state)
 
  
Description:
     blurFigure(hFig) blurs figure hFig and prevents interaction with it. The only interaction possible is with user-created controls on the blurring panel (see below).
 
     hFigBlur = blurFigure(hFig) returns the overlaid blurred figure pane. This is useful to present a progress bar or other GUI controls, for user interaction during the blur phase.
 
     blurFigure(hFig,STATE) sets the blur status of figure hFig to STATE, where state is 'on','off',true or false (default='on'/true).
 
     blurFigure(hFig,'on') or blurFigure(hFig,true) is the same as: blurFigure(hFig).
 
     blurFigure(hFig,'off') or blurFigure(hFig,false) is the same as: close(hFigBlur).
 
     blurFigure('demo') displays a simple demo of the blurring (see attached screenshot).
 
  
Input parameters: (all parameters are optional)
 
     hFig - (default=gcf) Handle(s) of the modified figure(s). If component handle(s) is/are specified, then the containing figure(s) will be inferred and used.
 
     state - (default='on'/true) blurring flag: 'on','off',true or false
 
  
Examples:
     hFigBlur = blurFigure(hFig); % blur hFig (alternative #1)
     hFigBlur = blurFigure(hFig,true); % blur hFig (alternative #2)
 
     hFigBlur = blurFigure(hFig,false); % un-blur hFig (alternative #1)
     hFigBlur = blurFigure(hFig,'off'); % un-blur hFig (alternative #2)
     close(hFigBlur); % un-blur hFig (alternative #3)
     delete(hFigBlur); % un-blur hFig (alternative #4)
 
     blurFigure('demo'); % blur demo with progress bar etc.
 
  
Technical Description:
     http://UndocumentedMatlab.com/blog/blurred-matlab-figure-window

Bugs and suggestions:
     Please send to Yair Altman (altmany at gmail dot com)
 
  
Warning:
     This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7.9 (R2009b) and higher, but use at your own risk!

Acknowledgements

Get J Frame Retrieves A Figure's Underlying Java Frame, Enable/Disable Figure, and Set Fig Transparency Set Figure Transparency / Fading inspired this file.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements Matlab 7.9 (R2009b) and higher (or a retrofit of JRE 1.6.0_10 and higher in any previous Matlab release)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
27 Jun 2013 Yair Altman

IMPORTANT NOTE: this utility DOES NOT WORK on R2013b/Java7 and higher, only on earlier releases. The failure is due to a change in the way that transparency works in Java 7 compared to earlier releases. If I ever find a solution, I will post it here. In the meantime, please do not comment about this issue here.

05 Jun 2013 Chris

Great utility. I have had a bit of trouble getting the overlay figure to exactly match the original. I found if I have a menu created in GUIDE, then the 'Menu' parameter is 'none' and the blurFig shortens itself.

If you add some lines to check if hProps.MenuBar is 'none', but there are uimenu objects with children, then you can launch the figure without the Menu parameter and it's fine.

Also adding space in line 180:

set(hComponents,'Label',' ')
vice
set(hComponents,'Label','')

helps keep the height matching in other situations.

20 Mar 2013 Josh Parks

I'm really loving your blog Yair, some really useful things in there! I'm running Matlab 20112b on OSX and the following line causes the blurfigure to flicker:

hLink(3) = linkprop(hFigures,'Visible');

I've commented it out as I'm not changing visibility of the target figure during the call, but I'm just not sure why that line caused problems!

Thanks!

16 Oct 2012 Aurelien Queffurust

This is exactly what I need. Works like a charm with MATLAB 8.0 (R2012b)
Really simple to insert in his own code.

14 Oct 2011 Charles

OK, I'll keep an eye out for it, don't see it yet. Thanks for the quick response.

Chuck

13 Oct 2011 Yair Altman

@Charles - I uploaded a fix for R2011b. It should be available here shortly (maybe tomorrow)

13 Oct 2011 Charles

This is exactly what I need. However, it does not work for me. I am using 2011b, which may be the problem. Here is the error I get:

Error using blurFigure (line 135)
Cannot retrieve the Java Frame reference for figure 190.0016

Error in mirror>characterize_Callback (line 3356)
blurFigure(hObject, true)

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in mirror (line 43)
gui_mainfcn(gui_State, varargin{:});

Error in
guidemfile/@(hObject,eventdata)mirror('characterize_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uicontrol Callback

Any ideas?

thanks
Chuck

22 Apr 2011 Patrick Lee

good sfuff O(∩_∩)O

06 Apr 2011 Matthew Whitaker

Hi Yair,
Very nice utility. Why not add a parameter to allow the user to set the opacity instead of just fixing it at 0.8?
Matt W

09 Mar 2011 Yair Altman

@Jan - a retrofit of JRE means installing JRE 1.6.0_10 (also called "Java 6 update 10"), or any later version (e.g., the latest available version today is 1.6 update 24). The JRE can be downloaded from http://java.com/en/download/manual.jsp and you can configure Matlab to use it according to the instructions in http://www.mathworks.com/support/solutions/en/data/1-1812J/

All of this is only necessary in Matlab releases R2009a (7.8) and earlier, which pre-bundle an earlier JRE version that does not support window frame transparency/opacity used in this submission.

Matlab R2009b (7.9) and onward, at least on Microsoft Windows, pre-bundle a JRE version that does support transparency/opacity and so do not require a retrofit.

08 Mar 2011 Jan Simon

What is a "retrofit of JRE 1.6.0_10"?

Updates
08 Mar 2011

Fixed the demo code

13 Oct 2011

Fix for R2011a; fixed description;

Contact us