There is a program, that displays some animation. I need to capture it, to display it on the high-resolution (2k) projector. The display I have has FullHD (1920x1080) resolution, so the video captured from it will be scaled, and hence decrease quality in 2k projector.
Unfortunately, I can't record it on projector.
I tried to change display resolution via the next code:
DEVMODE devmode;
devmode.dmPelsWidth = 2000;
devmode.dmPelsHeight = 900;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmSize = sizeof(DEVMODE);
long result = ChangeDisplaySettings(&devmode, 0);
But it fails if to set resolution that is higher than display's.
I also tried to resize program window. I found it via FindWindow, than resized. Although window was resized, the render area was equal to the display size, and all that was out of it didn't update.
The only idea I have is to run program under virtual machine with resolution I need.
Maybe there is way to resize window and then zoom it down like an image? Physically, it will be small, but by itself it will have high resolution?
What if to try access process memory and try to find bitmap or something like this?
Any ideas?
Update
I discovered a button, that makes a correct screenshot, even if the part of window is in non-visible area. After clicking, it opens default Windows save as dialog. Obviously, I can make a program that will click on button, set the file name incrementing by 1, and click save button, but I will lost a lot of frames.
Bet, that the bitmap to save is created before the dialog is shown up. Maybe I can somehow grab it. I checked GDI objects count before I press screenshot button and after, and the difference, unfortunately is about 20 elements, perhaps because save dialog window objects also counting.
AMD Graphics cards have a feature called Virtual Super Resolution It allows you to upscale your display to virtual 2k, and even 4k. You capture would be 2k, and downscaled on your 1080p panel. I think NVIDIA also has this feature, although I do not know how this is called.
Is there an option available to change the Pygame logo in the title bar of a Pygame window to my own program logo?
Yes, you can use pygame.display.set_icon():
pygame.display.set_icon()
Change the system image for the display window
set_icon(Surface) -> None
Sets the runtime icon the system will use to represent the display window. All windows default to a simple pygame logo for the window icon.
You can pass any surface, but most systems want a smaller image around 32x32. The image can have colorkey transparency which will be passed to the system.
Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set.
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.
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
Is there a way to control the brightness of the OS X desktop programmatically using Cocoa or Core Animation?
Create a semi-transparent full-screen view behind your main window.
In case you were actually interested in doing a fade-out or fade-in of the whole screen, here is a link describing how to do that.
The linked document contains examples for how to fade all displays (or a single display) to black (you can change the color), capture the display (where you can display what you'd like), and then fade back. This uses CGAcquireDisplayFadeReservation() mentioned in the comment to my other answer.
Is this more like what you were looking for?