Rotating an image, windows mobile, vb.net - General Questions and Answers

So I have been messing around with windows mobile development (in vb, don't hate me, i have grown accustomed to vb because of work). Anyways I come to a point where i would like to use the graphics object to draw an image and rotate it on occasion based on the state of the program. My instincts told me to use System.Drawing.Drawing2D.Matrix object to create that rotation but as it turns out it appears .net compact framework doesn't support that object.
So my question then is, is there any other method for rotating an image as i draw it. I can program in other languages as well if that is what is required, I was really only using vb because it was easy.
Any ideas?
Thanks

don't know about vb but
in c# i would look for an event to subscribe to
which would be fired when the orientation changed
or the resolution changed or some control resized

Sorry the question isn't related to orientation or resolution. I know when I want to rotate the image.
I will give more information, the image is a compass and I want to rotate the compass image based on GPS data received (Calculating the angles is not the problem either). Once I know that say I am 10 degrees off of north, i want to rotate the image of the compass so that north is still pointing north.
In my desktop development this would be done in vb or c# using the System.Drawing.Drawing2D.Matrix class, using Matrix.Rotate and them applying that matrix to the graphics object before i draw the image using graphics.drawImage().
Now the problem comes when I move to the mobile platform where System.Drawing.Drawing2D.Matrix does not exist and is appariently unimplemented. So then my question is, are there any other API's on the Windows Mobile Platform that support Rotation of an image by an arbitrary angle, and if not does any one have any good ideas where to start looking for implementing the rotation manually myself.
Thanks in advance

That's one of the annoyances with the .NET compact framework, not all of the PC .NET framework is implemented, and sometimes it's the bit you really want.
Time for a different angle on the problem. Create 36 compass images 10 degrees apart and store them all in an ImageList object. Pull the one you require out of it when the heading changes. Not quite as elegant as the Matrix class, but it may have to do.
The other approach would be to use DirectX drawing. The coding to do it, would probably involve a very steep learning curve, but not having dabbled in this arena yet, I can't offer much help.

The ImageList object in the .NET compact framework does not support ImageList.Draw(), (darn!, see previous post), so you would have to create a PictureBox object or similar and use :-
PictureBox1.Image = ImageList1.Images;
Where i is the index of the image you want to use. (0 to 35)

Thanks for the suggestions, I did end up predrawing the images of the compass. At the moment I went ahead and made 360 images but I am surely going to cut that down quite a bit. The question then becomes smoothness vs space. But either way you shake it it is working.

Related

Newb to C# question, trying to display jpg menu

I've been posting left and right on these forums since I got my new phone (Blackstone). I've done some programming before (c/++ and java) but mainly more scripting in Matlab and maple (if you can call the latter scripting ).
But since I've gotten my new HD, I've been wanting to program for it. So I thought my first program would be a simple but fun multiplayer game, which would allow me to learn c# in the process.
I've gotten hold of VS2008 through my uni, and a few different C# books (couldn't find a specific WM6 C# book though, and MSDN is a huge mess, what with obsolete libraries, mixing WinEmbedded and WinCE with compact.NET and a mess of unusefull and incomplete pseudocode).
So I've started through the books and it all seems kinda straight forward: classes are declared with their variables, the accessors/methods and constructors; you create an instance of the class and load in it's variables, then you draw them.
And now I'm stuck trying to just displaying a goddamned jpg.
I've attached my program code (VS2008 project) and the jpgs. What I'm trying to do here (before even getting started on the game logic) is just display a form with a background image, draw three menu buttons on top and a sound on/off button.
The start/options/exit buttons will lead to their respective forms, and the sound on/off button does just that.
What I've tried to do is create a new class. ImageBtn, which implements my button behaviour (show button, if pressed display pressedversion of the button and then perform action).
The Mash2 main() directs to MainmenuForm, which loads the bckgrnd and buttons using the mainmenufoprm.designer and the imagebtn class. The rest of the forms are placeholders.
Please, could someone who knows more of C# than me (ie practically anyone ) have a look at my Mash2.cs, FormMainmenu.cs and ImageBtn.cs to see what I'm doing wrong?
Am I not loading the jpg's correctly? Is my custom class not declared correctly? Is it a problem with my use of winArray? Or how I invoke graphics.drawimage?
I just have no idea, and what's more humiliating is that everything I look up on google gives me a different, badly written and obviously syntax incorrect example of how it should be done and they're all done using very different techniques.
PS: as I've said, I've attached my project files, but if people can't be bothered I could post the code inline. Also any links to WinMobile, compact.NET C# forums which could help would be much appreciated. Hell, any help would be a life^H^H sanity saver!

Possible convert my iPhone-app to Android?

Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
porting your iphone add to android
hi there,
i'm a android programmer and did many games already. you can see my games at:
not sure you still need help to port your iphone app to android. may be you can send me the source code. i can do it for you. very easy for me.
Tony Chan
[email protected]
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
chingy1788 said:
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
Click to expand...
Click to collapse
hehe well said
I don't think anybody can tell you what you need to do. Just start by reading through all of this: http://developer.android.com/guide/topics/fundamentals.html and you should be able to handle this.
Note: your application appears to be trivial.
One thing that I suggest is that you forget about locally-stored web pages and just rewrite those pages in Android/Java. The reason I suggest this is that unlike apple, you can't make any assumptions about what browser the user has installed (if any), or what rendering engine their browser happens to have, or javascript engine, etc. There are AT LEAST three different rendering engines in use on Android, including khtml, gecko, and presto. There are at LEAST two different JAVASCRIPT engines, including SquirrelFish and V8, and soon you will be able to add SpiderMonkey to this list (when Firefox launches). And no, you can't force your application to call on a particular browser since this would violate the modularity designed into the platform.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
look at the NDK
Freedomcaller said:
look at the NDK
Click to expand...
Click to collapse
The NDK is *NOT APPLICABLE*.
Why don't you create a converter from iPhone to Android? There are few Italian app.. only this is better than Android for Italian user.. but I love Android!
I have an app that has been created for android, and I need help creating it for the iphone. I'll share the source code if someone will create the app for me please.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
Is it possible to post this in the Q&A and not development section?
sparksco said:
Is it possible to post this in the Q&A and not development section?
Click to expand...
Click to collapse
This is from the first half of 2009, I highly doubt that they care where it should be posted (now).
Converting iPhone app to Android will be greate.
I would like to have All My Recipes iphone app in my Galaxy Tab
It was be great if somebody can port the secret of mana game from iphone to android ! =)

Visual Studio questions

1. How can i make WVGA application in visual studio? Largest screen option i can create is VGA (Windows Mobile 6 Professional VGA) and then there is blank area on bottom of application.
2. How can i make separate form for landscape/portait (so i can reorder elements when phone is in landscape)?
3. Is there any better emulator? Included one is slow and i cant set up anything that need soft reset (when i do soft reset, visual studio launch new emulator window, because old one "disconnected")
4. Is there any way to remove unsigned warning, when you test directly on PDA? Its annoying that i must confirm every time i want to test something.
Visual Studio Answers
1. Download the Windows Mobile 6.1.4 SDK it has a 400x800 device. Or download 6.5 for a device labeled WQVGA. The 6.5 Emulator is even slower than 6.1.
2. Don't bother with two forms, in the OnPaint (MFC..NET) or WM_PAINT (Win32) code read the size of the Client Area of the screen (GetClientRect() or Form.ClientSize) , then decide whether it is Landscape or Portrait and position the stuff on the screen exactly where you want it.
3. You are stuck with the stuff that MS releases, unless the phone manufacturers decide to release their own images. (Unlikely.)
4. If your EXE is unsigned the OS will turn its nose up at it, the first time it is run and ask you if you want to execute it. If it is recompiled the phone thinks it is a different program, and asks you again. Sign the image to stop it.
works just fine for me
in emulator options you can set the res to what you want
and in the size of your form you can set the size to what you want
if you're not up for altering the res yourself then you can dl the se x1 sdk it comes with a ready
wvga emulator
For # 1, you can download the complete developers toolkit here.
For # 2, if you mean how to change the emulator to landscape... go to File -> Configure -> display on the emulator and select the required angle in the Orientation field. Then you need to manually set the screen to landscape inside the emulator (Windows Mobile) by going to START->SETTINGS->SYSTEM->SCREEN and selecting LANDSCAPE. The emulator should change this automatically depending on the screen orientation, but it doesn't (?).
Don't bother with two forms, in the OnPaint (MFC..NET) or WM_PAINT (Win32) code read the size of the Client Area of the screen (GetClientRect() or Form.ClientSize) , then decide whether it is Landscape or Portrait and position the stuff on the screen exactly where you want it.
Click to expand...
Click to collapse
Can you please explain how to work with that?
it's only relevant if you do c++ without .net
Sorry about that, I was rushed, and it was a bit vague.
In Win32 your application is sent a WM_PAINT message when the window requires redrawing. In this case trap the message and then use GetClientRect() to obtain the dimensions of the client area. Depending on whether the screen is wider than taller, or vice versa, it will tell you the orientation of the screen.
In MFC or .NET the OnPaint event of the form is triggered. Add code in this event to examine the form's ClientSize property to find the same details. This is a Size object which has Height and Width sub values. i.e the width is Form.ClientSize.Width and the height is Form.ClientSize.Height. By comparing these values you can figure out the orientation.
This event occurs before the individual elements of the screen are drawn, so you can change their Left and Top properties to move them around to where you require them on the form.
I downloaded WinMobile 6.5 Development kit, but there was not WVGA option under FormFactor, only new emulators appeared. I solved problem with manually increasing form height.
Anyway, thanks for all information!

FUN APP: HD2 Pilot Flight Display using GPS

!! FUN APPLICATION, NOT INTENDED TO BE USED IN REAL WORLD AVIATION !!
For all those flight-sim enthusiasts out there: I have created this PFD (primary flight display) which shows the speed, the altitude the coards and the attitude similar to a real PFD display in an airplane cockpit.
Although the application has been created and tested on an HTC HD2, it might work on other devices as well. Internel or external GPS and the HTC G-Sensor are required. It is planned to add a serial communication channel to a PC server component which allows to use this little proggy with MS Flight Simulator displaying the flight parameters so you can get rid of the cockpit panel on your primary display.
Just keep in mind that this is the first version of the program, so there might be *some* improvement potential.
A screenshot of the program is also attached.
Pls let me know what you think about it.
Thanks.
As a pilot I cannot find any sense in this, sorry m8.
Useless for aviation.
Useful might be an HSI-App, an RAIM-availability-check-App, a NOTAM-APP and so on. An artificial horizon on a handheld device... No, not good...
Title correction...
It is just for fun, not intended for real world aviation.
I will change the title so that it becomes more clear.
As an airbus pilot I like it! Lots of scope for further development, keep up the good work !
when I read your discrip, I had something totaly dif pictured in my mind. guess Im falling back on my sail plane lesson days.
I had round face dial and a yaw bubble pictured.
While this is cool, I would prefer to see the old analog style with an altimeter that you can set your start altitude and a yaw bubble, rather than the HUD style. just IMO.
And yes this is just for fun.
Keep it up, I will follow your project with intrest.
cheers
Good Work mate
While some are critical in their opinion I'm pleased with your app.
Keep up the good work mate and for all others who are not so encouraging ...... what do you want for an app a full blown flight simulator, the guys making an effort to develop something and sharing it for a free with us so to help him out at least .... I mean at least encourage him and make some constructive criticisms.
It doesn't cost to be nice and help to motivate others...........
Customize it
Just as a hint for those of you, who would want to use other bitmaps. I have designed the application in a way which allows you to modify or extend it. If you look into the applications program folder, you will find an XML file describing the layout of the display. You may also change or add bitmaps. The bitmaps are all located in the
HTML:
resources
subfolder. If you change the size of the offset of bitmaps, you will have to adjust some values in the XML file as well.
As you can see there all items are drawn in 3d space.
However, I am working on a HSI as suggested before. I will post it later this week.
Known issue:
- After running the application 3 or 4 times, OpenGL is not working properly anymore (not able to create rendering context). This is an issue of OpenGL. You have to restart your device for OpenGL to work again. If anyone has a solution, please let me know.
leihen said:
It is planned to add a serial communication channel to a PC server component which allows to use this little proggy with MS Flight Simulator displaying the flight parameters so you can get rid of the cockpit panel on your primary display.
Thanks.
Click to expand...
Click to collapse
That would be awesome!
Cool app
Certainly would be better than no attitude information in the event of a vacuum and/or elec failure.Even if just to make flying the performance instruments a bit easier.
I would defintely like to see a HSI app possibly with an open (editable)waypoint database.Anyone interested!?
Keep up the good work!
I love it. Thanks so much...
I just wonder if settings could be made permanent until being changed again so as to start the application without my having to select REAL and AVERAGE everytime.
And as a proud HTC HD2 owner, the display could me made much
larger indeed...
Congratulations and thanks again.
This is a fine app with a lot of potential esp. for UL-pilots as an emergency backup if UL-airplane-pfd fails.
Would be nice if indicators are bigger and the layout equals to Flymap, Skymap or MGL-layout
There is enough place for a nice big yaw indicator. Maybe You can get some code from GPS-tracker V2.0 (MooNah) in this forum, it already has a full working PFD incorporated.
Good luck with further devs., when next version is online I will try it in my gyroplane.
I think it's fun!!!!!
next step: build a flightsim for wm where we could use this
You will be in real danger....if you do so.
troed said:
This is a fine app with a lot of potential esp. for UL-pilots as an emergency backup if UL-airplane-pfd fails.
Would be nice if indicators are bigger and the layout equals to Flymap, Skymap or MGL-layout
There is enough place for a nice big yaw indicator. Maybe You can get some code from GPS-tracker V2.0 (MooNah) in this forum, it already has a full working PFD incorporated.
Good luck with further devs., when next version is online I will try it in my gyroplane.
Click to expand...
Click to collapse
As you will easily see, this PFD horizon responds to gravity, that is, to the accelerometers installed in the phone.
It has no gyros, no way to provide PITCH ATTITUDE, WHATSOEVER.
If you keep the phone perfectly vertical and quickly move forward (accelerate) it will SURELY show a pitch up...pretty much the same effects that a stand-by compass shows when changing speed (remember that?...accelerate-north, decelerate-south).
You will have the very same pitch information as the one given by a bottle full
af water suspended from a string, or a can of Coke : and it will KILL YOU as well as your passengers (if any), not to mention people on the ground.
The only usable parts of this FUN APP (as named by the author himself ) in aviation are:
1. True track (not magnetic heading).
2. Altitude (neither QNH, nor QFE related, but of course; unless your flying field happens to be at sea level and actual atmosphere matches the ISA atmosphere parameters exactly). Remember that QNH variations as well as heat will make the GPS readings very different to that of your altimeter, as height of the air column will vary a +/-4% every +/-10 degrees Celsius.
Example. Airplane flying at Flight Level 300. QNH in the area 1023. Terrain at 2000 feet. Atmosphere is ISA+15.
Therefore if we move the 1013.25 setting to 1023 there will be a reading increase from 30.000 feet to 30300 (calibrated altitude, QNH related).
That is 28.300 feet above ground (we start with this as the air column height for the calculation). Since ISA is +15 we add 15/10 times 4% and we have 28300*15/10*4/100= 1698. True altitude is 30300+1698=31988
So we are cruising at FL300, 30.000 feet pressure altitude, 30.300 feet calibrated altitude (QNH related), 31988 above sea level, 29988 feet above ground level.
GPS WILL SHOW 31988 FEET.
3. Ground speed ( neither IAS nor CAS nor EAS nor TAS), as provided by GPS system. Remember that your airplane aerodynamics are related to calibrated speeds....you will stall if too slow ore destroy the airframe if to quick !!!! But you can navigate and make good your track, of course.
Hope I have made myself understood....and that you read this at the earlier !!!
Hi!
It quite very good if the second part under we have the route. I am using the Oziexplore program, it can creates the route, and apear on screen. if this soft applied to that once, could be perfected!
Thanks
great app mate..just for fun...
Nice work thank you. On future can you make like pilot cocpit with all dash boards like in Flith simulator game if this possible. Thank you
leihen said:
!! FUN APPLICATION, NOT INTENDED TO BE USED IN REAL WORLD AVIATION !!
For all those flight-sim enthusiasts out there: I have created this PFD (primary flight display) which shows the speed, the altitude the coards and the attitude similar to a real PFD display in an airplane cockpit.
Although the application has been created and tested on an HTC HD2, it might work on other devices as well. Internel or external GPS and the HTC G-Sensor are required. It is planned to add a serial communication channel to a PC server component which allows to use this little proggy with MS Flight Simulator displaying the flight parameters so you can get rid of the cockpit panel on your primary display.
Just keep in mind that this is the first version of the program, so there might be *some* improvement potential.
A screenshot of the program is also attached.
Pls let me know what you think about it.
Thanks.
Click to expand...
Click to collapse
Indeed as an Ultralight-Gyroplane-Pilot I like this app and since the Horizon-tab in GPS-Tracker by MooNah doesn´t work right now this could be alternative as a a last resort-backup if glass-cockpit instruments (MGL-Avionics) fail ...... (better to have this than nothing at all and I also have Flymap PPC on my HD2 if main Moving map Nav. fails)
This app has great potential since it reads the infos from G-sensor and GPS.
For the future dev. if I might add my wishlist:
1. Add to screen: slide-indicator and compass, Altitude
2. slightly more refined graphics
As a start: BRAVO, hope You have the patience to go on developing this nice app ( like Dunc001, that made in 100s of hours of work a professional weather app - Duncans Weather Panel - see there - that is more reliable than many professional aviation weather briefings).
I bookmarked this thread and hope for further developments by U
Congratulations
like the Android solution ixGyro:
http://www.ixellence.com/index.php?option=com_content&view=article&id=227&Itemid=274&lang=de
JHimmelbauer said:
like the Android solution ixGyro:
http://www.ixellence.com/index.php?option=com_content&view=article&id=227&Itemid=274&lang=de
Click to expand...
Click to collapse
Jepp, EXACTLY THIS would be cool on the HD2 on WinMo (Android not running on mine) !!!!!!!!!!!!!!!!!!!!!!!!!
troed said:
Jepp, EXACTLY THIS would be cool on the HD2 on WinMo (Android not running on mine) !!!!!!!!!!!!!!!!!!!!!!!!!
Click to expand...
Click to collapse
a other solution for Windows Mobile is "Inclinometer77" -
visit http://forum.xda-developers.com/showthread.php?p=6677074
This App goes in the right direction, but unfortunately not to use without Gyro in a Plane, but a nice game for pilots ;-)
Happy Landings

[Q] Desktop simple viewer

In order to develop an app remote desktop WP7, I started to with a desktop simple viewer and it works
but the problem that not show all actions that I do in Server side, that's video in YouTube can show you my problem
"watch?v=3q-FumfYsPQ&feature=youtu.be" (add it after /)
I use socket connection and I decode and encode my data (images).
this my code in WP7 client side
void Conncet(string IP_Address) {
client_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs()
{
RemoteEndPoint = new IPEndPoint(IPAddress.Parse(IP_Address), 4532)
};
socketEventArg.Completed += OnConncetCompleted;
client_socket.ConnectAsync(socketEventArg);
}
void StartReceiving()
{
byte[] response = new byte[131072];
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.Completed += OnReceiveCompleted;
socketEventArg.SetBuffer(response, 0, response.Length);
client_socket.ReceiveAsync(socketEventArg);
}
private void ViewReceivedImage(byte[] buffer)
{ try { MemoryStream ms = new MemoryStream(buffer);
BitmapImage bi = new BitmapImage();
bi.SetSource(ms); MyImage.Source = bi;
ms.Close();
}
catch (Exception) { }
finally { StartReceiving();
} }
this my code in Server side (PC) sending images
void StartSending() { while (!stop)
try
{
Image oldimage = scr.Get_Resized_Image(wToCompare, hToCompare, scr.GetDesktopBitmapBytes());
//Thread.Sleep(1);
Image newimage = scr.Get_Resized_Image(wToCompare, hToCompare, scr.GetDesktopBitmapBytes());
byte[] buffer = scr.GetDesktop_ResizedBytes(wToSend, hToSend);
float difference = scr.difference(newimage, oldimage);
if (difference >= 1)
{
SenderSocket.Send(buffer);
}
}
catch (Exception) { }
}
My question is how can I make the send and receive fast to show the PC screen in WP7 in +/- real time.
The short answer is, you can't. Even if you compress the screen images first, which I note you're not doing, the amount of data is just too great. An uncompressed 800x480x32-bit image (such as WP7's screen can display) is 1.5MB. That's each frame. You can halve that by using 16-bit color, of course; now it's .75MB per frame. If you want even 20 frames per second - which is slower than TV or almost any video camera, but is moderately smooth for most things - that's 15 MB/sec, which is 120Mbps (about twice the speed of most WiFi, faster even than most wired networks).
With some simple image compression combined with clever data differencing (sending only the parts of the image that change), you could probably reduce that data load by at least a factor of 10. That's still too high for most Internet connections (even if your phone can download 12 Mbps, your PC probably can't upload it) but it might be usable over WiFi (802.11n probably, 802.11a or g maybe). You'd have to make your code quite a bit more complicated, of course. Additionally, the phone's processor would have to work a lot harder, since it would be decompressing the data and applying it to the changed part of the frame, instead of just dumping netowrk packets into an image buffer.
The real solution, of course, is to use one of the several programs and protocols that already exist and have the intended purpose of doing exactly what you're trying to do. The most common on Windows is called Terminal Services or Remote Desktop (Remote Desktop Protocol). Nearly all versions of Windows come with the client, and the better editions come with the server. On WP7, there are already some client apps available; the one I use is called "RemoteDesktop" (no space). Note that, in addition to having a well-optimized algorithm for screen updates (but it's *still* not going to be smooth for things like movies or games), Remote Desktop Protocol lets you control the PC directly as well.
Thanks
I look that's apps in marketplace and it looks very difficult to me, but I develop simple viewer and next time I will develop the code that can remote the PC.
the idea about send only that pixels that changed between the old image and the new image is really good, but how I ca send only that pixel and they're position in the image, that's a question.
And about compression, how I can do that with images?
Well, just compressing the full screen to .PNG or .JPG and sending it would shrink things considerably. There are .NET libraries available (there might even be one in the core library) for image compression. Alternatively, there are some excellent C/C++ libraries available, if you can code native interop. I know the phone has built-in capability to handle JPG, not sure about PNG though.
However, once the data is compressed it's hard to extract a part of it and send just that part. What I suggest you do instead is identify the portion of the image that changed. For example, if all the changed pixels fall within one rectangle, use that. Send the coordinates of the rectangle (its origin and either the opposite corner or the length/width), followed by the updated data. On the phone, listen for the rectangle to update, then write the updated data into those coordinates on the display.
Note that you may want to send multiple rectangles - for example, if the top left nd bottom right pixels change, but nothing else does, a single rectangle that encompasses both of them would have to be the entire image. Instead, send two tiny rectangles - one for each corner - and you can massively reduce the data needed. However, the process of quickly detecting a good way to break up an image into the parts that are and are not moving is tricky. You're essentially trying to create a video compression algorithm here, and although I know a little of the theory, it's totally not my area and I don't know much more than what I've told you so far.
Thanks again
I found something similare to know the pixel that chaged
Image Comparison using C#
http://www.c-sharpcorner.com/uploadfile/prathore/image-comparison-using-C-Sharp/
I will try to study it and get information how to set the coordinates, but the problem that stay is how I send it to the right position in image in client side
juste_3al_faza said:
I look that's apps in marketplace and it looks very difficult to me
Click to expand...
Click to collapse
I don't understand that. What is "difficult"? Enable RDP access on desktop? Or add your desktop ip address to the WP7 app? Take a look to the RemoteDesktop app by Topperware: it's fast, professionally designed and easy to use but of course not a free (however $4.99 is not much!)
As for me, it looks like you are trying to "invent a bicycle" but without basic knowledge how the remote access protocols should work. It's not that easy like just a transfer bitmap images via sockets...
I mind I don't need to use it, I want to develop a simple apps because its my project and I will get a note and pass my last year in school
juste_3al_faza said:
I mind I don't need to use it, I want to develop a simple apps because its my project and I will get a note and pass my last year in school
Click to expand...
Click to collapse
Now I understand OK, I can recommend you to dig in MJPEG. There are few Silverlight classes available on the web (you may google em); they may simplify your job. The picture quality isn't good or sharp enough but should be good for the student project.
you talk about compression images to mpeg????????????
have you an idea when I zoom In image in WP7, most image be clear to see, how I can do it?
Edit (After see the article about MJPEG silverlight)
It use the HTTP connexion and I use socket, It can work together?
If yes how I can combine with it (plz a sample code can help )
No, I'm talking about M(otion)JPEG over HTTP, easiest possible video streaming implementation. For the solution, you need to implement your own M-JPEG HTTP server application, and on WP7 you may use (it's already exists, google for MJPEG MediaStreamSource) MediaElement. And I don't understand your second question.
I already edit my previous post
and about the 2nd question, I mean when to pinch in WP7 screen, is the image will be clear or not.
I don't have time to write an example for you; however it's your project or homework , I just give you a direction.
As for seconds question (as far as I understand): it's depends from the image dimensions and JPEG compression level. If you resize 1920x1080 image to 800x480 with 50% quality, resulting image will looks not so good.
P.S. Check this project: http://mjpeg.codeplex.com/ To estimate output quality on Wp7, you may use any MJPEG desktop streaming solution (vlc, for example).
Thanks a lot
I finished my app and it work good, see the video
http://www.youtube.com/watch?v=cCwsuj7Hcno
Cool. Looks like you get about a frame per second, which won't work for showing a video but is fine for a Powerpoint or something, and a decent proof of concept.
I'm not sure I'd recommend demoing using a video showing a commercial movie with a clearly visible "Uploaded by..." comment, at least in the USA schools tend to frown on open displays of media piracy. Otherwise, well done.
Ok next time I will use PowerPoint to use my app show

Categories

Resources