AutoScale Questions

Discussion in 'Beta Versions' started by corwin42, May 8, 2009.

  1. corwin42

    corwin42 Expert Licensed User

    Hi,

    I'm a bit confused about the AutoScale compile option. If I compile with AutoScale:

    If I use form.Line() to draw on a form will the parameters be fixed automatically or must I multiply them with screenX/screenY?

    I have a program that uses the ImageLib.Drawer and the Rectangle object to draw a few graphics. For this I calculate all coordinates relative to form.width and form.height. Are the coordinates for the rectangle object automatically fixed or not? I think they should not get fixed automatically for my program to work correctly.

    What is with old libraries with custom controls. I think they won't fix anything automatically. Will they work with AutoScale if I just call them with all position and size parameters multiplied by scaleX and scaleY?

    I think I have to try the WM Device Emulator to test my program with VGA. :-(

    Greetings,
    Markus
     
  2. agraham

    agraham Expert Licensed User

    As long as all the controls used in your application support AutoScale you don't need to wory about it in your code. It is a way of running code written for QVGA screens on VGA screens without changing anything. The only thing you will see different on a VGA screen is that graphics quality is somewhat diminished and graphics text might rendered a slightly different width.

    Only control authors need to worry about AutoScale. All the intrinsic controls in Basic4ppc version 6.76 are AutoScale aware and all my libraries, where necessary, will be reissued as AutoScale aware when the Basic4ppc version 6.80 is officially released.

    They will need updating to be recognised as AutoScale aware controls. This is necessary in order to have their Left, Top Width and Height properties automatically adjusted and they may need some internal code changes as well. You can use them without them being updated but in an AutoScaled application you will need to resize and reposition them according to ScreenScaleX/Y as they won't be resized automatically. Other code involving them may need to changed depending upon the individual control.

    Another reason you might need ScreenScaleX/Y is if you are writing your application to be both QVGA and VGA aware and want to do the screen resolution compensations yourself and are not going to AutoScale compile it.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    The parameters will be fixed automatically.
    The new ImageLib library will handle correctly the scaling and look the same on VGA and QVGA devices.
    All official libraries except of Sprite properly support AutoScale mode.
    In most cases it is not complicate to update existing libraries to support this mode. Agraham has already updated several of his libraries. I hope that eventually most of the libraries will support it properly.
    This is not something that can be avoided. Luckily such emulators are available for free: Download details: Microsoft Device Emulator 3.0 you will also need to download the VGA device image.
     
  4. corwin42

    corwin42 Expert Licensed User

    Ok, I tested my program on the VGA Device Emulator and erverything looked as I expected. Everything got scaled correctly except for the Listview control from Filippo which is currently not updated for AutoScale.

    I only had to multiply the coordinates for the Listview control with ScreenScaleX and ScreenScaleY and everything looks good on VGA and QVGA.

    There is only one thing: The graphics I do with Imagelib (mainly rectangles) look blurred in VGA. Is this normal? I will test it on a real VGA device next week to see how it looks there.

    Greetings,
    Markus
     
  5. agraham

    agraham Expert Licensed User

    Yes. This is the effect I referred to "graphics quality is somewhat diminished" in my post above. It is because the QVGA sized bitmap you are drawing is being stretched to fit VGA resolution. In the AutoScale aware version of ControlsExDevice there will be a NativeImage control that you can use in an AutoScaled application to get VGA graphics quality if this is important to you, but your code will need to do its' own Bitmap size and drawing parameter corrections to suit the device you are on.
     
  6. corwin42

    corwin42 Expert Licensed User

    It seems that hardware.SIPHeight does not scale correctly in AutoScale applications.

    I want to size a panel the same height as the area which is not overlapped by the SIP. I used the folllowing code to calculate the height (fMain is my form, pMain is my panel, hw is a hardware object):

    Code:
    If hw.SIPEnabled Then
       FormHeight = fMain.Height - hw.SIPHeight
      
    Else
       FormHeight = fMain.Height
      
    End If
     
      pMain.Height=FormHeight
      pMain.Width=fMain.Width
    On a QVGA device it works well. On a VGA device the SIPHeight is substracted twice from the FormHeight so the panel is too small.

    I have to use
    Code:
    FormHeight = fMain.Height - (hw.SIPHeight / screenScaleY)
    to get the correct height for the panel.

    Greetings,
    Markus

    @agraham: Is the AutoScale aware library of ControlsExDevice available somewhere?
     
  7. agraham

    agraham Expert Licensed User

    It's ready but I want to test it against the release version of Basic4ppc v6.80 before posting it.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Hardware.SIPHeight will be fixed. Thanks.
     
  9. klaus

    klaus Expert Licensed User

    I have some trouble with AutoScale with the RectangleEx objects from the ImageLibEx library with the Width and Height parameters, their values become smaller than expected.
    I think this will be fixed in the final version. But nevertheless I submit the problem.
    Attached 2 programs, one showing the problem one without but with in code scaling.

    Best regards.
     
  10. agraham

    agraham Expert Licensed User

    It's nothing to do with RectangleEx, it's a Form refresh problem. If in GraphicsAS you remove any references to ScreenScaleX/Y from lines 29 and 30 and change line 57 to "Form1.Refresh" then it will behave as you expect and the code will look identical to an unchanged QVGA app. That's the whole idea of autoScale.

    If you were using ImageLib then ImageLib.Refresh would work because ImageLib.Refresh is Autoscale aware and so knows to refresh a larger area of a Form when AutoScaled on a VGA device.

    The downside to AutoScale is in displaying graphics as they are zoomed from QVGA to VGA size and lose crispness as a result. I aim to get the best of both worlds with two new graphics controls in the next version of ControslExDevice. Attached is a help file extracted from that for the next version of ControlsExDevice describing how AutoScale works, its' limitations and the two new graphics controls.

    I don't at the moment intend to make ImageLibEx AutoScale aware intending it to be used with the two new controls in full VGA applications or semi-AutoScale aware applications that take advantage of AutoScale for control layout but are resolution aware to obtain the highest graphics quality. Such applications will need to work in native graphics resolution so will be capable of using VGA co-ordinates when necessary rather than having some of the co-ordinates altered automatically so possibly causing confusion.
     

    Attached Files:

    Last edited: May 22, 2009
  11. klaus

    klaus Expert Licensed User

    Hi Andrew,

    Thank you for the tips and clear explanations.
    I will 'play' with the new controls as soon as version 6.8 will be released.

    Best regards.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice