Monday, September 28, 2009

Improvements

After reading Vincent's comment on my last post, I took a second look at the scrolling code and scuttled the InvalidateRect scrolling mechanism. The fact is that while on some older devices this did work in an acceptable fashion, it did not work that well on more recent models and you can actually see some "bumps" in the scrolling speed. The code now uses a timer (again) but instead of indirectly painting the window through the InvalidateRect / UpdateWindow calls, it now directly invokes the painting function. The result is a very smooth scroll on all devices I have tested the code with.

I also changed the way the ScrollLeft and ScrollRight view transitions work. Instead of painting the bitmap at full speed, I added a very small sleep period to each iteration so that each transition is performed in approximately 250 milliseconds. The first paint operation is timed and a per-iteration sleep period is calculated so that the whole process takes the quarter-second period to unfold. With this improvement, you will be able to see the view transition on all devices (especially the ones with a faster CPU and QVGA screen).

Finally, I decided to add a couple of new view transitions: Fade and Explode / Implode. The first transition uses the AlphaBlend API function to fade from the existing view to the new view (like in a Power Point presentation). I have to say that this is not a very compelling transition, but inspired me to write the second. The Explode / Implode view transition also tries to mimic one of the most famous iPhone view transitions (when you launch an application). The existing view is zoomed in while the new view fades in while also zooming in from half its original size. The Implode effect does the reverse. The result was a bit disappointing because AlphaBlend operation seems to be very greedy (you can replace it by a simple StretchBlt and compare the results). The GDI is not very good at this stuff, unfortunately...

Sample code: CrypSafe06.zip (323KB)

9 comments:

smartmobili said...

Great a new version!
So I download, then I convert into VS2005 and I click on Build :

OleDbClient is still using full path so I have replaced it by
..\wmtypes;..\wmfw

Then missing include :

1>.\Rowset.cpp(5) : fatal error C1083: Cannot open include file: 'BlobStream.h': No such file or directory


So finally I removed oledbclient from solution and I was able to test.

On my device it doesn't work at all, I mean when using finger it never works and even with my stylus it's very random.
I will do a video to show you the result.

Tansition speed is very slow and maybe you should try SDL/opengl es/DirectDraw/guichan ...

João Paulo Figueira said...

That is a very strange experience. Is it possible that I published some faulty code? What device are you using, BTW?

João Paulo Figueira said...

I forgot to remove the scrollbars! They are still there, although invisible...

smartmobili said...

I am testing on a SHARP WS027SH with a resolution of 480x854(device not yetr released and running WM6.5).

João Paulo Figueira said...

I'm wondering if you are experiencing some interference with the WM 6.5 Physics engine. Concerning the slowness of the view transitions, please test with a different screen rotation (some screen orientations are slower). Looks like I need to get my hands on a 6.5 device...

Unknown said...

Hi João,

Great to see how you are progressing on this and your design decisions.

I'm also really interested in transitions - you might want to check out OpenGL ES - there is a great open source mobile graphics library, Vincent3D that you might find useful.

http://www.vincent3d.com/Vincent3D/software/ogles1/ogles1.html

cheers
Bruce

smartmobili said...

I would add that I am maitaining vincent3d openglES and I make it evolves with latest Khronos specifications.
Please let me know if you want to have access, I have ogles/glues/glutes and a wtl class to use it.
I am writing a 2d drawing api based on opengl es and now I start to think that iPhone quartz api is based on it.

apps4all said...

You are doing a very good job. Did you think to create a more complete framework for creating amazing apps for WinMo?

João Paulo Figueira said...

Creating a framework is the idea, but lately I have had little time for it. Apparently this is getting some attention, so I'm vowing to devote more of my time to this. Thank you for reading the blog and providing feedback!