Some help with autoscaling please!

HARRY

Active Member
Licensed User
Longtime User
Hi,

I have a program running on my old PDA in landscape (320*240) and I want it to run on my new PDA in landscape (800 * 480). For the time being, forget the extra width, so say 640 * 480. Also I want the best image quality possible.

Reading the documentation on Autoscale and studying the examples on NativeImage and NativeFormImage I get totally confused.

A simplified version of that program looks as follows:

Sub Globals
'Declare the global variables here.
Dim OrigOrientation
End Sub

Sub App_Start
AddObject("OrientateObj","pachScreen")
OrientateObj.New1
If cPPC=True Then
OrigOrientation=OrientateObj.Orientation
If OrigOrientation <> 1 Then OrientateObj.Orientation=1
End If
Form1.Show

AddObject("Bitmap1","BitmapEx")
Bitmap1.New1(AppPath & "\" & "google3.bmp")

AddObject("RectSrc1","RectangleEx")
RectSrc1.New1(0,0, BitMap1.width, Bitmap1.height)

AddObject("RectDes1","RectangleEx")
RectDes1.New1( 50, 55, 160, 120)

AddObject("Drawer1","DrawerEx")
Drawer1.New1("Form1",False)

Drawer1.DrawImage(Bitmap1.Value,RectSrc1.Value,RectDes1.Value,False)
Drawer1.RefreshForm2("Form1",RectDes1.Value)
End Sub

Sub Form1_Close
If cPPC=True Then
If OrientateObj.Orientation <> OrigOrientation Then
OrientateObj.Orientation=OrigOrientation
End If
End If
End Sub


Could somebody help me to change this program in order to take advantage of the higher resolution of my new PDA?

Thanks in advance,

Harry
 

agraham

Expert
Licensed User
Longtime User
Drawing directly on a Form as you are doing will not give you native resolution when AutoScaled as the Form image is itself AutoScaled from an internal size of 240 x 320. NativeFormImage replaces the internal AutoScaled bitmaps by native sized ones.

The does most of what you want, working through that code to understand it will tell you more than I can in words here. The main difference is that that code it is not drawing an image like you want. If you want your app to work on a normal size screen you will need to scale your destination Rectangle as shown in NativeFormImageDemo or if it will only run on the larger screen then just use the native size coordinates.

Have you read the topic on AutoScale in ControlsExDevice help?

EDIT:- I've just noticed a scaling ommission in NativeFormImageDemo. Line 60 should be
Rect1.X = Rect1.X + 30 * FixX
 
Last edited:

HARRY

Active Member
Licensed User
Longtime User
Hi Agraham and dlfallen,

I do not succeed in getting my program running with NativeImage controls. Also I tried to modify the sample to reach the result wanted. Without success.

The code in my first message stretches or shrinks the pictures as required to fit in the receiving rectangle.

I cannot find how to do that with the NativeImage controls. Drawer.New1 cannot be used, Drawer.New2 does not accept the two rectangles.

I wonder whether it is worth all troubles, as I only use images. The program runs now on the VGA device, just compiled with AutoScale, and the pictures look pretty good. I doubt whether they will look still better using NativeImage controls. This could be true if the pictures first are shrinked to QVGA dimensions and then stretched again to VGA, which is hard to believe.

Still I hate that I do not succeed.

What version of Windows Mobile 6.5 Developer Tool Kit do I need; the Standard or the Professional version. (I have shortage on disk space on my laptop)?

Harry
 

agraham

Expert
Licensed User
Longtime User
The code in my first message stretches or shrinks the pictures as required to fit in the receiving rectangle.
The code in your first message does not use NativeFormImage so you won't get native resolution from it. If you post a a runnable app, including images, I'll look at modifying it to use native resolution.

What version of Windows Mobile 6.5 Developer Tool Kit do I need; the Standard or the Professional version. (I have shortage on disk space on my laptop)?
To do what?
 

HARRY

Active Member
Licensed User
Longtime User
Hallo Agraham,

Very kind that you will try to get it running with NativeImage. I prefer that over NativeFormImage. Attached you will find a zip file containing all stuff required, except the image file, because of file size restrictions. I hope you have a picture file with a width/ height ratio of 4:3 larger than 320 * 240. It should have the name: P1030286.JPG

I understood from dlfallen that the Windows Mobile 6.5 Developer Tool Kit contains the emulators to test programs for PDA's with various screen sizes on a PC.

Harry
 

dlfallen

Active Member
Licensed User
Longtime User
Hi Harry,

My understanding about the Windows Mobile 6.5 Developer Tool Kit is that the professional version is for touchscreen devices, and the standard is for non-touchscreen devices. I only installed the professional version and that works very well for touchscreen emulation.

regards,
Dave
 

HARRY

Active Member
Licensed User
Longtime User
Hallo Agraham,

Many thanks. It works very well now. It is much more simple than I thought. May be it is a good idea to add your demonstation program to the library as a sample. The other samples do not deal with images, but mainly with text, brushes, etc..

Harry
 
Top