WP7 background blur effect - windows-phone-7

I need to know, which is the best way to blur the background of the Windows Phone 7 app to concentrate the user's attention on a "always on top" popup window.
My idea is:
Make an in-memory screenshot of the background grid (by turning it into a freezable or something).
Add an image that overlaps the background grid, but is below (with the z-index) the popup.
Still I doubt I will be able to overlap the application bar.
At this point, if you have a solution, please advise.

A few pointers for you ...
Unfortunately the Silverlight BlurEffect and other Bitmap effects didn't make it into Window Phone 7, so you will have to implement the blur yourself. This is actually pretty simple, just use a Gaussian Convolution Filter.
To achieve this effect you can capture the visuals of your application into a WriteableBitmap, manipulate the image to create your blur, then overlay this image over your application using a PopUp. I did something similar in a blog post I wrote about fly-out text animations here:
http://www.scottlogic.co.uk/blog/colin/2011/04/metro-in-motion-3-flying-titles/
Find your root visual as follows:
var rootElement = Application.Current.RootVisual as FrameworkElement;
Add a copy of this UI into a popup as follows:
_backgroundMask = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Black),
Opacity = 0.0,
Width = rootElement.ActualWidth,
Height = rootElement.ActualHeight
};
_popupCanvas.Children.Add(_backgroundMask);
_targetElementClone = new Image()
{
Source = new WriteableBitmap(element, null)
};
_popupCanvas.Children.Add(_targetElementClone);
And show it:
_popup.IsOpen = true;
I'll leave you to work out how to blur the background!
As an aside, your will not be able to overlay or capture the application bar visuals. Hide it before performing this transformation.
Finally, blurring the background isn't really very 'Metro'. Are you sure you want to do this?

Instead of blurring just use a semi transparent layer over the top of the page.
You should hide the application bar before trying to create such an effect as you won't be able to place anything on top of it.

Related

Drag to resize a bitmap with createJS & Canvas

I'm working on a basic design app where the user can upload images to a canvas, drag them around and resize them. The problem I have is resizing the image with a mouse drag. I'd like the user to position the mouse pointer on either corner of the bitmap image and drag either towards or away from the bitmap to resize it proportionally. I'd be grateful for any code or suggestions.
Lanny mentioned that you had this question here. ZIM, which is based on CreateJS has this functionality built in - it is called transform(). We also have an uploader built in called Loader().
Here is the code that you would use inside the ZIM template available on the code page at ZIM https://zimjs.com
const loader = new Loader().center();
loader.on("loaded", e=>{
e.bitmap.center().transform();
// or if you want multiple files
// loop(e.bitmaps, bitmap=>{
// bitmap.center().transform();
// });
loader.removeFrom();
stage.update();
});
Below is an image that has been loaded. You can try it here https://zimjs.com/explore/uploadresize.html. The transform interface will go away when the user clicks off the image and then comes back when they click on the image. There are various options for all of this that you can read about in the Docs available on the ZIM site.
All your regular CreateJS will work and you will find that ZIM is helpful in many other ways too! Aside from transform() there is drag() for normal dragging, and gesture() for pinch zoom and rotate - you would use one or the other of these not combined.

Xamarin: avoid lighter effect on iOS navigationBar

In my custom NavigationRender, I need an image as background of navigation bar.
I use this line to do that:
this.NavigationBar.BarTintColor = UIColor.FromPatternImage(UIImage.FromFile("myImmage"));
this.NavigationBar.Translucent = false;
It works, but image appear lighter than the original one due to a blur efefct added on navigation.
Is there a way to avoid it?

Matlab figure window transitions (screen transitions - GUI design)

My idea is building a logo image (similar to Matlab's startup one) which shows before my gui is appeared. I have the following code (it was obtained modifying the solution given by How do I make a splash screen for my MATLAB GUI application?) for it:
% create a figure1 that is not visible yet, and has minimal titlebar properties
fh = figure('Visible','off','MenuBar','none','NumberTitle','off',...
'DockControls','off');
% put an axes in it
ah = axes('Parent',fh,'Visible','on');
% put the image in it
ih = imshow('SIS.gif','Parent',ah);
% set the figure1 size to be just big enough for the image, and centered at
% the center of the screen
imxpos = get(ih,'XData');
imypos = get(ih,'YData');
set(ah,'Unit','Normalized','Position',[0,0,1,1]);
figpos = get(fh,'Position');
figpos(3:4) = [imxpos(2) imypos(2)];
set(fh,'Position',figpos);
movegui(fh,'center')
% make the figure1 visible
set(fh,'Visible','on');
pause(3);
close(fh);
I have two problems:
Number 1: I want the logo image's figure windows has no borders, no title and no taskbars. I have tried the WindowAPI but it does not work because I call it after the above code and because of the visibility of the window is off, then the handle of it is off too.
Number 2:I want that, when the logo image is disappeared, it is showed the gui window maximized. Where is the problem? The screen transition between the logo image's window and the gui window is not smoothed. I have tried to use a lot of MatlabĀ“s applications that I found in Matlab Central's File Exchange (WindowAPI, Maxfig, Maximize, SetFigTransparency,...) without success. I realized that the problem is the visibility of my gui (I set off until all elements are created and then I change it to on). Because of the off visibility cause the handlevisibility is off too, the previous mentioned applications has no effects on the figure window that I want to maximize.
After observating the startup of Matlab, I have noticed that after the logo is showed, it appears a fullscreen image followed by the normal fullscreen of the program. So I have tried to create an maximized fullscreen windows that appears after the logo's windows is closed. However, now the problem is the transition between this last and the gui window. If I set the visibility of the gui window on and then I maximize it, during an instant it can be seen that transition that bothers me. I do not know what to do. I also think that if I could avoid that the guide window is currentfigure when I change its visibility, perhaps I would achieve it. Other solution it might be a timer that hold the white window as currentfigure while the guide window is behind changing its visibility but I do not know how to do. Thank you for your attention. Cheers.
As I show in this answer, derived from this MathWorks newsgroup thread, you can create a window without a title, borders, etc., using Java. Here's a modification of the code from my other answer to create a splash window centered on the screen:
img = imread('peppers.png'); %# A sample image to display
jimg = im2java(img);
frame = javax.swing.JFrame;
frame.setUndecorated(true);
icon = javax.swing.ImageIcon(jimg);
label = javax.swing.JLabel(icon);
frame.getContentPane.add(label);
frame.pack;
imgSize = size(img);
frame.setSize(imgSize(2),imgSize(1));
screenSize = get(0,'ScreenSize'); %# Get the screen size from the root object
frame.setLocation((screenSize(3)-imgSize(2))/2,... %# Center on the screen
(screenSize(4)-imgSize(1))/2);
frame.show; %# You can hide it again with frame.hide
I would try this to create your splash screen and see if it also helps with the problems transitioning to the next GUI window.
After a long research work, I have found a reasonable answer which was nearest to that I thought. If you type in "splash screen" in the File Exchange browser, you have some interesting applications designed specifically to it. I have chosen splash.m. With respect to the smooth transition, I have used these programs: WindowAPI and maximize.
The written code looks like this:
logoh = splash('logo.jpg'); %# Appear the logo image
fh = figure('Visible','on','Name','MyGUI','Position',[-1000,-1000,...
1000,500],'Menu','none','Toolbar','none','NumberTitle','off');
%# Put the figure window outside the screen (see Position property) because
%# its visibility is on
WindowAPI(fh,'Alpha',0); %# Make the figure window invisible
...
movegui(fh,'center'); %# Move the figure window to center
maximize(fh);% Maximize it
WindowAPI(fh,'Alpha',1); %# Make the figure window visible totally
pause(2); %# time during which the logo image is exposed
splash(logoh,'off'); %# Disappear the logo image

Remove titlebar from MATLAB GUI for full screen display

I have created a MATLAB GUI, which I would like to display so that it fills the whole screen. Currently, the titlebar is showing at the very top. Is there a way to hide this titlebar?
I considered using the psychtoolbox for this purpose, which allows for full screen displays, but this doesn't allow for standard MATLAB GUI elements to be included as I understand it.
(If it is of importance, this is for OSX. I would obviously hide the menubar before making the GUI fullscreen.)
I don't know if this will work for OSX, but on Windows I was able to use the Java code from this MATLAB newsgroup thread to create a full screen window with no title, edges, etc. and display an image in the middle. Here's how I made the window:
img = imread('peppers.png'); %# A sample image to display
jimg = im2java(img);
frame = javax.swing.JFrame;
frame.setUndecorated(true);
icon = javax.swing.ImageIcon(jimg);
label = javax.swing.JLabel(icon);
frame.getContentPane.add(label);
frame.pack;
screenSize = get(0,'ScreenSize'); %# Get the screen size from the root object
frame.setSize(screenSize(3),screenSize(4));
frame.setLocation(0,0);
frame.show;
And you can hide the frame again by doing this:
frame.hide;
Not sure how this would work in general for displaying a typical MATLAB GUI. I'll have to play around with it more and find out.

How to make an image as transparent in BlackBerry?

I am new to BlackBerry Java application development. My scenario is: In my application a gallery list of images will be displayed in a small icons. If I click on any image it will display in a large mode. Here I need to provide controls like front and back buttons. On clicking on those buttons the background image should change. In addition to that those buttons should be highlighted and the back ground large image should be transparent. How to do this?
Please guide me.
You can use Graphics.setGlobalAlpha() on paint() or to modify bitmap before preview.
Don't forget to set back normal global alpha value after bitmap drawing.

Resources