Page 2 of 3

Re: Virtual screen

Posted: Tue Feb 14, 2017 1:34 pm
by rdonnay
eXpress++ scaling doesn't work with graphic images.

This must be handled at the OS level.

Re: Virtual screen

Posted: Tue Feb 14, 2017 2:06 pm
by Auge_Ohr
unixkd wrote:You can never know the type of screen resolution that your would be client will have.
Right ... so try to think "other" Way

my Calendar Listview have "fix" Row for 24 Hour / Day.
now i let User choise Font/Size in Setup.

than i calculate, using GraQueryTextBox() / GetTextExtentPoint32A(), how much space i need for a Refence SLE -> Scale Factor

so User have to choise a Font which let him see hole Form. :liar:

as Roger say you have to begin with smallest Font/Size which can be scale up.
also all your GRA painting should recognize "real" native Screens Size.

Re: Virtual screen

Posted: Tue Feb 14, 2017 2:21 pm
by Auge_Ohr
Eugene Lutsenko wrote:But my question was different: if the program already creates an image with high resolution, is there a way to display it on the screen with the lower resolution scale it to a smaller resolution, and after that display?
if you have a Image on SDD/HDD than you just have to GraBitBlt() to resize it.

but you are "painting" your own Image and if your DC ( Device Context ) is shorter it will not display.
same like a Printer if you "print" outside Paper, both give wrong Result.

---

User can also use Windows Build Scale so Xbase++

Code: Select all

AppDeskTop():CurrentSize()
is not "native" Monitor Size !

remember that all "Windows" since Vista a "paint" from DWM so they a "virtuell". this is why

Code: Select all

nLogPixX := GetDeviceCaps(hDC,LOGPIXELSX)
will always return 96 which is wrong.
you need new Constante to get "native" Monitor Size to calculate Scale

Code: Select all

#define HWND_DESKTOP  0  
#define LOGPIXELSX 88 
#define LOGPIXELSY 90 
#define HORZRES 8 
#define VERTRES 10 
#define DESKTOPVERTRES 117 
#define DESKTOPHORZRES 118 

LOCAL aSize := AppDeskTop():CurrentSize()
// ot4xb Syntax
LOCAL hDC := @user32:GetDC( HWND_DESKTOP )
LOCAL nXLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSX )
LOCAL nYLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSY )
LOCAL nVERTRES   := @Gdi32:GetDeviceCaps( hDC, VERTRES    )
LOCAL nHORZRES   := @Gdi32:GetDeviceCaps( hDC, HORZRES    )
LOCAL nDHORZRES  := @Gdi32:GetDeviceCaps( hDC, DESKTOPHORZRES ) // native Monitor Size !
LOCAL nDVERTRES  := @Gdi32:GetDeviceCaps( hDC, DESKTOPVERTRES ) // native Monitor Size !
here same DLL Function in pure Xbase++

Code: Select all

DLLFUNCTION GetDC( nHWND ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ReleaseDC( nHWND, nHDC ) USING STDCALL FROM USER32.DLL
DLLFUNCTION GetDeviceCaps( nHWND, nIndex ) USING STDCALL FROM GDI32.DLL
to "overrule" User Windows Build Scale i recommend to made your Xbase++ App DPI-Aware and enhance Manifest File with

Code: Select all

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
       <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
           <dpiAware>true</dpiAware>
       </windowsSettings>
  </application>

Re: Virtual screen

Posted: Wed Feb 15, 2017 12:23 am
by Eugene Lutsenko
Jimmy!

And could you post a working example that you can compile and try. The big picture is formed, but is not displayed and scaled with fewer pixels and then displayed.

Re: Virtual screen

Posted: Wed Feb 15, 2017 1:15 am
by Auge_Ohr
Eugene Lutsenko wrote:And could you post a working example that you can compile and try.
do not understand what you want me to do ...
i just try to explain what work have to be done to get a Scale able Xbase++ App
Eugene Lutsenko wrote:The big picture is formed, but is not displayed and scaled with fewer pixels and then displayed.
:?: :?: :?:
it sound like i say before : you can't use a bigger DC (Presspace) than Monitor native have !

Re: Virtual screen

Posted: Wed Feb 15, 2017 4:42 am
by Victorio
Eugene wrote :
But my question was different: if the program already creates an image with high resolution, is there a way to display it on the screen with the lower resolution scale it to a smaller resolution, and after that display?

If you need display only graphics images, can you do something like this ?

generate image (for example 2000x2000 pixels)
resample image to lower resolution (for example 600x600 pixels to preserve x-y , and this lower resolution you set by max resolution monitor)
show resampled image

Because I send you JPEG Resampler link, which know resample JPEG files to several types, set resolution, set size x,y pixels, size file etc.
Exist many resampler application, then you must run it with runshell as external app.
Best will be resampling by command line, if some soft has this support, and user not need know about processing resample.

Re: Virtual screen

Posted: Wed Feb 15, 2017 7:30 am
by Eugene Lutsenko
Unfortunately, this assumes that the high resolution image exists. But the whole point is not to create it by the program execution with displaying on the screen, just somewhere in memory. And then to scale with the reduction and only then display.

Re: Virtual screen

Posted: Wed Oct 09, 2019 3:25 pm
by unixkd
Hi Roger

You promised to write a sample on the above topic, any one available now ? This problem is still hanging

Joe

Re: Virtual screen

Posted: Wed Oct 09, 2019 5:24 pm
by Auge_Ohr
hi Eugene,

have you try to run "virtual" System :?:
you can change Resolution in "virtual" System but Maximum ist Host Resolution when used "Full Screen".

it is Window which will not display what is "outside" of Monitor Resolution

when connect a 2nd Monitor your Windows Desk expand and you got bigger Resolution.
there is also Software for "virtual" Desktop but you need real Monitor to get bigger Resolution "as one Screen"

---

Windows can Scale UP but not Down ...
when reduce from 1920 x 1080 to 1024 x 768 all must reduce and your Font go from e.g. 12 Point to 6 Point so hard to read :geek:

---

when use a Static which is bigger as Drawingarea than Dialog Window become Scrollbar.
so you can use a Static with 1920 x 1080 as Parent for your Control.
if Monitor is to small User have to use Scrollbar ... :whistle:

Re: Virtual screen

Posted: Wed Oct 09, 2019 6:12 pm
by rdonnay
You promised to write a sample on the above topic, any one available now ? This problem is still hanging
Try this:

Code: Select all

aScreenArea := DC_GetWorkArea()
aWindowSize := oDlg:currentSize()

nScale1 := (aScreenArea[3]-aScreenArea[1]) / aWindowSize[1]
nScale2 := (aScreenArea[4]-aScreenArea[2]) / aWindowSize[2]

aScale := { nScale1, nScale2, nScale1, nScale2, .t. }

DCGETOPTIONS SCALEFACTOR aScale
This requires that you know the size of the Dialog Window (oDlg:currentSize())