Syntax
ScaleY.d = DrawGetDPIScaleY()
Description
Retrieves the current vertical DPI scaling factor being used by the active drawing context. This factor
is calculated as CurrentDrawDPI_Y / 96.0.
Parameters
This command takes no parameters.
Return Value
Returns the current vertical DPI scaling factor as a floating-point number (Double). Returns
0.0 or #False if called outside a BeginDraw() /
EndDraw() block.
Remarks
This value represents how coordinates and sizes specified in DIPs are scaled vertically to map to physical pixels during rendering. A value of 1.0 means no scaling (96 DPI). A value of 1.5 means 150% scaling (144 DPI), etc. The value can be changed using DrawDPI(). Typically, the vertical scale factor matches the horizontal scale factor.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1)
ScaleX.d = DrawGetDPIScaleX()
ScaleY.d = DrawGetDPIScaleY()
Debug "Initial Draw Scale - X: " + StrD(ScaleX) + ", Y: " + StrD(ScaleY)
; Change DPI
DrawDPI(144) ; 150% scaling
ScaleX.d = DrawGetDPIScaleX()
ScaleY.d = DrawGetDPIScaleY()
Debug "Changed Draw Scale - X: " + StrD(ScaleX) + ", Y: " + StrD(ScaleY) ; Should be ~1.5
; Restore default
DrawDPI(#PG_DrawDPI_Auto)
ScaleX.d = DrawGetDPIScaleX()
ScaleY.d = DrawGetDPIScaleY()
Debug "Restored Draw Scale - X: " + StrD(ScaleX) + ", Y: " + StrD(ScaleY)
EndProcedure
MyWindow = CreateWindow(0, 0, 300, 150, "Get Draw DPI Scale Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
DrawGetDPIScaleX, DrawDPI, DrawGetDPI, BeginDraw, EndDraw
Supported OS
Windows, Linux