![]() ![]() JFigPeer = get (handle (FNUMBLUR ), 'JavaFrame' ) %Setup the overlay figure figure (FNUMBLUR ) % % BLURWINDOW clear REMOVES THE BLUR %Use a consistent, random figure numberĮlseif ischar (fnum ) & strcmpi (fnum, 'clear' ) if ishandle (FNUMBLUR ) close (FNUMBLUR ) Įnd %Find the position of the figure to be blurred % BLURWINDOW Blurs the current window % BLURWINDOW(FNUM) blurs the given window. Do you like the new design? hate it? I would love to hear your feedback via comment or email.įunction blurwindow (fnum ) %BLURWINDOW Blurs a given window. It now also runs on a multi-server cloud, which means more stability and faster response times. Upgraded websiteĪlso, did you notice my new website design? It’s supposed to be much more readable (yes – also on Android…). So here’s a riddle for you: using figure window transparency, can you guess how to make a Matlab figure appear blurred for disabled figures (see the screenshot there)? There are several possible ways to do this – can you find the simplest? The first one to post a comment with a correct answer gets a smiley… My answer will appear in next week’s article. In fact, in the upcoming Java 7 release, which is expected in a few months, and which I expect to be available in Matlab sometime in 2012, the set of transparency/opacity methods have migrated to the fully-documented class. It is bundled with the standard Java release since 2008 (1.6.0_10), and yet is not part of the official release because its API has not yet settled. If you have any axes in your GUI, the axes area will simply appear as a shaded axes, whose intensity depends on the selected alpha (transparency) value the contents beneath the window will not be merged in the axes area as it is in the non-axes areas.įinally, note that is itself an undocumented Java class. Unfortunately, Matlab plot axes cannot be made transparent. Java 1.6.0_17-b04 with Sun Microsystems Inc. You can check your current Java version in Matlab as follows: As noted, 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. The JRE can be downloaded from here, and you can configure Matlab to use it according to the instructions here. If you are using an earlier Matlab release, consider a retrofit of JRE 1.6.0_10 or any later version (e.g., the latest available version today is 1.6 update 24). This means that it’s supported on Matlab release 7.9 (R2009b) and higher by default, and on earlier releases using a JRE retrofit. Setting a figure window’s transparency requires using Java Run-time Engine (JRE) 1.6.0_10 (also called “Java 6 update 10”) or higher. You may also wish to use Malcolm Lidierth’s MUtilities, which also has similar functionalities (plus some other goodies). I’ve prepared a Matlab utility that contains all these options, including optional blocking/non-blocking fade effects, in my setFigTransparency utility, which is available for download on the Matlab File Exchange. If you fade-out completely (i.e., to a value of 0.0), it might be a good idea to actually close the figure window once it gets the totally-transparent value of 0.0. Of course, you can also fade-in/out to intermediate values such as 0.3 or 0.8. % If blocking, do the fade effect immediatelyĬom.(jWindow,newAlpha) Ĭom.(jFrame,newAlpha) Steps = fix(abs(deltaAlpha) / maxStepAlpha) + 1 NewAlpha = currentAlpha + stepAlpha*stepIdx Ĭom. % If blocking, do the fade effect immediately if blockingFlag || steps= 1 for stepIdx = 1 : stepsĬom. StepDuration = fadeDuration / (steps- 1 ) Steps = fix ( abs (deltaAlpha ) / maxStepAlpha ) + 1 % Compute the required opacity-setting steps They can be set to any floating-point value between 0.0-1.0, where an opacity of 0.0 means full transparency, and any value in between means partial transparency (i.e., translucency): Actually, setWindowOpacity sets the opacity level, rather than transparency, but they are obviously complementary and I personally find “transparency” to be more easily understandable.īy default, windows are created with an opacity of 1.0 (= not transparent). Then use Java’s setWindowOpacity method to set the window’s transparency value. Matlab figure window transparencyįollowing an idea I got from Malcolm Lidierth’s MUtilities submission on the Matlab File Exchange, the solution for setting Matlab figure window transparency is quite simple: Get the figure’s underlying Java window reference handle, as in last week’s article. The short answer is that there is no supported way of doing this with pure documented Matlab, but it is trivially easy to achieve using just a bit of Java magic powder (surprise, surprise). This could be used, for example, for window fade-in/fade-out effects. Every now and then, a user asks whether it is possible to make an entire Matlab window transparent ( example). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |